Advertisements
Advertisements
Question
Write a subroutine to fill the memory location 2501H to 25FF H with Hex number 01H to FFH.
Code Writing
Advertisements
Solution
FILL: LXI H, 2501H ; HL points to starting address
MVI A, 01H ; A = 01H (initial data)
MVI B, FFH ; Counter = FFH (255 locations)
LOOP: MOV M, A ; Store A at memory location [HL]
INX H ; Point to next memory location
INR A ; Increment data (01H → FFH)
DCR B ; Decrement counter
JNZ LOOP ; Repeat until B = 00H
RET ; Return from subroutineshaalaa.com
Is there an error in this question or solution?
