Monday, May 20, 2019

Assembly Language Program to DIVISION two 32-bit / 16 –bit numbers 8086 (signed and unsigned)

(For many other Assembly Language  Programs related to microprocessor 8086, data structures and C++ visit our  BLOG )

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 double-word(32bit) by unsigned/signed word(16bit) .

IDIV:-  It  divides signed double-word(32bit) by signed word(16bit) . 

Below are programs for unsigned and signed division of 32-bit/16-bit:-
a) Unsigned:
data segment
no1 dd 02h
no2 dw 03h
q dw ?
r dw ?
data ends
code segment
start : assume  cs :code,  ds :data
mov ax ,data
mov ds , ax
lea si , no1
mov ax, [ si ]
mov dx,[ si+2 ]
DIV no2
mov q , ax
mov r , dx
mov ah ,4ch
int 21h
code ends
end start

b) Signed 32-bit/16-bit  program 8086 . (Click on the Link for detailed program code.)

1 comment:

  1. Amazing blog. Best for learning microprocessor 8086 codes

    ReplyDelete