.stack 10h
array_cpy db 10 dup (?)
Here is MPP Experiment 5, completed start to end:
The download contains both the algorithms and flowcharts along with the answer to Q3. Q1 can be found in techmax/technical and Q2 is fairly easy, so it has been skipped.
Here are the codes:
SMALLest number:
.model small
.stack 100h
data segment
array db 50h,20h,99h,30h,40h,10h,60h,70h,80h,90h
max db 0ffh
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
xor dl,dl
mov cl,0Ah
lea bx,array
mov al,max
back: cmp al,[BX+DI]
jc skip
mov dl,[BX+DI]
mov al,dl
skip: inc di
dec cl
jnz back
mov max,al
hlt
code ends
end start
LARGEest number:
.model small
.stack 100h
data segment
array db 10h,20h,99h,30h,40h,50h,60h,70h,80h,90h
max db 0
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
xor dl,dl
mov cl,0Ah
lea bx,array
mov al,max
back: cmp al,[BX+DI]
jnc skip
mov dl,[BX+DI]
mov al,dl
skip: inc di
dec cl
jnz back
mov max,al
hlt
code ends
end start
|
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: