| ??? 11/06/06 13:47 Read: times |
#127432 - Skinnin' cats Responding to: ???'s previous message |
Good Morning Erik,
To the best I can tell at 0730 hours local time, using CJNE to accomplish the same general three-case task would save only one instruction (10 instructions compared to 11 in my earlier post). However, it wouldn't have introduced Abdullah to the idea of bit-masking. Granted, I don't know that he isn't already familiar with the concept, but his original post gave me the impression that he is new to this subject so it seemed like a good starting point. Here's my 10 instruction implementation using CJNE (Compare and Jump if Not Equal).
; Compare R0 to R1
MOV A, R0
CJNE A, R1, NotEqual
MOV A, #0x000
JZ CONTINUE
NotEqual: JC R0LTR1
MOV P1, #0x000
MOV A, #0x000
JZ CONTINUE
R0LTR1: MOV R1, #0x0FF
CONTINUE: Here is where your code resumes
Again, this is the general three-case implementation. In the original post, however, there were only two cases. If R0 > R1, clear P1. Otherwise, set P1. How many instructions will it take you to accomplish this two-case implementation, both with and without CJNE? I don't think it will take as many instructions as the more general case. |
| Topic | Author | Date |
| compare registers | 01/01/70 00:00 | |
| Bible | 01/01/70 00:00 | |
| Andy, please, don't mislead him | 01/01/70 00:00 | |
| this is not my homework !!! | 01/01/70 00:00 | |
| directives are to control the behaviour... | 01/01/70 00:00 | |
| 8051 Instructions | 01/01/70 00:00 | |
| nobody mentioned CJNE | 01/01/70 00:00 | |
| Skinnin' cats | 01/01/70 00:00 | |
| miaaaaauuuuuuuuuuw | 01/01/70 00:00 | |
| does 0730 mean \"late late night\" ? :-) | 01/01/70 00:00 | |
| Probably | 01/01/70 00:00 | |
a better assembler will handle that | 01/01/70 00:00 |



