{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw3_sol_s10 - EEL HQWW HW 5353 $o\u¥\0n> 9&3sz ®...

Info iconThis preview shows pages 1–3. 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 Document Right Arrow Icon
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EEL HQWW HW 5353 $o\u¥\0n§> 9&3sz ® AsgV/WAS AL. Max Q“? AWF‘EL— , Compare, m M an E) w ,GT 3 1e- PM > A1. (50 AVQRW” Hox/ AROMA. / 6% Log mo W\\4 AL. H B EMMA)“; )3me *0 emu +6 5%? “mm “‘1” ”CV R20) pm jig AH>AL_ hug Mo W\‘\rb AH 00“ (5 “arm“ uNc, J “Vagm3re \oop Arc "res/“Mew Cxfiv¥mn Q33, AVKCRH-xfl 1/ w/xgjkxfi‘s Ci§ej > HOV RHI+HJ2WJ \oag Mk V%5¥U wfiM “VAR “a” AKL7$§V>\\Z_ ) \o>\ AL rcirgxégfi \Mc‘x‘m VAL WP WP AWN. ; Campus M WA RL (’3 341,ch ; :9 Afi>p¢, Age/(Mmgw “COMO/E INC RH } EVX’J \RUCMJA3V pg“ \5 \oOPJUNc, I 9&4)?“be WM ‘5 mwm ; :AWAQ \oof 1w wwsa gym/Am score_vector_length max_addr min_addr blank scores length _c__int00: again not_max repeat - min not_min repeatZ end1 .text MOV MOV MOV MOV MOV MOV MOV MOV MOV MOV INC lNC DEC MOV MOV MOV MOV MOV NOP NOP MOV MOV NOP NOP DEC INC MOV SUB MOV MOV MOV MOV MOV MOV MOV MOV MOV DEC lNC MOV SUB MOV MOV DEC .set 0x0A000 ;constants HM) 3 pa ‘ 2‘ .set 0x09100 U .set 0x09101 .global _c_int00 .data ;data .word 1 ;Length will be saved here .word -40,100,1,—2 .word 4 ;program ARO,#sc0res ;Load registers with addresses that will be used in the program AR1,#score__vector_length AR2,#max_addr AR3,#min_addr AR5,#length ;Save length of vector in memory AL,*AR5 *AR1,AL AR4,#scores AL,*AR4 ;Save scores in memory starting at address vector_addr *AROAL ;First move content of lst element in vector to first addr of score_addr ARO ;Increment pointer to next address of score,addr AM ;Increment pointer of scores i.e go to next grade. *ARI ;Decrement counter again,NEQ ;Check if all values have been written to mem. If no go again, else continue. ARO,#scores ;Find Max, Set pointer back to first element of score_addr AR1,#score,.vectorJength ;Set counter back to the number of scores AR5,#length AL,*AR5 *AR1,AL AL,*ARO ;Assume first number is max *ARZAL ;store first value of scores as the max *ARl ;Decrement counter to check if all scores have been compared min,EQ ;If we checked all scores go to find min value ARO ;Check next value of vector (next score) AL,*ARO AL,*ARZ ;Substract 2nd value from lst value (CMP will also work) not.max,LT ;lf 2nd value is greater store as max, else go next val compare again AL,*ARO ;Store value in max_addr *AR2,AL B repeat,NEQ ;If we checked all scores go to find min value ARO,#scores ;Find Min, Set pointer back to first element of score_addr AR1,#score_vector_length ;Set counter back to the number of scores AR5,#length AL,*AR5 *AR1,AL AL,*ARO ;Assume first number is min *AR3,AL ;store first value of scores as the min *AR1 ;Decrement counter to check if all scores have been compared end1,EQ ;If we checked all scores go to find min value ARO ;Check next value of vector (next score) AL,*ARO AL,*AR3 ;Substract 2nd value from lst value (CMP will also work) not_min,GT ;Iond value is greater store as min. else go next val compare again ALIARO ;Sunevflueinnnnjddr *AR3,AL *ARI ;Decrement counter to check if all scores have been compared repeat2,NEQ ;lf we checked all scores go to find average value end1,UNC EEL LRLM aw #3,; MM QcO\9\e.Ms, SOLUTIONS TO CHAPTER 5 PROBLEMS (5—5 5/ 15 15:15"? Discuss the advantages of using a relocatable assembler versus an absolute assembler. The mamadvantage of the relocatable assembler is that it allows software to be developed in modules and later linked together to form the executable code. Describe the operation of a two-pass assembler. ‘ The two-pass assembler first reads the source code looking for definitions and labels. It makes a table of these and then on the second pass it is able to supply the information where it is needed. This allows what is called "forward referencing" where a value may be used before it is defined. What is a macro—assembler? A macro-assembler is one in which a programmer can define a "macro" which consists of several assembly language statements. The macro can then be used in the program instead of repeating the sequence of statements. What is a cross-assembler? An assembler that executes on a different computer than the one it is producing code for. What function does a linker program provide? It links,or combines together, modules separately assembled using a relocatable assembler. When doing this, it resolves all addresses that the assembler was not able to resolve. Define what is meant by assembly—time, link—time, load—time and run—time. Assembly—time: 'Ihetimethatthe assembler is run. Constants are evaluated and some addresses may be resolved at this time. Link-time: The time the separate modules are combined together. Load—time: The time the code is loaded into the memory of the corrputer. In some systems where the code is relocatable (such as in personal computers) the final addresses resolution is done at this time. Run-time: The time the program runs. Variable data values are What is the difference between a trace and a breakpoint? Setting breakpoints in the program allows the program to run at full speed until it hits the breakpoint. The trace runs the program more slowly but you can see the program flow and watch the variables at each step. Why must the stack pointer be initialized as one of the first things done in a program? Ifthe stack pointer is not initialized to point to RAM memory, it may be pointing to ROM or even an area where there is no memory. If this happens, the program most likely would not return from a subroutine. ...
View Full Document

{[ snackBarMessage ]}