Tuesday, July 9, 2013

Write an assembly language program to subtract two 16-bit numbers. (in 8085)



LHLD C003    [load the content of C003 in register L and C004 in register H]
XCHG         [transfer the value of register H in D and register L in E]
LHLD C000    [load the content of C000 in register L and C001 in register H]
MOV A,L     [move the content of register L in accumulator]
SUB E       [subtract value of register E from accumulator]
MOV L,A              [move the value of accumulator in register L]
MOV A,H             [move the value of register H in accumulator]
SBB D                    [subtract with borrow the value of register D from accumulator]
MOV H,A             [move the value of accumulator in register H]
SHLD C030           [store the value of register L in C030 and H in C031]
HLT                         [Stop processing]

No comments:

Post a Comment