COPY DATA
WRITE A 8085 ASSEMBLY LANGUAGE PROGRAM TO COPY DATA FROM ONE 16 BIT LOCATION TO ANOTHER LOCATION AND THE VALUE WILL STORED INTO ANOTHER MEMORY LOCATION.
THEORY :
In the 8085 microprocessor, We will perform the data copy operation. To copy we need one memory address with a defined 8-bit value and another memory location to store that value.
ALGORITHM :
Step 1: MVI H,0Ah; to load the value in register H, it is used to store iteration value.
Step 2: LXI B,2000h; to point source memory location, register pair B-C is initialized.
Step 3: LXI D,2100h; to point destination memory location, register pair D-E is initialized.
Step 4: LDAX B; to load the accumulator from the memory location pointed by B-C register pair.
Step 5: STAX D; to store the accumulator content into the memory location pointed by D-E register pair.
Step 6: INX B; to increment the value by 1 for the B-C register pair.
Step 7: INX D; to increment the value by 1 for the D-E register pair.
Step 8: DCR H; to decrement the value by 1 for the H-L register pair.
Step 9: JNZ (loop); to jump on non zero to loop address (step 4)
IMPLEMENTATION :
Location | Mnemonics | Hex Code |
---|---|---|
3000 | MVI H, | 26 |
3001 | 0Ah | 0A |
3002 | LXI B | 01 |
3003 | 00 | 00 |
3004 | 20 | 20 |
3005 | LXI D | 11 |
3006 | 00 | 00 |
3007 | 21 | 21 |
3008 | LDAX B | 0A |
3009 | STAX D | 12 |
300A | INX B | 03 |
300B | INX D | 13 |
300C | DCR H | 25 |
300D | JNZ | C2 |
300E | 08 | 08 |
300F | 30 | 30 |
3010 | HLT | 76 |
INPUT AND OUTPUT :
Location | Input |
---|---|
2000 | 01 |
2001 | 03 |
2002 | 05 |
2003 | 07 |
2004 | 09 |
2005 | 00 |
2006 | 02 |
2007 | 04 |
2008 | 06 |
2009 | 08 |
Location | Output |
---|---|
2100 | 01 |
2101 | 03 |
2102 | 05 |
2103 | 07 |
2104 | 09 |
2105 | 00 |
2106 | 02 |
2107 | 04 |
2108 | 06 |
2109 | 08 |
DISCUSSION :
In this program, We perform a task where we have seek total number of iteration by MVI H,0Ah. Then we set B-C register pair for taking all the value of that series and D-E register pair is also loaded for storing the information set. Then we perform the loop, within loop we read the value of B-C register pair to store D-E register pair and also increment the value of B-C and D-E register pair. and decrementing the value of H-L register pair by 1. And now when the H-L pair value will be zero then terminate from loop and stop the program.
YOU MIGHT LIKE:
FAQ :
Which command is used to transfer the data from external memory to the accumulator?
In 8085 Instruction set, MOV r, M is an instruction where the 8-bit data content of the memory location as pointed by HL register pair will be moved to the register r. ... It occupies only 1-Byte in memory. MOV E, M is an example instruction of this type. It is a 1-Byte instruction.
Which flag is affected by MOV instruction?
The MOV instruction never affects the flags. Whenever the destination operand equals Zero, the Zero flag is set.
What is the full form of XRI instruction and it's usage?
The full form of XRI instruction is X-OR Immediate. It is used for binary X-OR operation ( Logical OR operation). The table of X-OR is given below:
What is the full form of XRA R instruction and it's usage?
The full form of XRA instruction is "XOR ACCUMULATOR" and R stands for any of the following registers, memory location pointed by HL register pair.
R= A,B,C,D,E,H,L,or M This instruction is used to XOR contents of R with the ACCUMULATOR. The result of XOR operation will be stored in the Accumulator.
Comments
Post a Comment