lecture_09-revised

lecture_09-revised - ’- 065an V [OM/‘- AWN/ /W M...

Info iconThis preview shows pages 1–13. 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
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

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

Unformatted text preview: ’- 065an V [OM/‘- AWN/ /W M " ZfiowémLE/g ’- Wall? 35:5 SUM ‘“ ‘ (pg 7 WM domw M g/ - alga/1% (irwmtglvvg) W 54"“ (5/13 IS [pair'qu 59M 9 AW“; wW%€ M04403 (2L W4 WW 0 / Wayne/m My?“ WM, Vewa/ MA“? 944‘“ V9” "(Mg Fragonmw' WI #11 VIN/4,4,, WM” comic/‘0’? WW W L'MNWWW/s W4 -> flSge/mél‘j WKW mama/s 40 #{zbslméimfigfi W3} mad/0' “9 EXWkle «gym/gt? law may 'm ‘$ WuultJ>La/— aware/(W a? é’ ~—-7 (W67 5 “’75 L0 WOLVV‘M W $u4mmmL/m L. <9 {5—2 3 Program to multj/opz a number by the constant 6 ; 7U MVL Y fiL/ZEWV STD/ZED AT LoC/HMA/ “Na/mega“ .ORIG x3050 LD R1,SIX LD R2, NUMBER AND R3, R3, #0 ;Clear R3. It will ; contain the product. ; The Inner loop AGAIN ADD R3, R3, R2 ADD R1, R1, #-1 ; R1 keeps track of BRp AGAIN ; the iteration. ’ HALT ’NUMBERBLKW 1 SIX .FILL x0006 ’ .END L +____ _ __¢ _ __ L 9. {)3 .4» PW 06Wl/ltl4'owfi Wot? WWW A7 gm‘uflam ['3 Wei 7L; (fuel/wk 4L com/1W --> W aowJ'nu'I" ¢€ +alM/Ztkr I'MSJ’WWWQ/ C‘w’y, (4%,, {4%g. Wes“: Me mswwgfn égflfffi: ‘1 W ’0” £5 areal-[eel b m cw w, é some Alw w" Jar” Montana/$311” L’qEJbuP/VLIW) ~‘__~.——~_~ ‘fLA 15w ppwfieE WWW/761‘s) Egamffl I \ / \wmmw NOTES: RTL corresponds to execution (after fetchl); JSRR not shown DR (— SR1 + SR2. Setcc ADD 0001 m ADD DR, SR1, imm5 DR (— SR1 + SEXT(imm5), Setcc DR +— SR1 AND SR2. Setcc DR (— SR1 AND SEXT(imm5), Setcc BR 0000 “I; ((n AND N) OR (2 AND Z) OR (p AND P)): PC <— PC + SEXT(PCoffset9) JMP 1100 m 000000 JMP BaseR PC (— BaseR JSR 0100 PCoffset11 JSR PCoffset11 R7 (— PC, PC (— PC + SEXT(PCoffset11) TRAP 1 11 1 0000 trapvect8 TRAP trapvect8 R7 <— PC, PC <— M[ZEXT(trapvect8)] AND DR, SR1, imm5 PCoffset9 BR{nzp} PCoffsetQ PCoffsetQ LD DR, PCoffsetQ LB 0010 m DR «— M[PC + SEXT(PCoffset9)]. Setcc LDI 1010 m PCoffsetQ LDI DR, PCoffsetQ DR (— M[M[PC + SEXT(PCoffset9)]]. Setcc LDR 0110 m offset6 DR <— M[BaseR + SEXT(offset6)], Setcc LEA 1110 m PCoffsetQ LEA DR, PCoffsetQ DR (— PC + SEXT(PCoffset9), Setcc mm DR (— NOT SR, Setcc ST 0011 m M[PC + SEXT(PCoffset9)] <— SR STI 1011 m PCoffsetQ STI SR, PCoffsetQ M[M[PC + SEXT(PCoffset9)]] <— SR sm m M[BaseR + SEXT(offset6)] (— SR LDR DR, BaseR. offset6 111111 NOTDR.SR PCoffset9 ST SR, PCoffsetQ "7c! ‘5 7 LKp‘g ‘ W (AA/Ci L0 [clan/1J4 W Lym‘h‘au/‘é W4 mre/ 9%»,ng rjE-grpai, $0}, (‘61 W Wfl‘Krm- —> mom‘s; 042 0M40~70 MWW¢ QWMWK ,9 obny 4:07 i rum -7 MAI mun/0M3 lament/am animus fag (907, 91 «amt/wk (LQQLWW’W? -> HAL mew/zan loud—(W mg,‘w,g dz (MW 89 mm 0;» 94W! 67, L937 WQ $01, l'%§+ral:4{(0%$. CK W Z J [lg/[g V! A” V’ 1' ‘6 (CI aPQEWWW WIMWZWMWQK ycfgé fig dz W WWW W’ t w 65 m gammy!” 9% 1w? W I . Giole Pym/{ck W2on I!MS(!%/LI<IL)I40«L 5.513% neng W( our“ 4' I l,thch 0“ ‘3 "W Why/W04 [mq pm *7 i434 RHW a sam'wgm I‘S MM%$MJ L; g a! Z. 9&. pg “‘7 PSI/(1449’ 0E3 Jung wsM/g [MW/g WW; s'pwaofg 9.0Rifl sfeuTfi’V/g wMe if“ WW§Wav m Wag? Wm WM @e Fm! ‘7Jr0VM4 “DOUG (9,44%: -—~>,E/(/<B dudfiafies 54m 6014 0% darwcgravm. I1 MS. myqu “to Cu M44 HM” mar) ml MQL WE; WWM‘LO“ ceghLer fez sbpw/ci 4 -€‘ VWW4~ FILL m *7.P>LK\A/ Uta Ala/leg Mi 30W W WW5 L7anth (Mia Q weWc/LeJ { £106 —-7 ‘ V1 (1;) 0! W01” 17:9 $1“. pgfiwda-fu§4muyr%h. «7 ppr gnaw/5Y2 Maw ~>€WmfaLet .ORIG Y$0H7 Anew/CY} “#61” 3, x5010 %' (30!! 'e’ Y 30 I (7 O é" Mu UV Lnglrl/tfl StLrlfi/lg/\ L —> HALI/ (TR/4L? x28”) 4w 3/L‘€U((J 6 —9 9(17 (TRAP Y‘zl 9 QfTC (T6314? X20), «Mei 0142 WV 70am WIN/91 ~7 PM} (TM? K7Z>—W”’j€ WWW/WM ge‘flv'ug v14 (WI/19016 a Mi ngMi OC’Cuv’Vemcg 9% 52 Ofignglw [it (a “Ade/y {.0 (From W $21324 $0 & WW w W WW 9W (MW/w a WWO! 0f, [(90 vahobgl giar£cj (ma); MmFW §¥0VW¥SFLW+1$LC§ 52+ meflO / gM/Icl “waif/W Valli/Q. R Q % anti—nut“ Moe WK vhf/(M, £7 11—5 Comme M “(elm/93 OWL ‘M‘Q Whefl L9. R3 Hewmjfle I (R2 <— 0) MOW; WJ’9 ASSASrml nah” bead C/(Cif t u // 69ft) +0 “2:535:35? pl “hex-f" CLAV Input char from keyboard (/6571) (TRAP x23) fl? WW“ . nexlvé'hc‘r' # Load char from file W03 ' n ., ‘ S A Mr“? M m W2, #7:?“ng :12 Cko\(§ {‘5 tesf yes Done? (R1?=EOT) Increment count (R26R2+1) Convert count to ASCII (R0 6- x30, RO€R2+RO) Load next char from file - (R3 6 R3+1, R1€M[R3]) Pm“ COW“ (TRAP x21) HALT (TRAP x25) L 8, I43 EXW’Pie I E Program to count occurrences of a character in a file. ; Character to be input from the keyboard. ; Result to be displayed on the monitor. ; Program only works if no more than 9 occurrences are found. 2 Initialization ' .ORIG x3000 AND R2, R2, #0 ; R2 is counter, initially 0 LD R3, PTR ; R3 is pointer to characters GETC ; R0 gets character input LDR R1, R3, #0 ; R1 gets first character 2 Test character for end of file TEST ADD R4, R1, #-4 ; Test for EOT (ASCII x04) BRz OUTPUT ; If done, prepare the output 2 Test character for match. If a match, increment count. ' NOT R1, R1 _ d m ' 11, ADD R1, R1, R0 ; If match, R1 = xFFFF \» iv; [,4 1“ ' NOT R1, R1 ; If match, R1 = x0000 J ' BRnp GETCHAR ; If no match, do not increment ADD R2, R2, #1 E Get next character from file. ’GETCHAR ADD R3, R3, #1 ; Point to next character. LDR R1, R3, #0 ; R1 gets next char to test I Banp TEST ; UMConALE baht/Lt . 3 Output the count. OUTPUT LD R0, ASCII ; Load the ASCII template ADD R0, R0, R2 ; Covert binary count to ASCII OUT ; ASCII code in R0 is displayed. HALT ; Halt machine ; Storage for pointer and ASCII template : kscu .FILL x0030 PTR .FILL x4000 .END Bdmv L ‘9. R? “W 9&4 244 Nah, (("I e Rae-f H9019 R15 0 Q'u—MCKOJ SKa‘P ScREva) . GREG x 36790 ‘, a? ') inf—Ho [Pf-c, W KO) [IRRM‘ 37,421“ 4W9 m, m, #0 MBR R2, R0) 140 A5973; K5, R0) #0 m an, ARRAB~EM9Er ; CWJ' wax-F demon! mm kg) {0, #0 2 \‘S [‘4 H2 ) NOT RC, R2 Campuffl 2'5 “VIP-W apcuwwf Ascb RG,R6,1:H “W A9393 RC, RS, Re 3 R5: {39ml vama: S K}? 7; Remain/16W W Max WM A3566; R1, Kg” #0 “$% Ré’ R0) *0 7 149% 21, m, M M395 Ra, 510, a] $4"? WM wwre? MFR? RS. Pd, RH 3 Rszm—mo {59h LOOP HALT ARMS‘S‘TART .FILL. M900 ARRAyalcb . FILL 11-100 .EW Lg, fiw ~>>Zcfias Couanasw/I STARTfA/G PALSS fl UV‘WS gnaw/LA I‘M 415054 MS. 3THRTI/1/O P459 2 6mm»; 3424x145 ,(M gequ M88 :5: waWM, asm Maw. ‘7" 1—6562; —Lr~ewzs[¢JcJ 49m Siomd \‘M cow/14 '. aeSm [Mala at 34W”! (ll/1 wuLoJW. 0g] whl'yé 14W UM g6 axewhcf 612V [[73 Smw/flpr/wmfmlew. 6(0322/9 [s 4% 6214 LC’} QSWW) a Freya/Wk ~7 C/(‘P/OVJ’U‘M/g W SW - SW Hg wrwg/gampwdgua 04 Mama/S (9444 WV [64111 mom/Lara chlClV%% W, 48 1‘ Mada“; 32‘ PC Value VLVV W Um wfiH‘ Ma ‘ gnaw/gag 13 140%. LQPJ! *9 Q! éwdzit‘wg WOLIJW [WW Wavy/V14 ~7 Mi puma) CtSLC/(A :15er I“ 1's yfimw two WWW Wfiifly. *7 each qty/W #1 SW IE Old «a Mime mm W s fies-pfv-e W (“lg/Tag: W 06L P8 oflwqu. ~+ (3mm (ang 0L? 6L rumm‘ufi Waxsyw aswqjfiéa 0W . 0 RIG x§000 4;; (92M DVL zbngr'm‘F—é ...
View Full Document

Page1 / 13

lecture_09-revised - ’- 065an V [OM/‘- AWN/ /W M...

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

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