16-BIT DIVISION IN 8086
.MODEL SMALL
.STACK 100H
DATA SEGMENT
NUM1 DW 4567H,2345H
NUM2 DW 4111H
QUO DW 2 DUP(0)
REM DW 1 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV DX,NUM1+2
DIV NUM2
MOV QUO,AX
MOV REM,DX
INT 21H
CODE ENDS
END START
INPUT: Dividend - 23454567,
Divisor - 4111,
OUTPUT: AX – 8AC5H (quotient);
DX – 0952H (reminder);
16-BIT MULTIPLICATION IN 8086
.MODEL SMALL
.STACK 100H
DATA SEGMENT
NUM1 DW 1234H
NUM2 DW 1234H
LSB DW 2 DUP(0)
MSB DW 1 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX
MOV AX,NUM1
MOV DX,NUM2
MUL DX
MOV LSB,AX
MOV MSB,DX
HLT
CODE ENDS
END START
INPUT: NUM1- 1234,
NUM2- 1234,
OUTPUT: AX – 5A90H (LSB);
DX – 014BH (MSB);
8-BIT DIVISION IN 8086
.model small
.stack 100h
assume cs:code, ds:data
data segment
num1 dw 99h
num2 dw 33h
data ends
code segment
START: mov ax,data
mov ds,ax
mov ax,num1
mov bx,num2
div bx
int 21h
code ends
end start
INPUT: NUM1- 99,
NUM2- 33,
OUTPUT: AX- 0003
8-BIT MULTIPLICATION IN 8086
.model small
.stack 100h
assume cs:code, ds:data
data segment
num1 dw 56h
num2 dw 78h
data ends
code segment
START: mov ax,data
mov ds,ax
mov ax,num1
mov bx,num2
mul bx
int 21h
code ends
end start
INPUT: NUM1- 56,
NUM2- 78,
OUTPUT: AX- 2850
NOTE: The code for 16-bit division is 100% correct and tested. It is very likely that sir might question you about how the num1+2 instruction is executed, so be prepared!!
Here are the algorithms and flowcharts for 16-bit multiplication and 16-bit division codes:
0 comments:
Post a Comment