100% found this document useful (1 vote)
525 views8 pages

Experiment - 1: Write A Program For 16 Bit Arithmetic Operations For 8086 (Using Various Addressing Modes) I) - Addition of Two 8-Bit Numbers

The document describes 8 programs that perform various arithmetic operations on 8-bit and 16-bit numbers using 8086 assembly language. The programs perform: 1) addition of two 8-bit numbers, 2) addition of two 16-bit numbers, 3) subtraction of two 8-bit numbers, 4) subtraction of two 16-bit numbers, 5) multiplication of two 8-bit numbers, 6) multiplication of two 16-bit numbers, 7) division of two 8-bit numbers, and 8) division of two 16-bit numbers. Each program loads the numbers from memory, performs the operation, stores the result in memory, and exits to DOS.

Uploaded by

neha yarrapothu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
525 views8 pages

Experiment - 1: Write A Program For 16 Bit Arithmetic Operations For 8086 (Using Various Addressing Modes) I) - Addition of Two 8-Bit Numbers

The document describes 8 programs that perform various arithmetic operations on 8-bit and 16-bit numbers using 8086 assembly language. The programs perform: 1) addition of two 8-bit numbers, 2) addition of two 16-bit numbers, 3) subtraction of two 8-bit numbers, 4) subtraction of two 16-bit numbers, 5) multiplication of two 8-bit numbers, 6) multiplication of two 16-bit numbers, 7) division of two 8-bit numbers, and 8) division of two 16-bit numbers. Each program loads the numbers from memory, performs the operation, stores the result in memory, and exits to DOS.

Uploaded by

neha yarrapothu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Experiment -1: Write a program for 16 bit arithmetic

operations for 8086 (using Various Addressing Modes)


i). ADDITION OF TWO 8-BIT NUMBERS
data1 segment
num1 db 05h
num2 db 05h
res db 00h
data1 ends

code1 segment
assume cs: code1, ds: data1

start:
mov ax, data1 ; Initialization of data segment
mov ds, ax
mov al, num1
mov bl, num2
add al, bl ; Add two 8-bit numbers
mov res, al
mov ah, 4ch ; Exit to DOS mode
int 21h

code1 ends
end start

Result:
Memory
Location
AL(before Addition)
AL(After Addition)
ii). ADDITION OF TWO 16-BIT NUMBERS

data1 segment
num1 dw 0A010h
num2 dw 1203h
res1 dw 00h
data1 ends

code1 segment
assume cs: code1, ds: data1

start: mov ax,data1 ; Initialization of data segment


mov ds,ax
mov ax,num1
mov bx,num2
add ax,bx ; Add the two 16-bit numbers
mov res1,ax
mov ah,4ch ; Exit to dos mode
int 21h

code1 ends
end start

Result:
Memory
Location
AX(before Addition)
AX(After Addition)
iii). SUBTRACTION OF TWO 8-BIT NUMBERS
data1 segment
num1 db 05h
num2 db 03h
res db 00h
data1 ends

code1 segment
assume cs: code1, ds: data1

start: mov ax,data1 ;Initialization of data segment


mov ds,ax
mov al,num1
mov bl,num2
sub al,bl ; Subtract two 8-bit numbers
mov res,al
mov ah,4ch ; Exit to DOS mode.
int 21h

code1 ends
end start

Result:

Al(before Subtraction) Memory


Location
Al(After subtraction)
iv). SUBTRACTION OF TWO 16-BIT NUMBERS
data1 segment
num1 dw 0AA01h
num2 dw 0A012h
res dw 00h
data1 ends

code1 segment
assume cs: code1, ds: data1

start: mov ax,data1 ; Initialization of Data segment


mov ds,ax
mov ax,num1
sub ax,num2 ; Subtract two 16-bit numbers
mov res,ax
mov ah,4ch ; Exit to DOS mode
int 21h

code1 ends
end start

Result:
AX(before Subtraction)
AX(After subtraction)
Memory
Location
v). MULTIPLICATION OF TWO 8-BIT NUMBERS

data1 segment
num1 db 07h
num2 db 02h
res dw 00h
data1 ends

code1 segment
assume cs: code1, ds: data1

start: mov ax,data1 ; Initialization of data segment


mov ds,ax
mov ax,00h
mov al,num1
mov bl,num2
mul bl ; Multiply two unsigned 8-bit numbers
mov res,ax
mov ah,4ch ; Exit to DOS mode
int 21h

code1 ends
end start

Result:
AL(lower byte)
Memory
AH(higher byte) Location
vi). MULTIPLICATION OF TWO 16-BIT NUMBERS

data1 segment
num1 dw 0AA10h
num2 dw 0AA10h
res1 dw 0000h
res2 dw 0000h
data1 ends

code1 segment
assume cs: code1, ds: data1

start: mov ax,data1 ;Initialization of data segment


mov ds,ax
mov ax,num1
mov bx,num2
mul bx ;Multiply two 16-bit unsigned numbers
mov res1,ax ;Store the product in two word locations
mov res2,dx
mov ah,4ch ;Exit to DOS mode
int 21h

Code 1 ends
end start
Memory
Result: AX(lower 2bytes) Location
DX(higher 2bytes)
vii). DIVISION OF TWO 8-BIT NUMBERS
data1 segment
num1 db 0Ah
num2 db 03h
Quo db 00h
rem db 00h
data1 ends

code1 segment
assume cs: code1, ds: data1

start: mov ax,data1 ;Initialization of data segment


mov ds,ax
mov ah,00h
mov al,num1
mov bl,num2
div bl ;Divide a 8-bit dividend with 8-bit divisor
mov quo,al ;Store the quotient in memory
mov rem,ah ;Store the quotient in memory
mov ah,4ch ;Exit to DOS mode
int 21h

code1 ends
end start

Result: Quoteient (Al)


Remainder(Ah)

Memory
Location
viii). DIVISION OF TWO16-BIT NUMBERS

data1 segment
num1 dw 0AA01h
num2 dw 110Ah
quo dw 0000h
rem dw 0000h
data1 ends

code1 segment
assume cs: code1, ds: data1
start: mov ax,data1 ;Initialization of data segment
mov ds,ax
mov dx,00h
mov ax,num1
mov bx,num2
div bx ;Division of a 16-bit dividend by a 16-bit
;divisor
mov quo,ax
mov rem,dx
mov ah,4ch ;Exit to DOS mode
int 21h

code1 ends
end start
Memory
Result: Quoteient (AX) Location
Remainder(DX)

You might also like