1.addition of 8 Bit Numbers 2.subtraction of 8 Bit Numbers: Microprocessor 8086 Codes

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

MICROPROCESSOR 8086 CODES

1.ADDITION OF 8 BIT NUMBERS 2.SUBTRACTION OF 8 BIT NUMBERS

.8086 /BASIC COMMAND .8086 /BASIC COMMAND


.model small /BASIC COMMAND .model small /BASIC COMMAND

.data /DATA SECTION .data /DATA SECTION


num1 db 09h /NUM 1 num1 db 09h /NUM 1
num2 db 03h /NUM 2 num2 db 03h /NUM 2
res db? /SUM res db? /DIFFERENCE

.code /CODE SECTION .code /CODE SECTION


start /START start /START
mov ax,@data /LOAD START ADD OF DATA SEG mov ax,@data /LOAD START ADD OF DATA SEG
mov ds,ax /DATA SEG INITIALIZED mov ds,ax /DATA SEG INITIALIZED

mov ah,00h /AH==00 mov ah,00h /AH==00


mov al,num1 /1ST NUM TO ACC mov al,num1 /1ST NUM TO ACC
add al,num2 /ADD 2ND NUM TO 1ST NUM sub al,num2 /SUB 2ND NUM FROM 1ST NUM
mov res,al / MOV FINAL VALUE TO RES mov res,al / MOV FINAL VALUE TO RES

mov ah,4ch /END PROGRAM mov ah,4ch /END PROGRAM


int 21 /CALL INTERRUPT int 21 /CALL INTERRUPT
end start /END START end start /END START

3.MULTIPLICATION OF 8 BIT NUMBERS 4.DIVISION OF 8 BIT NUMBERS

.8086 /BASIC COMMAND .8086 /BASIC COMMAND


.model small /BASIC COMMAND .model small /BASIC COMMAND

.data /DATA SECTION .data /DATA SECTION


num1 db 09h /NUM 1 num1 db 09h /NUM 1
num2 db 03h /NUM 2 num2 db 03h /NUM 2
res db? /MULTIPLE res db? /SUM

.code /CODE SECTION .code /CODE SECTION


start /START start /START
mov ax,@data /LOAD START ADD OF DATA SEG mov ax,@data /LOAD START ADD OF DATA SEG
mov ds,ax /DATA SEG INITIALIZED mov ds,ax /DATA SEG INITIALIZED

mov ah,00h /AH==00 mov ah,00h /AH==00


mov al,num1 /1ST NUM TO ACC mov al,num1 /1ST NUM TO ACC
mul num2 /MUL 2ND NUM TO 1ST NUM mul num2 /MUL 2ND NUM TO 1ST NUM
mov res,al / MOV FINAL VALUE TO RES mov res,al / MOV FINAL VALUE TO RES

mov ah,4ch /END PROGRAM mov ah,4ch /END PROGRAM


int 21 /CALL INTERRUPT int 21 /CALL INTERRUPT
end start /END START end start /END START
5.ADDITION OF 16 BIT NUMBERS 6.ADDITION OF 16 BIT NUMBERS

.8086 /BASIC COMMAND .8086 /BASIC COMMAND


.model small /BASIC COMMAND .model small /BASIC COMMAND

.data /DATA SECTION .data /DATA SECTION


num1 dw 4321h /NUM 1 num1 dw 2222h /NUM 1
num2 dw 1234h /NUM 2 num2 dw 1111h /NUM 2
res dw? /SUM res dw? /SUM

.code /CODE SECTION .code /CODE SECTION


start /START start /START
mov ax,@data /LOAD START ADD OF DATA SEG mov ax,@data /LOAD START ADD OF DATA SEG
mov ds,ax /DATA SEG INITIALIZED mov ds,ax /DATA SEG INITIALIZED

mov ax,num1 /1ST NUM TO AX mov ax,num1 /1ST NUM TO AX


mov bx,num2 /2nd NUM TO BX mov bx,num2 /2nd NUM TO BX
add ax,bx /ADD 2ND NUM TO 1ST NUM sub ax,bx /SUB 2ND NUMBER FROM 1ST
mov res,al / MOV FINAL VALUE TO RES mov res,al / MOV FINAL VALUE TO RES

mov ah,4ch /END PROGRAM mov ah,4ch /END PROGRAM


int 21 /CALL INTERRUPT int 21 /CALL INTERRUPT
end start /END START end start /END START

You might also like