Intoduction to Computer Organization 1 Write an assembly lan
Intoduction to Computer Organization
1. Write an assembly language program to fill a block of ten bytes starting at memory 31H with characters 2A.
Solution
Step 1:Move bytes from location 31h downwards
Source program:
LXI H,31H :Initialize pointer at the last location of array
LXI D,33H :Initialize another pointer to point the last location of array after insertion
Again :MOV A,M :get character
STAX D D :store at the new location
DCX :decrement destination pointer
DCX H :decrement source pointer
MOV A,L :move a to l
CPI 05 H:check whether desired bytes are shifted or not
JNZ AGAIN :if not repeat the process
INX H :adjust the memory pointer
LXI D,31H :intialize the memory pointer to point the string to be inserted
REPE :LDAX D:get the character
MOV M,A :store it in array
INX D :increment destination pointer
INX H :increment source pointer
MOV A,E :check
CPI 04 :check whether the bytes are inserted
JNZ REPE:if not repeat the process
HLT :stop

