A-6 Appendix A Assemblers,Linkers,and the SPIM Simulator addiu $29.$29.-32 $31,20($29) Sw $4, 32($29) $5. 36($29) SW $0. 24($29) $0 28($29) $14,28($29) 1w $24,24($29) multu $14.$14 addiu $8, $14,1 slti $1, $8.101 SW $8, 28($29) mflo $15 addu $25,$24,$15 bne $1, $0.-9 SW $25.24($29) lui $4. 4096 1w $5. 24($29) jal 1048812 addiu $4, $4,1072 lw $31,20($29) addiu $29. $29,32 jr $31 move $2, $0 FIGURE A.1.3 The same routine written in assembly language.However,the code for the rou- tine does not label registers or memory locations nor include comments. high-level language (such as C or Pascal)into an equivalent program in machine source language The high- or assembly language.The high-level language is called the source language,and level language in which a pro- the compiler's output is its target language. gram is originally written. Assembly language's other role is as a language in which to write programs. This role used to be the dominant one.Today,however,because of larger main memories and better compilers,most programmers write in a high-level language and rarely,if ever,see the instructions that a computer executes.Nevertheless, assembly language is still important to write programs in which speed or size are critical or to exploit hardware features that have no analogues in high-level lan- guages. Although this appendix focuses on MIPS assembly language,assembly pro- gramming on most other machines is very similar.The additional instructions and address modes in CISC machines,such as the VAX,can make assembly pro- grams shorter but do not change the process of assembling a program or provide assembly language with the advantages of high-level languages such as type- checking and structured control flow.A-6 Appendix A Assemblers, Linkers, and the SPIM Simulator high-level language (such as C or Pascal) into an equivalent program in machine or assembly language. The high-level language is called the source language, and the compiler’s output is its target language. Assembly language’s other role is as a language in which to write programs. This role used to be the dominant one. Today, however, because of larger main memories and better compilers, most programmers write in a high-level language and rarely, if ever, see the instructions that a computer executes. Nevertheless, assembly language is still important to write programs in which speed or size are critical or to exploit hardware features that have no analogues in high-level languages. Although this appendix focuses on MIPS assembly language, assembly programming on most other machines is very similar. The additional instructions and address modes in CISC machines, such as the VAX, can make assembly programs shorter but do not change the process of assembling a program or provide assembly language with the advantages of high-level languages such as typechecking and structured control flow. addiu $29, $29, -32 sw $31, 20($29) sw $4, 32($29) sw $5, 36($29) sw $0, 24($29) sw $0, 28($29) lw $14, 28($29) lw $24, 24($29) multu $14, $14 addiu $8, $14, 1 slti $1, $8, 101 sw $8, 28($29) mflo $15 addu $25, $24, $15 bne $1, $0, -9 sw $25, 24($29) lui $4, 4096 lw $5, 24($29) jal 1048812 addiu $4, $4, 1072 lw $31, 20($29) addiu $29, $29, 32 jr $31 move $2, $0 FIGURE A.1.3 The same routine written in assembly language. However, the code for the routine does not label registers or memory locations nor include comments. source language The highlevel language in which a program is originally written