




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Typology: Study notes
1 / 8
This page cannot be seen from the preview
Don't miss anything!





NAME (LAST, First | please print):
CMPE12 | Computing systems and assembly language, Fall 2006 Midterm 2
Tuesday Novemb er 28th, 2006
No b o oks, notes or calculator. Simple computations are exp ected to b e carried out by hand. Justify all your answers | no credit will b e given for a correct answer if work is not shown Use the back of pages as scratch pap er, if necessary.
Exercise Score Out of M2.1 15 M2.2 10 M2.3 14 M2.4 16 M2.5 45 TOT 100
M2.1 Below is an LC3 program.
.orig x LD R1, x LD R2, y AND R3, R3, # JSR TWEETY TOM BRzp JERRY ADD R1, R1, # JSR TWEETY JERRY BRnz SYLVESTER ADD R1, R1, #- SYLVESTER ADD R3, R3, # JSR TWEETY BRnp TOM ST R3, z halt x .fill x y .fill x z .fill x .blkw 4 TWEETY NOT R0, R ADD R0, R0, # ADD R0, R1, R RET .end
(5 p oints) What standard ow-control structure(s) do es this program implement?
(10 p oints) Write a high-level language fragment (C is preferred) equivalent to this program, using the appropriate control structures and making the co de as coincise and clean as p ossible.
M2.3 (14 p oints) Fill out the symbol table for the program on page 2 with the entries de ned in this co de fragment. Also indicate what are the names of the two columns of the symb ol table.
(what is in this col?) (what is in this col?)
M2.4 (16 p oints) The picture b elow describ es the implementation of memory-mapp ed I/O in the LC architecture. Fill out all the shaded b oxes with the corresp onding blo ck's missing name.