.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:
Questions:
a) List 8-bit and 16-bit registers present in 8085.
Answer:
The 8085/8080A-programming model includes six registers, one accumulator, and one flag register, as shown in Figure. In addition, it has two 16-bit registers: the stack pointer and the program counter. They are described briefly as follows. The 8085/8080A has six general-purpose registers to store 8-bit data; these are identified as B,C,D,E,H, and L as shown in the figure. They can be combined as register pairs - BC, DE, and HL - to perform some 16-bit operations. The programmer can use these registers to store or copy data into the registers by using data copy instructions.
b) What is the role of accumulator in 8085?
Answer:
The accumulator is an 8-bit register that is a part of arithmetic/logic unit (ALU). This register is used to store 8-bit data and to perform arithmetic and logical operations. The result of an operation is stored in the accumulator. The accumulator is also identified as register A.
c) List allowed register pairs of 8085.
Answer:
BC, DE and HL register pair.
Below is the link to the answers to assignment number 1 of SAS in compressed zip format.
File size: 16.09MB
CORRECTIONS:
(1) There is also a minute correction on page 10, question 5, 4th sum. The final answer posted earlier is correct but still please refer to the solution here:
DISCLAIMER:
The uploads are done for doubt solving in case you get stuck at some point! Don't just copy blindly!!