Write a programmers to Exchange the contents of memory locations using microprocessor simulator

No comments
Statement : Exchange the contents of memory locations 2000H and 4000H.

Program 1:

LDA  2000H   : “Get the contents of memory location 2000H into accumulator”
MOV B,   A    : “Save the contents into B register”
LDA  4000H   : “Get the contents of memory location 4000Hinto accumulator”
STA  2000H    : “Store the contents of accumulator at address 2000H”
MOV   A, B    : “Get the saved contents back into A register”
STA 4000H    : “Store the contents of accumulator at address 4000H”

Program 2: 

LXI  H 2000H  : “Initialize HL register pair as a pointer to memory location 2000H.”
LXI  D 4000H  : “Initialize DE register pair as a pointer to memory location 4000H.”
MOV  B, M      : “Get the contents of memory location 2000H into B register.”
LDAX  D         : “Get the contents of memory location 4000H into A register.”
MOV  M, A     : “Store the contents of A register into memory location 2000H.”
MOV  A,  B     : “Copy the contents of B register into accumulator.”
STAX  D          : “Store the contents of A register into memory location 4000H.”
HLT                 : “Terminate program execution.”

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀