Tuesday, July 9, 2013

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



Subtracting 3467h from ACDCh i.e. ACDCh – 3467h= 7875h

MVI H,ACH                 [move ACh in register H]
MVI L,DCH                  [move DCh in register L]
MVI D,34H                  [move 34h in register D]
MVI E,67h                   [move 67h in register E]
MOV A,L                      [move value 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 C010H                [store the result, L in C010h and H in C011h]
HLT                                 [stop processing]

1 comment: