You are on page 1of 11

CSE 2006 - LAB ASSIGNMENT -1

Mridul Jadon
20BCE1734

AIM: Addition, subtraction, multiplication and division of two numbers.


Tool Used: Assembler - MASM 611

Algorithm:

1. (Addition) move one number to the register AL(8bit) or AX (16bit) Another number to the BL (8bit) or BX
(16bit) register. add both the register The result is stored in AL(8bit)or AX(16bit).
2. (Subtraction) We move one number to the register AL(8bit) or AX (16bit) Another 8 to the BL (8bit) or BX
(16bit) register. Subtract both the register Result is stored in AL(8bit) or AX (16bit).
3. (Multiplication)move one number to the register AL(8bit) or AX (16bit) Another 8 bit number to the
BL(8bit) or BX (16bit) register. Multiply the content of register AL (8bit) or AX (16bit) with the contents of
register BL(8bit) or BX (16bit) The result is stored in AL(8bit) or AX(16bit).

4. (Division) move 0000H to the DX register. Then we move one 16-bit number to the register AX and
another 16-bit number to the CX register. After that we divide the content of register AX by the contents
of Register CX. The result is stored in AX.

1. Save to BIN of MASM

2. Now Switch to DOSBox

3. Now LINK<file name> .OBJ

4. ENTER

5. ENTER

6. ENTER

7. ENTER

8. Debug <file name>.exe

9. Output Program
PROGRAM:
Addition
(16 bit)

(8 bit)
SUBTRACTION
(16 bit)

(8 bit)
MULTIPLICATION
DIVISION

Sample Input:
Addition

16-bit
AX:1234H
BX:4H

8bit
AL:12H
BL:7H

Subtraction
16bit
AX:1234H
BX:4H
8bit
AL:12H
BL:07H

Multiplication
AX:1234H
BX:2H

DIVISION
AX:0006H
BX:0002H
Sample Output:
Addition
16bit
AX:1238
8bit
AX:19FF
Subtraction
16bit
AX:1230
8bit
AX:FF0B
Multiplication
16bit
AX:2468
Division
AX:0003

Register/ Memory Contents for I/O:


Addition
16bit

8bit

Subtraction
16bit

8bit
Multiplication

Division

Snapshot of the output


Addition
16bit
8bit

Subtraction
16bit

8bit
Multiplication

Division
Result: Addition, subtraction, multiplication, division operations have been successfully executed using
8bit and 16-bit numbers

You might also like