LDA 2200H
MOV C,A ; Initialize counter
LXI H, 2201H ; Initialize pointer
SUB A ; Sum low = 0
MOV B,A ; Sumhigh = 0
BACK: ADD M ; Sum = sum + data
JNC SKIP
INR B ; Add carry to MSB of SUM
SKIP: INX H ; Increment pointer
DCR C ; Decrement counter
JNZ BACK ; Check if counter 0 repeat
STA 2300H
MOV A,B ; Store lower byte
STA 2301H ; Store higher byte
HLT ; Terminate program execution
0 Comments