You have no items in your shopping cart.

Subtotal: 0.00

16-BIT SUBTRACTION


AIM

To perform 16-bit subtraction of two 16-bit data and store the result in memory.


THEORY

The first data is brought to Stack index and the second one in any one of the other registers, say B. The Subtraction is done using SUB. The result is then stored at 1520. The SUB instruction affects flags depending on result.


 
ASSEMBLY PROGRAM TO SUBTRACT TWO 16 BIT NUMBER

ADDRESS

OPCODE

MNEMONICS

1100

BE 00 15

MOV SI, 1500

1103

AD

LODSW

1104

89 C3

MOV BX, AX

1106

AD

LODSW

1107

01 C3

SUB   BX, AX

1109

BF 20 15

MOV DI, 1520

110C

89 1D

MOV  [DI], BX

110E

CC

INT 3


PROCEDURE

  • Key in the opcodes from the address specified.
  • Enter data at 1500 and 1502 as specified in the Example.
  • Execute the program and check for the result at 1520.
  • Change data at 1500 and 1502 execute each time and check for result.

EXAMPLE

The two data to be subtracted are at 1500 and 1502. The result is stored at 1520.
DATA : (1500) = 12 (1501) = 21
(1502) = 12 (1502) = 21
RESULT: (1520 to 1521) = 2441.


RESULT

Thus the Subtraction of two 16 bit numbers is stored in the resultant memory