




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Cairo University Microprocessors Systems (A) Second year Faculty of Engineering 2005- Computer Eng. Dept. Final Exam Time: Two Hours
The exam is of 6 questions and 7 pages Don’t forget writing comments when necessary. Use back pages and Make any assumptions (if necessary). Answer the following questions (Total: 75 points):
Question 1 (10 points):
a) List the elements of bus design. Briefly describe each element.
b) Interrupting a program is a way to improve performance. Assume that a machine is connected to three devices; a printer, a plotter and a disk with priorities of 3, 5, 7 respectively (hard disk has the highest priority.) To complete execution, ISR for printer, plotter, and disk spends 10, 15, and 7 sec respectively. If the processor is busy executing a program and an interrupt requests are issued by the plotter, disk, and printer at t=17, 22, and 25 sec respectively. Show the start and finish time for each of the ISRs.
Question 2 (10 points):
a) Given the data segment below, show the initialized memory contents byte-by-byte.
DATA SEGMENT
UP DB 5 DOWN DW 11010110011B RIGHT DB 10 LEFT DB 2 CENTER DB 2 DUP (12, ?, 88h)
DATA ENDS
b) Write a code sequence that will XOR the bit in position RIGHT of DOWN with the bit in position LEFT of DOWN, and the result is written to the bit in position UP of DOWN. Assume the variables are defined as specified in part (a). (Note: you must use the variables in the code, and not, for example 5 instead of UP.)
Question 4 (13 points):
a) Let STRG1, STRG2 be arrays of bytes and let LEN1 and LEN2 be word variables holding the number of characters in STRG1 and STRG2 respectively (Assume LEN1 > LEN2). Write an instruction sequence to print ‘Y’ if STRG2 is a substring of STRG1, and initialize the variable MATCH with the starting position of STRG2 in STRG1, otherwise it prints ‘N’.
b) Write an instruction sequence to implement the steps below. All variables are byte variables holding signed integers.
GREEN ← RED + 3 If bits 4 and 6 of GREEN are both 1 then for j ← 0 to 20 rotate YELLOW j by 3 bits to the left endfor GREEN ← YELLOW 20 else GREEN ← (GREEN * RED) / YELLOW 0 endif
BLUE ← GREEN
Question 5 (15 points):
a) Given a stack defined as 24h words; In the following sequence assume that CX=1212h, DX=31A1h, CS=0A121h, offset of Label0 is 222h, offset of Label1 is 4041h, offset of Label2 is 880Ch. Also assume PRO1 is a near procedure and PRO2 is a far procedure.
PUSH CX PUSH DX Label0: CALL PRO Label1: CALL PRO Label2: POP DX
(i) What is the initial value of the SP register? (ii) Show the contents of the stack and the SP register after the instruction Label0 is executed and after the instruction Label1 is executed.
b) Show the contents of the registers AX, BX, and DX after each iteration in the following code
xor ax, ax or bx, 00ffh mov dx, 10101111b mov cx, 4 H1: add ax, 4 add bx, ax sar dl, 1 loop H
extra page
c) Matrix A consists of three rows and four columns and defined as follows
Matrix_A db 3 dup(4 dup(1))
Write an instruction sequence to generate AT, the transpose of matrix A.