Advertisements
Advertisements
Question
Write an assembly language program to fill the memory block of 16 memory locations staring from C200H with data byte 22H and 33H every alternate memory locations.
Code Writing
Advertisements
Solution
LXI H, C200H ; Point to starting memory location
MVI C, 08H ; Counter set to 8 (since we fill 2 bytes per loop)
LOOP: MVI M, 22H ; Fill first location with 22H
INX H ; Move to next location
MVI M, 33H ; Fill next location with 33H
INX H ; Move to next location
DCR C ; Decrement counter
JNZ LOOP ; Repeat until 16 locations are filled (8 * 2)
HLT ; Terminate
shaalaa.com
Is there an error in this question or solution?
