| ??? 08/14/08 19:48 Read: times |
#157490 - cjne w/ 2 registers? |
Hi,
I am constantly updating R0 and R1. I wish to do CJNE but can't. What am I doing wrong? I looked at "Bible" and see I can't do this, but how can it be done? here is the code
; GET DIFFERNCE BETWEEN OLD AND NOW
GETDIFFERENCE: MOV A,R1 ;R1 IS OLD
CJNE A, R0, CheckLess ;SEE IF SAME ERROR IS HERE
JMP MAIN ;OLD & NEW ARE SAME
CheckLess: JC OldLessThanNow ;R0 is less than R1
OldGreaterThanNow: MOV A,R1
SUBB A, R0
MOV R5,A ;R5 = # OF TIMES TO RUN LOOP
MOV A,R0 ;R0 = NOW
MOV R1,A ;R1 = OLD
;NOW SET DI BIT AND RUN LOOP FOR A# OF TIMES
SETB DI
DJNZ R5,LOOP
JMP MAIN
OldLessThanNow: MOV A,R0
SUBB A, R1
MOV R5,A ; R5 = # OF TIMES TO RUN LOOP
MOV A,R0 ;R0 = NOW
MOV R1,A ;R1 = OLD
;NOW SET DI BIT AND GO TO LOOP FOR A# OF TIMES
CLR DI
DJNZ R5,LOOP
JMP MAIN
Thank You, Steve |
| Topic | Author | Date |
| cjne w/ 2 registers? | 01/01/70 00:00 | |
| think i found it | 01/01/70 00:00 | |
| cjne | 01/01/70 00:00 | |
| there is nothing particularly weird about 805x | 01/01/70 00:00 | |
| I ran this through the simulator ... | 01/01/70 00:00 | |
| Looking at the code... | 01/01/70 00:00 | |
| SUBB and carry | 01/01/70 00:00 | |
Thank You | 01/01/70 00:00 |



