Sazid Khandaker 1520347642 - Mid Assessment v1
Sazid Khandaker 1520347642 - Mid Assessment v1
Sazid Khandaker 1520347642 - Mid Assessment v1
CSE 331
Section 01
Summer 2020
Student ID : 1520347642
Student ID:1520347642
Please read the questions very carefully and answer accordingly. All the answers should be written in
the answer script that has been provided. Calculators/pens/pencils are allowed. You must surrender
any textbook/notebook/cell-phone. Adopting any unfair means during the exam will automatically
result in expulsion without any prior/post notice. You must return back your question paper with your
answer script. Answer any 3 of the 4 sets of the questions given. Clearly indicate the number of the
questions being answered (Example: Answer to the question: 3 (a)(i)
(a) In the given 8086 block diagram, write down the sizes of the (i) registers (ii) segments
(iii) data bus and (iv) address bus How many instructions can be stored in the queue?
(CO1) [1+1+1+1+1]
All of them are 16-bits registers. These registers can be used as either 8-bits
registers or 16-bits registers.
⦁ Segments: 8086 has four segments registers actually contain the upper 16-bits.
⦁ Data bus: It has a 16-bits data bus .it can read data from or write data to
memory
⦁ Address bus: It has 20-bits address bus .it can access up to 220 memory locations.
(b) Construct the assembly code for 8086 in order to find the maximum in a given array
using LEA. You may take the given algorithm into account. Use comments where
needed [CO2] [5]
(a) -For the given code segment , find the value of ax [CO2] [2.5+2.5]
(i)
mov ax, 5Ah
mov cx, 20h
mul cx
DAA
org 100h
mov dl,50h
mov cx,2000h
mov ds,cx
mov bx,0FFFFh
mov [bx],dl
ret
Answer:
MOV Ax,1212h ;store 1212h in AX.
MOV BX,3434H ;store 3434h in BX.
PUSH AX ;store value of AX in the stack
PUSH BX ;store value of BX in the stack
POP AX ;set AX to original value of BX
POP BX ;set AX to original value of AX
The exchange happens because stack uses LIFO (Last In First Out) algorithm, so when we
push 1212h and then 3434h, on pop we will first get 3434h and only after it 1212h.
(b) Write a delay loop which produces a delay of 500 μs on an 8086 with a 5 MHz clock [7]
Hints: MOV-4 cycles ; NOP-3 cycles ; Loop – 17 cycles if return, 5 cycles if exit
Answer:
Formula, N = (CT – Co + D) / Cl