Assignment 10, due Nov 7
Part of
the homework for CS:2630 (22C:60), Fall 2014
|
On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper Homework is due on paper at the start of class on the day indicated (usually Friday). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!
LIS R1,(-c) >> 8 ORIS R1,(-c) & #FF PLUS R1,r TESTR R1
a) Which condition codes are set differently by TESTR and CMPI? (0.2 points).
b)
Which of the following conditional branch instructions might behave
differently after a CMPI for programs assembled with
sparrowhawk.h instead of hawk.h?
BGTU
BGT
BGE
BCR
BVR
BZR
BNR
(0.4 points; -0.1 point per error).
c) What sequence of instructions should CMPI have assembled to on the Sparrowhawk in order to avoid this incompatability? (0.4 points).
; class window ; all window objects begin with a pointer to the class descriptor ;DESCR = 0 ; windows contain many private fields WINSIZE = 28 ; all window implementations include a descriptor as follows, ; each descriptor entry points to one method, called as follows ; uses R3 - pointer to window w. ; R4 - first parameter if any, additional parameters go in R5 etc. WINCLEAR= 0 ; w.winclear() clears window w WINAT = 0 ; w.winat(x,y) sets location for the next put WINCHAR = 0 ; w.winchar(c) puts character c in the window
A problem: Given the local variables W, the address of a window object, and CH, the character to output (both currently stored in the current activation record), write SMAL Hawk code to call W.winchar(CH) (0.5 points)
A problem: Write Hawk code to compute Y=AX2+BX+C. (0.7 points)
a) 0.510
b) 510
c) 5010
d) 50010