COM SCI 33 Fall - 1998 Exam 1

COM SCI 33 Fall - 1998 Exam 1 - {2) (2) (2) (2) (2) (2) (2)...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: {2) (2) (2) (2) (2) (2) (2) (2) (2) CS 33: SYSTEMS PROGRAMMING Computer Science Department University of California, Los Angeles Dr. John A. Rohr January 23, 1996 EXAMINATION 1 What is a c ell in a computer? A (ruffle M “7+ 04 3+ {trv' 7t, . . 7 What IS overflow in a computer. A 0‘,- hi “mm: of” (“on a “C bx)me rérywu’ l5 4 Mot-n4ka O I {a _ nqutt 5}. }g oven! {:(0‘1/ What are the three basic components of a computer based on the Von Neumann architecture? C9Ur [45:440/‘7/ What isanaddress inacomputer? 7L: Nth/1‘9“? M n my. sz/ .' act/«.2! bile: «Kc-4‘ I — was“ a JP” 5 62F“ ’ v' - 2" ‘9’. “1.. adm ’73} {3 fl 0"]? 557mvdt- w 6‘ /2'9{f ifif‘M/‘f 7‘0 10.x ? a ((V‘I’QIM “(r-m Cg], Matuc’ What is the address space 0 a computer? 7 ' (H /(i a? (_ a + at m? in mm»? In ’. (IOV‘/5’> What is high memory in a computer? TM aw,“ var fat; 0 -K gala/Mgr; Q; It” hi_ (it FIJKI/ Mftc,‘ r7,,-_f ’ What are the two major components of a central processing unit (CPU) 111 a computer? Ar H'L‘Md‘} ,‘c/Lo7,-C “ n .4. 1% Emmy “A fig/{sin .r 6 9) What is a register in a computer? a 5“ JV inf Mum 9'7 Ma" k «we; i'aé-‘C, A M (firth; SucL 5.9 “flL 2,,5T'hd-E- , {édyfs‘JZ'c/m lt(c!.nuj fra(L pg Li c H /¥£,vA 'f4.?‘1’l»c Fig)“ . What are the four steps of the instruction cycle in a computer? 0 ;'-’15*’L4(:+“>m 'r-C’o \. @ (kgfi (an/M “mg maj£M 3 {15%}:54'E" 5": --'5—w't-'-'("7 '2 or 2‘1-5-4s Ihfif'DvCVI-(M re? A.’ it ’— ’3 CS 33: S stems Pro r H ‘K ' i - J‘ (2) 10. What is a semi-modifying Program? f4 Em?“ "A f‘ j 4!“ MW " TL“ '57— 0 ‘ Rik )1 a?! (Krrgac 0+ (MA_‘1’fM</M§.ua/((7 (ofiyrt‘l7 C‘fl :,L+D a Hmoflf (°(qfiLM [[105 a»: (2) 11. Whatisaninstruction mnemonic?/f “HAWCA (Mn (-qu [I “c (L MJ 4' , 5°“ "L-F+‘~rj'2.e-v\ , ex. LoaD A‘Ct'qmue' 7 ENVIWX’ZJ (2) 12. tHow is an instruction address used if it is an immediate address? T R Mum (i'scvisc r‘s' LASC.J 0; AA gpwq_._oj {a fig ;,15.i I}. ~ 1L m5 rue L A ’“"*”*‘~- '4’“ch V“ M ‘ 5+orrd£ in qJeJ/g 55 r (2) 13. What is an assembler? a p7ra» 1H 7} - f ' ' ' - . . ((3? "' but" 5 at J/(yc rm "41“"4‘ '“flifk fps-kn": ““"'\ Wfltme-«CC‘J i f F / "- <3 I H5+MC f?” 5) r C,—'\" “field-«c cc! (Lax?denzmaf ( C- Y a» f M" g ( 14. What is the function of the location counter in an assembler? J 7‘ yd”; The “a p e 747 ‘ I \o‘" MW Sbrcflram AWL aha/r gala!“ 5: he taut Md PM! 5' in"? «My 1 (- r (2) 15. Convert the decimal number 668 to octal. :7/ 2 3 Y 8- (we? L; "M 9 g 83 3 7. mm /0_ 2, i ( 2) 16. Convert the hexadecimal number to decimal. _. . 15% it ’ I” ‘— f “xx 3'56 239‘” * ’9" "’ l ’L’ ' Eff q’o, " '27.? cf? r (2) 17. Convert the octal number 5276 to hexadecimal. . We“ ---~-— rrz.\;’—<':"I'-2r'i.w we» 275/: tee-7.5 ‘9 ., M- 5 [A 735; 7] ~ "-7 L MWW“ l0, )5? —‘ A. fa (2) 18. Calculate the two's-complement; 16—bit hexadecimal value for the decimal number -4096. _ g. '{p L _ f , g . 4_ ’ff (5314076 {:3 [Oath—=9; rm" "4"5'“ {. tam-r7 _V .. » " I 2 5- b (2 \ O 9016 WW '4'. a. * (2) 19. Add the two's-complement éfiai 'numbers 12345674 and 76543214. 2 State whether or not there is ov‘erflow. H s a 5 475,111 r if '7 4;; 5‘1 3 2 b ‘ ‘ (tLII-r‘rE ‘3 c' I ?( ‘IIIIIIIOTLVL(30VM-F(oq/ ( a me... .. . r r {a} (‘6 (($ch (is C /. (2) 20. Add the two's-complement hexadecimal numbers 29CBBC and FAC68C. State whether or not |th‘ere isl overflow. ,0 it l ‘ 2 Cr c BBC g '- / Jr (7 Acgficfi '*f (10) 21. "w :6 AU (10) 22. Show the hexadecimal contents of each of the indicated registers and flags which after the execution of each instruction of the following CUSP pfégram? “I5! I!!- @233 IE.- -_--- J? 000060 Show the hexadecimal contents of each of the indicated registers and flags which have changed after the execution of each instruction of the following CUSP program? um I.- -E -- DIE -_--- ---_--- ---_--- (10) 23. Show the hexadecimal contents of each of the indicated registers and flags which have changed after the execution of each instruction of the following CUSP program? (10) 24. 90) 25. Generate a CUSP machine language program from the following CUSP assembly language program. Show the final symbol table ADDR 0 LDS# MINLOS m _ SR GET__NUM GT PLUS NEGA MP R 77 AB EL OPCODE $ OZoéoo 3; W2 Ea?! $ (3%me $ H '3 250; $‘Z‘12 ooE $qYZOOD $90200 s PPM 20 MINUS: $902 $ FF? $ {0000/ $ 9(2600 START: ‘é illil I‘ . Do \u o *W 8 i PLUS: ADA# S _'“ PUTNUM sf? % MP HLT Ififiééflfiflfifi 99 99 E —c 0 gm t3n“0 no a? SYMBOL TABLE CS 33: SystemsAProgramming: Winter, 1996: Dr. lohn Rohr: Examination 1 Page 6 A.9.1 Data Transfer Instructions i Mnemoaic Opcode 0V En LT IE Behavior [DA 2:: OD - - - - ACC :- operand LI): 2:: 01 1 - - - m := operand LDS 2:: O2 1 - - - SP :- operand | LDF 1:: 03 1 - - - F? ;= operand STA 2:2 04 - - - - Hemaryiopaddr} := ACC ST! 2:: 05 - - - - Hemoryliopoddr] :s m STS 2:1: 08 - - - - HmryEopoddr] :- SP 31‘? 2:: OT - - - - HencryEapoddr] 1- FF ; P55 2:: 08 - - - - push operand PD? 2:: 09 - - - - Hmronpoddr] :- pop CLR :2: 0A - - - - fienoryiopaddr] := 8000000 SET 2:: GB - - - - Menoryfapoddr'] :- SFFFFFF TAX FF'FOOO 1 - - - IR :- ACC T15 mm” 1 — - - S? := ACC ‘ r11: FFFOOZ 1 - - - F? :- 11cc m FFFOO3 - - - - ACC :- 1R TXS FFFOCM ' - - - SP 2- IR TIP FFFUOS - - - - F? :- IR WWW—fl T31 FF'FOOT - - - - IR :- SP TSF FFFOOE - - ‘- - FF :3 S? I TFA FFFOOS - - - - ACC :'|I FP ‘ TFI FFFOOA - - - - IP- :- FF TF5 FFFOOB - - - - SP :- FP Psm FFFOiD - — - - pth&_’—“"——“—_' PSI-II FF'FOII - - - - push 1151 FEB? FFFOI2 - - - - push FF ‘ [-I’DPA—u FFFC|13 - - - - Accz—s'fir—m——_ POPX FFF014 1 - - - x11 :- pop POPF _. Fl-TOIS 1 - - - F? := pop Flag notes: I. [W :5 (overflow occurred). A.9.2 Arithmetic Instructions Murmur—re" Opcade av 51: 1r IE Behavior gm as "'10 1 2 3 - ‘Acc :s ACC + operand Tm m 11 1 2 - - IR :- IR + operand ABS 2:: 12 l. 2 - - 5P :1 SP + operand “3F 2:: 13 1 2 - - r? :- F? + operand s‘ai’E_‘ 14 1 2 3 - ACEWW—‘l SBX n: 15 1 2 - - IR := XE - operand 535 1:1: 16 1 2 - - 5r :- sr - operand L_SB.F :1” 1.7 1 2 - - FF FP - operand w 2:: 18 1 2 3 - ACC :- ACE '1 operand I DIV 2:1: 19 1 2 3 - ACE -.=~ 11cc div operand HUD 2:: 1.1 1 2 3 - 11cc :2 ACC and operand rum in: 13 1 2 3 - HemoryEopaddr] :- operand + 1 DEC 2:: 1C 1 2 3 - MemoryEopoddr] - operand - 1 E6 m 113 1 2 3 - Hemryiopaddr} - -o-pemnd arm rrra2o 1 2 3 — 11cc :: -1cc Flag notes' 1. CIV :- (overflow occurred). 1E0 :3 (result = 0). 3. LT :- (result < 0). A.9.3 Comparison Instructions '_.-——_-‘I—-——'__——-__' .Mnemonic Opcode 0V ED LT IE Behavior I cm 1:: 20 - 1 2 — 11ch l CH1 1:: 21 — 1 2 - KR ? operand CHS 2:: 22 - 1 ’1 - SP 1' operand CH? :2: 23 - 1 2 a F? '? operand l 151 15: 3 4 operand ? 3000000 Flag notes: 1. El; := (register I operand). 2. LT :5 (register < operand}. 3. E :- (operand = O). 4 LT :- (operand < 0). A.9.4 Min-mofia Opcode 0V Eli- L‘l.’ IE— Behavior Logical (Bit) Instructions AND a: so - 1 2 - 15:5 :- ACE and operand [IE 1:: 31 - 1 2 — ACC :- ICC or operand qum 32 - 1 2 - ACC :- ACC to: operand COM :1: 33 - 1 2 - operand := not operand emitw mom — 1 2 ~ 11cc :- not 11cc s'fiu man 3 1 2 - 'E: :: .icc shifted right SHIJ Fifi-'02:! 4 1 2 - ACC := ACC shifted left RT“ FFFOZA - l. 2 - ACC :' ACC rotated right 1 _3m firms - 1 2 — ACC :=- no: rotated left . RRDA FFF026 3 1 2 - ACC :- ACC rotated right via (W l RLOA” Fri-“027 4 1 2 - 11cc :- 11cc rotated left Vin av Flag nor-es: 1. El: :- (result = 0). 2. LT :‘3 (result < O}. 3. IN := (less: significant bit of mo). 4. UV 2- (most significant bit of ACC). A.9.5 Jump Instructions _______._____..__—_————————-—-- Mnemonic Opcode [W H) LT IE Behavior | IE? 1:: 40 - - - - PC :- operand l push PC; PC := operand : push PCB-flags; PC :* operand l \ BIN FFFDQO - - - - PC :9 pop ; 1 Ian! rrru41 2 2 2 2 Prams: ;= pop l JED a: 43 - - - - if sn=1, PC := operand 3 ms en- 49 — - r — if 213:0, PC := operand l l JLT m 4}. - - - - if LT=1. PC := operand ‘ ' Joe :2: 4E - — - - if 1r=o_ PC :a operand 11.; 2:11: 1:: - - - - 1: LT=1 or 511-1, PC -.- operand 1 1 11:1 :1: 4n - - — - if LTsO and rn-o, 9c :- operand | 10v 2:: 41-: - — - - u ova-1, PC :- operand l IND 2:: 4? - - - - if UV-O. PC := operand Flag notes: 1. IE :s o. 2. All Bags restored to values saved on stack. A.9.9 Miscellaneous Instructions [Vin—emanic OpcoWLT—IE__Bm—V _ _scfi‘—__ fioéh‘TH"—-—_5_fl:_"E—v_ .71— — | CEV “F031 '2 - - - all :i 0 FFF034 — 3 — - an s 1 E rrruas - 4 - - so := o l fire—3'6 - - 5 — :T 1 cu' mos-r - — a — LT := o SITE FI-‘ifiéZ‘TTfifu—‘F— If :u 1 *_'—'_ 1 FFF033 - - - 8 IE .3 O __-____ ‘ nor moa'a - - - - none . halt=__.___; Flag notes: 1. av :- 1. 5.1.1 := 1. 2. (JV 2- o. 6. LT :2 o. 3. ED :- 1.. 7. IE :5 1. 4. so :=l o. 8. IE :s o. A.9.10 I/O Instructions ' Mnemoaic Opcode UV ED LT IE Egfirw'mr i INE 1:: To — 1 ##W accta..23] := $0000 l om m 71 - - — - PortEopaddr] :- icctc..7] i l IN“ a: 70 - 1 3 - ACC :- Ports [opaddr..opoddr+2'l l UU’W In 71 - - - - Port: [opaddh .opoddr+2] := ACC Flag notes: 1. E9 1' (ACC =- U). 2. LT := (leftmost bit of port = 3. LT := (ACE < 0}. D). ...
View Full Document

Page1 / 6

COM SCI 33 Fall - 1998 Exam 1 - {2) (2) (2) (2) (2) (2) (2)...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online