Professional Documents
Culture Documents
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 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.
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
------------------------------------------------------------------------------------------------------------------------------------------
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.
------------------------------------------------------------------------------------------------------------------------------------------
Write student’s name and ID at the information table of your exam paper Page 4