You are on page 1of 2

Computer Organization & Assembly Language

th

Date:12 Dec, 2013

Final Exam, Fall 2013


Marks:50

Time: 180 mins.

It is an open book and open notes exam.


Write neat and well-commented programs.
You are not allowed to use any assembly instruction that is not taught in the class.
Question 1:

[12 Marks]

Consider the extended (16x16 bits) multiplication code given in your book. Modify the code such that it
performs multiplication of two signed 16-bit numbers.
Note: ONLY write down that part of data and code that you have MODIFIED. State your assumptions clearly
and write comments where needed. No credit for code copied from book. You are, of course, allowed to call
different sub-routines given in the book from your code.

Question 2:

[12 Marks]

You are required to implement a music equalizer displayed on the text screen. There is a buffer located
at physical address [C800:0001], of 10 bytes length. This buffer holds amplitudes of 10 frequencies
where amplitudes ranges between 0 and 255. This buffer is continuously modified by another program
which you need to know nothing about. The equalizer simply displays the values on the bottom of
screen as 10 bars where the height of each represent the amplitude value as shown in figure 1. The
maximum amplitude is shown as a bar of 10 characters height. To make it really fun, hook this to the
timer interrupt with chaining so that it keeps working even if you are doing something else on the
screen. Note: The ASCII Code for a solid block character is 0xDB. You have to write the COMPLETE CODE.
c:\>

Figure 1 Illustration of the graphical equalizer displayed on screen bottom centre.

Department of Computer Science


National University of Computer & Emerging Sciences, Lahore

Page 1 of 2

Computer Organization & Assembly Language


th

Date:12 Dec, 2013

Final Exam, Fall 2013


Marks:50

Question 3:

Time: 180 mins.

[12 Marks]

Consider a dynamic multi-tasking program running n parallel tasks. Each task is assigned a special
value p that specifies the tasks priority. Priority determines the number of consecutive timer
interrupts the task is allowed to run when it gets its turn. For example, if p equals 5 for task 1, then
task 1 will only be context-switched to the next task in line at the 5th consecutive timer interrupt. Use
the multi-tasking program in the book to answer this question. Make only essential modifications such
that each task is run for the length of its priority p.
Note: ONLY write down that part of data and code that you have MODIFIED. State your assumptions clearly
and write comments where needed. COPIED whole code from book WITHOUT any MODIFICATION will yield
ZERO marks. No credit for code copied from book.

Question 4:

[14 Marks]

Answer the following short questions in no more than two lines of explanation where required.
i.
What will be the value of ax register after this instruction? Explain.
xor ax, ax
ii.
Which of the following instructions are illegal? And why (one line precise answer for each)?
a. shl 1, ax
b. shl [1000],1
c. shl [1000],-1
d. shl 1000,1
iii.
Will the jump be taken? Why?
mov ax, -1
shl ax,1
jc somelabel
iv.
Can a timer interrupt arrive during the execution of keyboard interrupt? Explain!
v.
A friend programmer has hokked the keyboard interrupt (int 0x09) correctly. He reports that his
keyboard gets disabled right after the first key is pressed. What is the exact mistake that he
would have made in his ISR?
vi.
The character a will be displayed at which row and column of the screen by the following code?
mov es, 0xb801
mov di, 0x0002
mov [es:di],ax ; ax contains the ascii code of a + standard attributes
vii.
Can a time interrupt be disabled without using the cli instruction? Explain.

GOOD LUCK

Department of Computer Science


National University of Computer & Emerging Sciences, Lahore

Page 2 of 2

You might also like