You are on page 1of 4

MIDTERM EXAM Semester/Academic year 2 2022-2023

Date 20/03/2023
Course title Computer System Engineering
UNIVERSITY OF TECHNOLOGY - VNUHCM Course ID EE3401
FACULTY OF EEE Duration 60 mins. Question sheet code
Student name: ID:

Notes - Students can use one A4 paper with two sides for your references.
: - Students submit the question sheets together with the answer sheets

Problem 1: (L.O.1 & L.O.2) (15pts)


1. (5pts) Answer the following questions about x86-8086 processors:
 x86 processors is RISC machines True False .
 8086 processors have 16-bit wide data bus True False .
 8086 processors have 16-bit registers True False .
 AX, BX can be accessed by 8 bit registers True False .
 x86 processors are Little Endian True False .

2. (10pts) What are differences between primary and secondary memory?

Problem 2: (L.O.5) (10pts) Write 80x86 assembly language code for the following C procedure:
C procedure ASM procedure
Assume that S is stored in EAX, n is store in EBX
int my_func(int n) my_func:
{
int S = 0;
int i = 1;
do {
S = S + i;
i = i * 2;
} while (i < n*n);
return S;
}

------------------------------------------------------------------------------------------------------------------------------------------
Write student’s name and ID at the information table of your exam paper Page 1
Problem 3: (L.O.5) (10pts) Answer the value of registers after the instruction is executed.

No. Before Instruction After


1 AX: F5 36 mov AH, BH AX:
BX: 3A C1 BX:
2 EAX: 35 F7 60 ED and EAX, EBX EAX:
EBX: 22 B3 AE 20 EBX:
3 EAX: 00 00 A6 22 imul EAX, Double EAX:
Double: 00 00 01 4F CF: OF:
4 EAX: 00 20 AC 2F sub EAX, 202321 EAX:
SF: ZF: CF: OF:
5 ECX: 04 A6 56 23 sar ECX, 5 ECX:
SF: ZF:

Problem 4: (L.O.5) (10pts) Write an 80x86 assembly language program to compute:


F = 25*x2y + 5*xy + 10*y
Assume that: x is stored in register EAX, y is stored in register EBX, F is stored in register ECX
ASM procedure
Calc:

Problem 5: (L.O.5) (10pts) Given a function in the left column. Rewrite this function in 80x86 sssembly
language (assume that m is stored in EAX, n is stored in EBX and the return value is stored in ECX):
is_SquareRootOf2:
int is_SquareRootOf2(int m, int n)
{
if (m*m == n)
return 1;
else
return 0;
}
------------------------------------------------------------------------------------------------------------------------------------------
Write student’s name and ID at the information table of your exam paper Page 2
Problem 6: (L.O.2) (10pts) Given the Interrupt Vector Table below.

Determine the address of ISR of a device with the interrupt vector 98h.

Problem 6: (L.O.3) (15pts) Consider the memory segments in the left column. Do these following instructions
have a problem? If yes, explain. If not, calculate the 20-bit address to which the instruction will store the data to.
0x500 a. mov [ES:0x400],EAX

CS 0x1000

ES 0x1500

0x2000 b. mov [CS:0x4FE]


SS

------------------------------------------------------------------------------------------------------------------------------------------
Write student’s name and ID at the information table of your exam paper Page 3
Problem 7: (L.O.2) (10pts) Write Assembly code to do the following task: Read a character from the keyboard
(lowercase letters: a,b,c,…,z) using interrupt “int 21h / AH = 01h”, then convert it to uppercase letters. Store the
result in CH register.

Problem 8: (L.O.5) (10pts) Describe the interrupt processing flow?

------------------------------------ END ------------------------------------------

------------------------------------------------------------------------------------------------------------------------------------------
Write student’s name and ID at the information table of your exam paper Page 4

You might also like