Sem 6‎ > ‎MPRC LAB‎ > ‎

P8: Sum of two 16 bit numbers with carry.

posted Apr 7, 2013, 3:33 AM by Neil Mathew   [ updated Apr 7, 2013, 3:45 AM by Neil Mathew ]
This program uses the following instructions which I haven't used in the other ones.

Use of LHLD <16bit memory> instruction to load the 16 bit number stored in two separate 8 bit memory locations to the H and L Register. SHLD <16bit memory> for storing ans.

Use of DAD rp instruction to add the contents of the H-L pair with the specified Register pair.

Use of XCHG instruction to swap values of DE pair and HL pair.


PROGRAM:



MVI C, 00
LHLD 2500
XCHG
LHLD 2502
DAD D
JNC AHEAD
INR C
AHEADSHLD 2504
MOV A,C
STA 2506


Comments