Hi
The result I'm getting on the simulator is different from the one which I get when I do the problem by hand. What's wrong? Please help me. Thank you.
The result I'm getting on the simulator is different from the one which I get when I do the problem by hand. What's wrong? Please help me. Thank you.
Rich (BB code):
;Write a program to add two 32-bit numbers stored in RAM locations.
;Let's assume that the numbers are stored at RAM location 40-43H and 50-53H respectively.
ORG 0H
MOV 40H, #23
MOV 41H, #15
MOV 42H, #60
MOV 43H, #70
MOV 50H, #30
MOV 51H, #40
MOV 52H, #63
MOV 53H, #77
MOV R0, #40H ;pointer of bank 0
MOV R1, #60H ;result storage bank 0
MOV R2, #4 ;counter
SETB RS0
MOV R1, #50H ;pointer bank 1
CLR RS0
CLR C
REPEAT: MOV A, @R0
SETB RS0
ADDC A, @R1
INC R1
CLR RS0
MOV @R1, A
INC R0
INC R1
DJNZ R2, REPEAT
JNC EXIT
INC @R1
EXIT: NOP
SJMP $
END
Attachments
-
230.4 KB Views: 94
-
226.2 KB Views: 73