Skip to main content

Find smaller of two numbers

Find smaller of two numbers

LXI H, 2501H : "Address of first number in H-L pair"
MOV A, M  : "1stt number in accumulator"
INX H      : "Address of 2nd number in H-L pair"
CMP M      : "compare 2nd number with 1st number"
JC AHEAD  : "Yes, smaller number is in accumulator. Go to AHEAD"
MOV A, M  : "No, get 2nd number in the accumulator"
STA 2503 H  : "Store smaller number in 2503H"
HLT          : "Stop"

Comments