Professional Documents
Culture Documents
Duration: 2 Hours Answer All Questions Total Points: 100 (30 PTS.)
Duration: 2 Hours Answer All Questions Total Points: 100 (30 PTS.)
Duration: 2 Hours Answer All Questions Total Points: 100 (30 PTS.)
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
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
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
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)