Duration: 2 Hours Answer All Questions Total Points: 100 (30 PTS.)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

T.C.

MERSİN ÜNİVERSİTESİ
MÜH. FAK. BM BÖLÜMÜ
2020-2021 EĞİTİM-ÖĞRETİM YILI BAHAR DÖNEMİ
CE308 MICROPROCESSORS FINAL SINAV SORULARI

Sınav Tarihi: 25. / 05. / 2021. Saati: 10 : 00

Ad Soyad: Imza: Numara:


At home exam; plagiarism is intolerable
Duration: 2 hours Answer all questions Total points: 100

Question 1: [30 pts.]


i. Suppose that DS = 1000H, SS=3000H, List =100H, BP=0100H, BX = 0200H and
SI=0300H. Determine the addressing mode and find the accessed memory addresses
for each of the following instructions, assuming real-mode operation:

a) a) MOV [BX],DX Register Indirect Addressing


DS*10h + BX = 1000h*10h + 200h = 10200h & 10201h (2 bytes)
b) MOV ECX,List[BP+SI+30] Base Relative Plus Index Addressing
SS*10h + BP + SI +30 +List = 3000h*10h + 100h + 300h + 1Eh+ 100h =
3051Eh & 3051Fh & 30520h & 30521h (4 bytes)
c) MOV AX,BP Register Addressing
No memory access is this mode

ii. Give the corresponding machine language code of the following instructions:
OPCODEDW MODREGR/M
a) MOV [BX],DX
10001001 00010111 = 89 17h
b) MOV AX,BP
10001011 11000101 = 8B C5h or 10001001 11101000 =89 E8h

Question 2: [25 pts.]


Write an X86 assembly program that counts the number of ones in a byte-sized variable stored
in memory location VAR and stores the resulted number of ones in memory location ONES.

VAR DB 254 ; any byte-sized value (decimal 0-255, hexadecimal 00-FFh, or an ASCII character)
ONES DB ?

MOV DL,0
MOV CX,8
MOV AL,VAR
ShLoop:
SHL AL,1 ; ROL, SHR, ROR can be used also
JNC NotOne ; the shifted bit is zero so no need for increment
INC DX ; the shifted bit is one so we need increment number of ones
NotOne:
LOOP ShLoop ; instead JMP and DEC CX may be used
MOV ONES,DL

“All other true solutions will be considered”


Question 3: [45 pts.]
Assuming an Intel 8088 microprocessor-based system with memory chips, 4 input switches and
one seven segment display (SSD).
a) Show the memory map with 512Kx8 RAM using 128Kx8 RAM chips starting at address
80000H.

MEÜ.EÖ.FR-212/01 Sayfa 1/2 Yayın Tarihi : 08.04.2011


b) Demonstrate how the 8088 microprocessor will be connected to the SSD and the four
switches at addresses 270H-27FH showing the circuit and required devices.
A11-A4 need coding A3-A0 not used
0010 0111 xxxx = 270-27Fh

c) Write a C program to read the binary number formed by the previous four switches and
display on the SSD the following: E if the read binary number is equal to 1000, H if the
read binary number is higher (more) than 1000 and L if the read binary number is less
than to 1000. Assume what you may need.
main()
{
short InVal, OutVal = 0;
do {
InVal = Inp32(0x270);
InVal = InVal & 0xf;
If (InVal = = 8) OutMask = 0x73
Elseif (InVal < 8) OutMask = 0x31
Else OutMask = 0x6d;
OutVal = (OutVal & 0x80) | OutMask;
Out32(0x270,OutVal);
} while (!_kbhit());
}
“All other true solutions will be considered”
(Good luck)

MEÜ.EÖ.FR-212/01 Sayfa 2/2 Yayın Tarihi : 08.04.2011

You might also like