lecture_12 - ECE 190 Lecture 12 LC-3 Assembly language...

Info iconThis preview shows pages 1–11. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECE 190 Lecture 12 February 24, 2011 LC-3 Assembly language Lecture Topics LC—3 assembly language The assembly process Example Lecture materials Textbook Ch. 7 Homework Machine problem MP2 due March 2, 2011 at 5pm submitted electronically. Announcements 1 V. Kindratenko ECE 190 Lecture 12 February 24, 2011 LC-3 assembly language 0 L03 assembly language is a low-level language specifically invented for LC—3 computer o it is machine—specific; different processor have different assembly languages 0 Each assembly language instruction corresponds to a single ISA instruction 0 Assembly language makes it much easier to program by using human-readable language instead of binary words, while still providing the programmer with the fine-grain control over the instructions and data 0 Assembly language allows to refer to instructions, memory locations, and values symbolically. Program from last lecture, but now in [.03 Assembly language Program to count occurrences of a character in a file ; Initialization .ORIG X3000 AND R2, R2, #0 ; R2 is counter, initially 0 LD R3, PTR ; R3 is pointer to characters GETC ; RO gets character input LDR R1, R3, #0 ; R1 gets first character ; Test character for end of file TEST ADD R4, R1, #-4 ; Test for EOT (ASCII x04) BRz OUTPUT ; If done, prepare the output ; Test character for match. If a match, increment count. NOT R1, R1 ADD R1, R1, R0 ; If match, R1 = XFFFF NOT R1, R1 ; If match, R1 = x0000 BRnp GETCHAR ; If no match, do not increment ADD R2, R2, #1 ; Get next character from file. GETCHAR ADD R3, R3, #1 ; Point to next character. LDR R1, R3, #0 ; R1 gets next char to test Banp TEST I ; Output the count. OUTPUT LD RO, ASCII ; Load the ASCII template ADD R0, R0, R2 ; Covert binary count to ASCII OUT ; ASCII code in R0 is displayed. HALT ; Halt machine I ; Storage for pointer and ASCII template ASCII .FILL X0030 PTR .FILL x3016 .END 2 V. Kindratenko (;) I'$ MCJ —-—> W («W MW e. a.) US, Ame. V}. 6W W ’“> Some Moe/9 w, aha/‘14 . FILL ) 9 % age Mg WW g6 '\ 42 —-7 1 ;:,O P E M M93 9WIV<LF€ oo’aeraudg) 7’9 (OPEWflAl/Jfi (Ii/Pf 0W 00L Md 9, rwb/kag -, Em WWI "> Mumwgi it (d221W) ) X - Sop/WW WWI/63 0 Me gem/would 6% (‘14 SW36! 21 (A PW age/wm‘h’ow; Wmlr WWW 71" Z’MJi'w‘lfl 4L Gan/1W [‘ag MM”: 9/ mawwgflj £251 fifng 22¢ij 61 3 me 1% (61V 4,149 Jr“ $41514) @9611 Jaoaé I firmng «La Mp [3/] l’urf7Lrudyl/bhs_ _ ____~~._—\ —..._ 1M MAN; OPWE WWW/93’ Egg/wwfi {ML} c2 mum/4W va L'Mganan‘m/r‘ wade/r New v. SE: W wiqfig‘er fiWg‘p/L’ / Luigi/nova loaflbmg “MW 0) P W) H L. 90th .mmmmm. .mm «Fm Emmhooo. ,mw Fm 900ton .mm ._.m mm MD ._.02 $005501 MD <m._ Emmto .memm .10 mm: mhmmEOOQ .mo H: 96086092 .mo 04 mm Iv 29880500 + "238.22 mm Iv Eemfloomfixwm + 0&222 Emwtoom a w 2: Fm mm Iv :Qgtoomfixmm + 0&2 mawmtoom a _‘ 50 ._.w 030m .mw HOZ Iv mo 830 hammtogfixwm + 01 IV mo mumwtoom woov or: 850 .zofiwtofixmm + mmmmm22 i an 02mm 2 mymmtooa 29820an00 + 0&222 Iv mo oror 860 "zmumwtoomfixmm + 0&2 IV as mumwtoom Soc ._.02 <m_._ 54 D._ 230858:me22 i 0n. .08 Iv E @838 may: 98>me 88 :: nit :smwtooafixmm + on i 0n. .0n. i E £82001 mwa Emmtooa E 88 m8 «680 Iv 0; ~88 a2: 888 fig 8: a2: ammtooafifim + 01 i 0n. “5 oz< 0; mo AN oz< NV mo 22 oz< a: 98801 32me 932001 88 mm 860 “SEEExmw oz< Em ¢ mo 030w ,Nmm DZ< wmm Iv ED flags—E 02mm .GEEExmw + Em Iv mo 006m .wa + vmw Iv MD nag—EE— Nmm __‘mw .mD OZ< mE§ .55 .mo DD< 52050 “0: mmmw 5500.0». $th 525098 9 00:83:00 HE “mmcbz b8.p«§ ‘ MW Mel Lo [lamb W}, mum WILL We/ WNW“: "Stirreééo (‘a W WJVW- -—> wug‘si 06C pin/(7%» 70 aZFMW/(E chdJMg —7 (L W M 6‘1 cm z'uc W '0 -> W mewwwa/ Lyuuh‘m daménm; (1 WW W 89 low; .9.» 940m! 63 L®~ST W153 (7+ -> (W rwtrwse «3 40 W45 WWW [. a. [24 u —7 LCrE (MM/3 [Maw/962” Cahvldx’a} fipwfimfg euffimg w. e, I'M man/war m §- Pat/W1 simjji & Fluid lav if” 3 ‘7Jr0VWJ .ORICT (9,0101%: ———> , E /(/</5 Cu «Liable; W @014 0% garmng . Dr MS- st/L 4,0 & M44 H/zwr TM? ml 424+ 9W$ 911/15 Wflflw‘flwfi &<][J_er [(qz SkatV/cf bye trfihoV-ad ~>+arm¢=f .E/WD‘ -> .FILL L‘Mcb'wias W a [made I'M WW? Wla 6% wffif 6L Vaduz? gdae¢fv£rfleJ [KM W owtwd 0L -? ' V‘vmfl~[» FILL In W “7.73. c'la saw (9 WW5 Lace/LCM} WM & MWMJ ( I! a! yak/CZS) , ’7 (9(9er . 15LKM/ v1 BIA/LVL‘W [flied WEI/L, MM pWJaa- l'ugwlm r . «7 ¥0TW~P ‘ QTKI/i/Cvl “406i ”' ~> {NM/49%: . ORIG Y $010 .STRrA/a 1 H #231“ Q} x5010 ‘Jc' ¥§0H 'e’ wow 0 <9~MMMV~L?VWU(MZJ.€J “LA/mg“ I w W W 449. W ——> HALI/ (TR/H) X2?) WM 6 ~>W (TRAPméf' “WW-wa "9 00(7 (TRAP yzl ~> GETC (Tea/w m), mm M W“ 4va WW4 ~> PM; (Tm? MZ>—gg‘j€ MLHIWWM mg “’49? “P will Cebu/ML (Maurwa a} a) Ii: 10 WWW Lo £6. {21W gum m Kaggwd Quail JV 66 GLEbaloyi W W WonHaV_ gW gmfic a; ((14 40,31 gem/gong 9W (THVW a WWO! OL [(90 Vela/(é, SJ—ar‘£o[ [‘MZ’S Comka Kgovmmc fined—«9% (27(— me-QO / YP’Mc/ max/W Vam_ R +0 wind—M14 W WK Value] a: J—b Goeru‘u 6442 606551099 out 0%” W 1M“ —>>Zc$as aowwwwsm STAND/G P/Lsgfl ' CNN} (Lama! I‘M JI‘V’SCI' W9. STARTIA/G Pflgg Z waW,asm -9 L652; —me1 VLQJW M Sioux! \‘m wild/:94 ~. mm (y; do at fihggfiwédé dove/<4 I‘m Calm/4W. (96; WWI/A mw/ cw 4’ axewlfii 613 [,er sflmdvzwLflV/WMW‘ZW' $[03M ('5 Q? (9h LC'} (25W) (x Frogs/WW Mir *Hdmghple/g w asswvéég king/M131 Fry/:2ng z'mlo a Wyh'ne [QW%Q Magnum. ~> L. W; asw/nflg ngs *7 1'. 01%ng W 3W “’7 u‘g th/Saoowdmta (94 SMfék WWW> W4 Hair [0512.1 Wrg (LJJVASré/S W germ/ng 1'5 (gm/1d, 4%; W PC Value J’ar Um WWH‘ Ma ' gnaw/M 1k moJecéL. 1%, P410)" #21 Wfilnwg WWW [dMWV Paylfim ——7 b'wgg, UM, eat/Q :1st if“ t's +r~awswe¢ t'hVLO WWW £71K .7 eflbb VLI'Vz/Le £1 SW lg (Lg 014,6 QVL [,Lngrwfr ~Hm/1’s ope/wk? «a Whoa virawz m gtj/nné/ M f 1‘; “5,55! 40 r52ny W W? ado/me: 06L PG off/k4. *D {know} (ast 0L0 a; rut/1M3 praww asgemfibb 0W . 0 RIG x7>000 /,,.___. meow“? / (AW/WV ,7 W 7\7WL wgg Ff) eawM/q E MM / f” WW lmifall‘ie Roz-)1 Had? Me 0 412.4— M CKOJ R3é- R ‘, .4 ') tMl!‘-\'I'0 [FR b9?) K0) MFA/43‘ 33%;" W9 R\, m #0 MW R2, R5) #0 SKY?!) A9975 R5) R0) #0 AMMAIM W RM, Amng- 13/1/93; HMBLEA/b ; CW4“ M264, CZOMWJ 1 39$ [J W 11/07 RGIRZ A2993 was, #; Am “29% KG 3 R€=Q§~RQ VDRH SKEP é Rama/Inger W Max vabwe’ {435% R2, K‘é‘, #0 i “(5% 3;, K0, 1H4) ! \ 7 SK'P A9% [21, m, in AW: R0, R0, 4;; 7 {4% Wire m/o re? Am’ Kg; P“: M ', Rfizm—mo $3M LOOP HALT ARRPa‘sTART .FILL “((900 ARM3~EMCB . FlLL 11-100 ...
View Full Document

This note was uploaded on 01/22/2012 for the course ECE 191 taught by Professor Staff during the Spring '11 term at University of Illinois, Urbana Champaign.

Page1 / 11

lecture_12 - ECE 190 Lecture 12 LC-3 Assembly language...

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

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