Solved Quetion Bank For 2nd Class Test - DTM
Solved Quetion Bank For 2nd Class Test - DTM
DB (Define Byte): Allocates memory for a byte or bytes and initializes them with specified values.
DW (Define Word): Allocates memory for a word (2 bytes) and initializes it with specified values.
EQU (Equate): Assigns a constant value to a symbol, allowing for easier reference and modification in the
code.
ORG (Origin): Specifies the starting address for the assembler to place the following code or data in memory.
Immediate Addressing:.
Direct Addressing:
Register Addressing:.
Indirect Addressing:
In this instruction destination is AL for 8 bit and AX for 16 bit and one number is present in AL/AX and other
number is in any other register
MOV BX
MOV BL
DIV Source
In this instruction dividend must be in AX register and divisor is any 8 bit register after division 8 bit quotient will
be in AL and 8 bit remainder is in AH
DIV BL
DIV CX
This instruction is used to store word from source on to the stack location
Operation
SP SP-2
PUSH BX
POP Destination
This instruction is used to store word from stack location to specified destination
Operation
SP SP+2
POP DX
Explain CMP instruction with example
CMP destination, Source
Operation
CMP AL,BL
CMP AX,[SI]
The RET instruction is used to return the program execution control from a procedure to next instruction
immediate after CALL instruction
.data
Declaration of data
.code
MOV DS,AX
………..
………..
……………
END code
List machine control instructions
HLT
NOP
LOCK
WAIT
The source must be in data segment and destination should be extra segment
ES:[DI] DS:[SI]
4 Marks Questions
Explain any four addressing modes of 8086
Immediate Addressing: The operand is specified directly in the instruction. For example, MOV AX, 5 moves
the immediate value 5 into the AX register.
Direct Addressing: The effective address of the operand is given explicitly in the instruction. For example, MOV
AX, [1234h] moves the value stored at memory address 1234h into the AX register.
Register Addressing: The operand is located in a register. For example, MOV BX, AX moves the content of the
AX register into the BX register.
Indirect Addressing: The effective address of the operand is determined by a register. For example, MOV AX,
[BX] moves the value from the memory address pointed to by the BX register into the AX register.
MN/MX Pin (Pin 33): Must be connected to a logic high level to select minimum mode.
ALE Pin: Used to latch the address into external latches.
DT/R Pin: Controls the direction of data flow, determining whether data is read from or written to memory
or I/O devices.
DEN Pin: Data Enable, used to enable the data bus drivers.
Explain Maximum mode of 8086 microprocessor
MN/MX Pin (Pin 33): Must be connected to a logic low level to select maximum mode.
ALE Pin: Address Latch Enable, used to latch the address into external latches.
DT/R Pin: Data Transmit/Receive, controls the direction of data flow.
DEN Pin: Data Enable, used to enable the data bus drivers.
S0, S1, S2 Pins: Used to indicate the type of operation (read, write, etc.) and are connected to the 8288 Bus
Controller.
Draw architecture of 8086
Explain process of physical address generation with suitable example
1. Segment registers carry 16bit data, which is also known as base address.
2. BIU appends four 0 bits to LSB of the base address.This address becomes 20-bitaddress.
3. Any base/pointer or index register carries 16bit offset.
4. Offset address is added into 20-bit base address which finally forms 20 bit physical address of memory
location
If CS=69FAH and IP=834CH calculate the physical address
.model small
.data
array db 12h,11h,21h,9h,19h
.code
mov ax,@data
mov ds,ax
mov bx,5
up1:
mov cx,4
up:
mov al,[si]
cmp al,[si+1]
jc dn
xchg al,[si+1]
xchg al,[si]
dn: inc si
loop up
dec bx
jnz up1
ends
end
Write ALP to multiply two singed numbers
.model small
.data
num1 db -23h
num2 db 45h
.code
mov ax,@data
mov ds,ax
mov ax,num1
mov bx,num2
imul bx
ends
end
Write ALP to convert upper case of string to lower case
.MODEL SMALL
.DATA
STR_1 DB 'COMPUTER$'
STR_2 DB 20 DUP('$')
.CODE
MOV AX,@DATA
MOV DS,AX
NEXT:MOV AL,[SI]
CMP AL,'$'
JE EXIT
ADD AL,20H
MOV [DI],AL
INC SI
INC DI
JMP NEXT
EXIT:
MOV AH,09H
INT 21H
ENDS
END
Write ALP to convert given BCD number into Hexadecimal number
.model small
.data
num db '9999'
hex_num dw 0
mult_fact dw 1
digit_count dw 4
.code
mov ax,@data
mov ds,ax
mov bx,0ah
mov cx,digit_count
and ax,000fh
mul mult_fact
add hex_num,ax
mov ax,mult_fact
mul bx
mov mult_fact,ax
dec si
loop up
ends
end
Write ALP to add the series of 5 numbers
.model small
.data
array db 1,2,3,4,5
sum db 0
.code
mov ax,@data
mov ds,ax
mov cx,5
add sum,al
inc si
loop up
ends
end
Write ALP to transfer block of numbers in memory location
.model small
.data
scr_arr db 1,2,3,4,5,6,7,8,9,10
dst_arr db 10 dup(0)
.code
mov ax,@data
mov ds,ax
mov cx,10
up:
mov al,[si]
mov [di],al
inc si
inc di
loop up
ends
end
Write ALP to add only odd numbers in given array
.model small
.data
array db 11h,12h,13h,14h,15h
sum_odd db 0
.code
mov ax,@data
mov ds,ax
mov cx,5
ror al,1
jc dn
jmp next
add sum_odd,al
next:inc si
loop up
ends
end
Write ALP to check given number is odd or even
.model small
.data
num db 89h
odd db 0
even db 0
.code
mov ax,@data
mov ds,ax
mov al,num
ror al,1
jnc dn
rol al,1
mov odd,al
jmp exit
mov even,al
exit:ends
end
Write ALP to add two 16 bit numbers
.model small
.data
num1 dw 2323h
num2 dw 3445h
.code
mov ax,@data
mov ds,ax
mov ax,num1
add ax,num2
ends
end