Google

Jul 4, 2008

Subtraction of two 16 bit numbers using Indirect Addressing

The following is the program for addition of two sixteen bit numbers using indirect addressing. Source Index and Destination Index are set to 2000 and 4000 respectively. The input is given as four 8 bit numbers AL , AH and BL , BH.
i.e
AH+AL = AX
and
BH+BL=BX

The program code is as follows:
------------------------------------
MOV SI 2000
MOV DI 4000
MOV AX,[SI]
MOV BX, [ SI+2]
SUB AX,BX
MOV [DI],AX
INT A5
------------------------------------
Input

2000: 05
2001: 00
2002: 03
2003:00

Output
4000: 02

Similar to the above code just by replacing SUB by ADD addition of two 16 bit numbers can be performed using indirect addressing.

You might be also interested in:

:: 8051 or PIC microcontroller which is better
:: Effective addresses
:: Floating Point Initializations

1 comment:

Anonymous said...

too impressive