Skip to main content
Subtract two 16-bit numbers
Subtract two 16-bit numbers
- LHLD 2500H : "Get first 16-bit number in HL"
- XCHG : "Save first 16-bit number in DE"
- LHLD 2502H : "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 2504H and 2505H"
- SHLD 2504H : "Store l6-bit result in memory locations 2504H and 2505H"
- HLT : "Terminate program execution"
Comments
Post a Comment