This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Homework help

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?

Parents
  • It's really very simple:

    You start with a pencil and a piece of paper, and the Instruction Set Manual.

    Squared paper is probably best - so you can have columns for register values, data values, etc.

    On the paper, write down the starting conditions for the registers & data you use
    (remember - these could be "undefined")

    Write down the first instruction of your program; refer to the Instruction Set Manual to see what that instruction does.

    Write down how that instruction changes the registers & data.

    Rinse and repeat for each instruction in sequence.

    As you have a loop, some instructions will get repeated...

    You really should do this manually before using the simulator - you will learn more that way.

    Your teacher should be able to demonstrate this to you.

Reply
  • It's really very simple:

    You start with a pencil and a piece of paper, and the Instruction Set Manual.

    Squared paper is probably best - so you can have columns for register values, data values, etc.

    On the paper, write down the starting conditions for the registers & data you use
    (remember - these could be "undefined")

    Write down the first instruction of your program; refer to the Instruction Set Manual to see what that instruction does.

    Write down how that instruction changes the registers & data.

    Rinse and repeat for each instruction in sequence.

    As you have a loop, some instructions will get repeated...

    You really should do this manually before using the simulator - you will learn more that way.

    Your teacher should be able to demonstrate this to you.

Children
No data