0% found this document useful (0 votes)
101 views

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

The document describes code examples for performing basic arithmetic operations like addition, subtraction, multiplication and division using 8-bit and 16-bit numbers on the 8086 microprocessor. It includes code segments for initializing data sections with numeric values, moving values to accumulators, performing operations and storing results. Operations demonstrated include adding, subtracting, multiplying and dividing 8-bit numbers, as well as adding and subtracting 16-bit numbers. The code examples also show initializing the data segment and ending the programs.

Uploaded by

prajwal patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views

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

The document describes code examples for performing basic arithmetic operations like addition, subtraction, multiplication and division using 8-bit and 16-bit numbers on the 8086 microprocessor. It includes code segments for initializing data sections with numeric values, moving values to accumulators, performing operations and storing results. Operations demonstrated include adding, subtracting, multiplying and dividing 8-bit numbers, as well as adding and subtracting 16-bit numbers. The code examples also show initializing the data segment and ending the programs.

Uploaded by

prajwal patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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