Wednesday, June 3, 2020

Assembly Program to DIVISION two16-bit number by 8-bit numbers 8086 ( signed and unsigned)

Hello!

In assembly language 8086 we use mnemonics in order to perform arithmetic operations like   in DIV/IDIV division.
So, Let's dive deep into what  DIV and IDIV is ...

DIV:- It  divides unsigned/signed word(16bit) by unsigned/signed byte(8bit) . Quotient is stored in AL  and remainder stored in AH register.

IDIV:-  It  divides signed word(16bit) by signed byte(8bit) . Quotient is stored in AL  and remainder stored in AH register.

Below are programs for signed division and unsigned division of 16bit/8bit in 8086....

A) Unsigned 8086 Program:-

data segment
no1 dw 21h
no2 db 31h
q db ?
 db ?
data ends
code segment
start : assume  cs :code,  ds :data
mov ax ,data
mov ds , ax
mov ax , no1
DIV  no2
mov  q , al
mov r , ah
mov ah ,4ch
int 21h
code ends
end start


B) Signed Division 8086 Program:-

data segment
no1 dw 21h
no2 db 31h
q db ?
 db ?
data ends
code segment
start : assume  cs :code,  ds :data
mov ax ,data
mov ds , ax
mov ax , no1
IDIV  no2
mov  q , al
mov r , ah
mov ah ,4ch
int 21h
code ends
end start

32/16 bit DIVISION 8086 Program Code - for Signed and Unsigned Both

Programs:-

For many other Assembly Language  Programs related to microprocessor 8086, data structures  and C++ visit our  BLOG 
There are programs of largest ,smallest ,division ,multiplication,odd/even,block operation ,string operations ,etc

No comments:

Post a Comment