Question: Write a program to copy 10 bytes of data at ROM address 500H to RAM starting at location 40H. Start with creating a look-up table at a convenient location
ORG 500H TABLE: DB 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
ORG 40H START: MOV DPTR, #TABLE ;SOURCE POINTER MOV R1, #40H ;DESTINATION POINTER MOV R3, #10 ;COUNTER
BACK: MOVC A, @A+DPTR ;GET A BYTE FROM THE SOURCE MOV @R1, A INC R1 INC DPTR DJNZ R3, BACK ;Does this 10 times END
This is what I have but I have no idea if it is right or working correctly. Can anyone help me out?
So do the paper & pencil exercise to map out what you think should be happening.
Cross-check what you think the instructions do with the descriptions in the Instruction Set Manual.
Then run you code in the Simulator; see where the simulator results differ from your paper & pencil results - then go back to the Instruction Set Manual; re-read and understand the instructions ...
Always question what your teachers say if it is vague!