Sample
problem:
(4000H)
= 19H
(400IH)
= 6AH
(4004H)
= I5H (4003H) = 5CH
Result
= 6A19H - 5C15H = OE04H
(4004H)
= 04H
(4005H)
= OEH
Source program:
LHLD 4000H : Get first 16-bit number in HL
XCHG : Save first 16-bit number in DE
LHLD 4002H : Get second 16-bit number in HL
MOV A, E : Get lower byte of the first number
SUB L : Subtract lower byte of the second number
MOV L, A : Store the result in L register
MOV A, D : Get higher byte of the first number
SBB H : Subtract higher byte of second number with
borrow
MOV H, A : Store l6-bit result in memory locations 4004H
and 4005H.
SHLD 4004H : Store l6-bit result in memory locations
4004H and 4005H.
HLT : Terminate program execution.
|
0 Comments