ࡱ>   Root Entry FWʮCompObjnWordDocument ObjectPoolPjWʮPjWʮ  FMicrosoft Word 6.0 Document MSWordDocWord.Document.69qࡱ Oh+'0 D h   @d C:\MSOFFICE\WINWORD\NORMAL.DOT#Open book and notes, no calculatorRhodes FamilyLoreܥe= e ^7        Q<<RRRRRR# Te RR RRRRRR<RRRRRR,RRSROpen book and notes, no calculator Fall 1996 9/24/96 Name _______________________ 1. Compute the following equivalencies. [13 pts] a. 32610 = _____________________ 2 b. 110111012 = _____________________8 c. -2110 = ______________________6 bit signed magnitude = ______________________6 bit 1's complement representation = ______________________6 bit 2's complement representation d. 1247 = _______________________10 e. character '9' = ___________10 = __________16 = _______________2 2. Assume there is a hypothetical machine that has 9 bit data storage words. [6 pts] a. What binary equivalent number base would best represent binary values? _______ b. What is the largest unsigned value in decimal that can be held in a word? ________ c. What is the range of 2's complement values that can be represented? ______ to ______ 3. Types of assembler statements. [5 pts] a. Is the statement VALUE: .LONG 5 imperative or declarative? _______________ b. True or false: declarative statements always have a label associated with it. ___________ c. How many operands can an instruction have? _________ d. The notation in VAX assembler #^A/Q/ reduces the need to refer to an _________ table. e. In VAX assembler, the last letter of the operation code typically indicates the _____ of the data the instruction operates on. 4. True/false on registers [5 pts] ______ No special instructions are necessary to allocate registers. ______ All programmer accessible registers can be used at the discretion of the programmer. ______ Registers are always involved in arithmetic operations in some way. ______ Registers are the fastest place to store data. ______ Registers contain information whether it contains data or addresses. 5. High level language control structures. [21 pts] Rewrite each of the following segments in reasonably efficient assembly language. You may assume correct syntax and logic for each of the segments. You should assume that high level language variables are represented in these segments by registers. Thus, you can just give the corresponding code segments, not full programs. a. IF w > x THEN w = w - x; ELSE w = w + 1; b. sum := 0; i:=10; REPEAT sum := sum+ i; call foo(); i:=i-1; UNTIL i==0; c. w := x*x - 2*(y+1) 6. Array processing. [12 pts] a) Assume R0 points to the beginning of a string (an array of characters) and the string ends with a null character. Write a program segment to count the number of digits in the string up to the null character and sets R2 to this count. b) Assume an array of integers is defined at label TABLE. The array has N elements in which that value is in a variable labeled N. Write a program segment to count the negative values in the array and put the count in R5. Use index mode here. [12 pts] 7. Stack usage. Describe what the following assembler subroutine prints. Assume R1 contains a positive integer. Do not describe it line by line! [10 pts] FOO: MOVL #-1,-(SP) MOVL R1,R2 L1: DIVL #10,R1 MOVL R1,R3 MULL #10,R3 SUBL R3,R2 MOVL R2,-(SP) MOVL R1,R2 jump.greater L1 L5: MOVL (SP)+,R0 jump.less L9 ADDL #^A/0/,R0 output jump L5 L9: return 8. Refer to the above subroutine written in VAX Macro to answer the remaining questions. [16 pts] a. Give an equivalent assembler statement to the CLRL instruction. b. What carries the information from a compare instruction that normally precedes a conditional jump to the jump? c. There are no compare instruction preceding the jump.greater instruction. What datum is the jump instruction acting upon? d. ...and why wasnt a compare instruction necessary? Computer Organization CS 220 Test #1 Page PAGE4 ࡱ> SummaryInformation(n K. Rhodes@ouȨ@ Ww@  @GMicrosoft Word 6.04S#FcK z ^uc uDUcUc]]VcceU3#6S{GH?GKLMow'`;<W_''''''''''''''''''''''''''''''''h'h'h'h'h'''0h00'_J  G H Y f l y z { | } ~        '''''''''' ''''''''''''''''''''' ''''''''''0+          " '9LZks}./'''''''''''''''''''''''''''''''''''''''0000(/0#$%[\]^t''''''''''''K'K'00K@Normala c"A@"Default Paragraph Font @ Header ! @ Footer !!!!  69 _ / ,139!S Rhodes FamilyC:\LOREN\ORG\F96\MID1.DOCLoren K. RhodesC:\WORK\ORG\F96\MID1.DOC@\\SERVER2\MainLaserNe01:winspool\\SERVER2\MainLaser |pKLetter 0''''\\SERVER2\MainLaser |pKLetterQ3 2k m 0''''V V V V QTimes New Roman Symbol &Arial 1Courier5Courier New"V h8  & d#R"Open book and notes, no calculator Rhodes FamilyLoren K. Rhodesࡱ>