CS3280 Week Five Notes
CS3280 Week Five Notes 3280
Popular in Computer Organization and Assembly Language
verified elite notetaker
Popular in ComputerScienence
verified elite notetaker
This 14 page Class Notes was uploaded by Courtney Walker on Friday September 25, 2015. The Class Notes belongs to 3280 at University of Missouri - Columbia taught by Michael Jurczyk in Summer 2015. Since its upload, it has received 48 views. For similar materials see Computer Organization and Assembly Language in ComputerScienence at University of Missouri - Columbia.
Reviews for CS3280 Week Five Notes
Report this Material
What is Karma?
Karma is the currency of StudySoup.
Date Created: 09/25/15
mmded I 369 El Structured programming program consists of 4 basic structures Code block lf thenelse While Do until for optimization PWNT 1 Code block w Block of Instructions executed consecutively No branches jumps or subroutine calls 1 A conditiOn fThen l False block I 1 L 7 define FINAL 1O intcount lfcount FINAL then block 1 B IfThenElse t Fals condition 9 then block elseblock V define FINAL 10 intcount If count FINAL then thenblock else elseblock 2 While r condition Fa39se True block I define FINAL 10 intcount while count FINAL block 00an gwg E 8 a I a Go U 3 DoUntll CM woo block 8 abxoch S L099 cow 6 men 35 1 oa 6N8 DO condition 5 N 00Cquot ax5r SW x C define FINAL 1O intcount do block until count FINAL 39Thck m h mg kg iQkG Ex S m two ways to implement variables A in memory I in register disadvantage disadvantage 3Ouo PquFAm hmpvccg Dmecf o C39czqislirs 0 Z3 4 lero zr anqfs ForLoop impementation define N 10 intcount for count0 count lt N count mock Use while or do until structure rm mmvaxa 0amp3 emmx e W eeke 1 e 636 me 60 Nam e at N Sm Crank 3 Eatwas muumwg 43 00 Sh f39XO3V bi 0 a Cdch eiv 3W N A O 2 WW c 3 cm COQCQV O V g butMa C gawk 91 NM CO bwd C DUNK A k ForLoop implementation define N 10 intcount coUnt 0 while count lt N do block count 1 count variable in memory OQKE EEIXD N Q0 lO 2 39 f y l COUNT Old 57 ii C L Coo NT U rlL L gx C k VT c ma a N GT39 MDMMAC k QGEK IP46 QDo Mix a w W 6 Q U 2 not 3c 3 WHO5vme ForLoop implementation 2 count variable in registerA N 5o l define N 10 i mm int count 0 l j WOO C MAR I count O c mm r N while count lt N do g Gm apolooHWK 39 block it lolode S count TN Cg P col11 i A 6 Z x 3r 1 evau wzomm I 36 73 Z 3 Program Optimization The Wrong Way intcount0 while count 10 Pseudo code quotCC ON cuOR I O u 00 Cm5lt 391 I 00th Arm 3 03 Z count 3 m L30 Cm65lt 7 39 ORG 8000 ORG 8000 COUNT FCB 0 COUNT FCB 0 ORG c000 I ORG c000 WHILE LDAA COUNT jgt LDAA COUNT CMPA 10 w WHILE CMPA 10 BEQ ENDW BEQ ENDW INC COUNT INCA BRA WHILE BRA WHILE ENDW next instruction ENDW STAA COUNT Program Optimization The Right Way 1 while lt dountil If possible use dountil saves one branch instruction 2 Put variables in registers if possible idCNQ Multiple Precision Arithmetic x if Q NUMB1 NUMBZ gt NUMBt gt09 so 9 0 IQ L 93 CG l 0 MSB B1 f LSB NUMBl w MSB B1 LSB NUMBZ M88 31 L88 SUM NUMB1 Algorithm add byte by byte starting with LSB store result bytes in place of NUMBt FOC a knitCS a Carat iiileg CBS we L1q39w risk l ic CC Q ocGuC LS Maxim A Assume numbers are stored in little endian format NUMB1 NUMBZ LSB MSB LSB MSB Pseudo code ska U5 J mgg GVTSX Note assembly language program should mach pseudo code structure one to one to minimize programming errors and aid debugging J Decisions to be made for Pseudo Code NUMB1NUMBZ arrays of data bytes array elements can be accessed two ways 1 through array index 2 through pointer into array Poloch RMO eccaxc m1m1c md XC s Addwssm mock Which to use Have to use a forloop to go through the bytes 1 Use while or dountil structure