NAME: ______________________________________________________
This exam is open book, open notes, open mind but closed neighbor. This exam is worth 12 points, for 50 minutes of work! Each point is therefore worth just over 4 minutes of your time!
base2 base8 base10 base16 10110 26 22 16 10011 ________ ________ ________ ________ 30 ________ ________ ________ ________ 30 ________ ________ ________ ________ 17
natural signed one's two's decimal magnituede complement complement -5 100101 111010 111011 5 ________ ________ ________ -20 ________ ________ ________ 20 ________ ________ ________ -27 ________ ________ ________
. = 0 || Address Value W #1234567 || ; --solved to here--|| 000000: 01234567 B #89 || H #ABCD || 000004: ________________ ALIGN 4 || W "AB" || 000008: ________________ ASCII "AB" || LAB: || 00000C: ________________ ALIGN 4 || W LAB || 000010: ________________ END || || 000014: ________________
LIL R1,#012345 || 000000: E101 ; --solved to here--|| 000002: 2345 LABEL: || MOVE R2,R1 || 000004: ________ ADDSR R1,R0,8 || ADDSI R1,-1 || 000006: ________ BZR LABEL || LEA R2,R2,#DCBB || 000008: ________ || Only if you have || 00000A: ________ time, what values || are in R1 and R2? || 00000C: ________ || R1 = ______________ || 00000E: ________ || R2 = ______________ || 000010: ________
TITLE AOTOI ROUTINE ; convert an octal number in an ASCII string ; to a 32 bit unsigned binary integer ; ------------------- INT AOTOI AOTOI: ; function called with return address in R1 ; does not use R2, destroys R4, R5 ; on entry, R3 points to the string holding the number ; on exit, R3 is the integer value of the string ; the string terminator is any non octal digit MOVE R4,R3 CLR R3 AOTOIL: LOAD R5,R4 ; get a character EXTB R5,R5,R4 ; extract it ; convert the ASCII character in R5 to binary ; and check to see if it is a legal octal digit ; if not, branch to AOTOIQ ____________________________________ ____________________________________ ____________________________________ ____________________________________ ____________________________________ ; Now, we know R5 is a digit, in binary ; so compute R3 = R3*8 + R5 ____________________________________ ____________________________________ ____________________________________ ____________________________________ ADDSI R4,1 ; setup to get next byte BR AOTOIL ; go iterate AOTOIQ: JMPS R1 ; return END