Encoding instructions as binary numbers is natural and efficient for computers. Humans, however, have a great deal of difficulty understanding and manipulating these numbers. People read and write symbols (words) much better than long sequences of digits. Chapter 2 showed that we need not choose between numbers and words because computer instructions can be represented in many ways. Humans can write and read symbols, and computers can execute the equivalent binary numbers. This appendix describes the process by which a human-readable program is translated into a form that a computer can execute, provides a few hints about writing assembly programs, and explains how to run these programs on SPIM,. | APPENDIX Assemblers Linkers and the SPIM Simulator James R. Larus Microsoft Research Microsoft Fear of serious injury cannot alone justify suppression of free speech and assembly. Louis Brandeis Whitney v. California 1927 Introduction A-3 Assemblers A-10 Linkers A-18 Loading A-19 Memory Usage A-20 Procedure Call Convention A-22 Exceptions and Interrupts A-33 Input and Output A-38 sPim A-40 MIPS R2000 Assembly Language A-45 Concluding Remarks A-81 Exercises A-82 Introduction Encoding instructions as binary numbers is natural and efficient for computers. Humans however have a great deal of difficulty understanding and manipulating these numbers. People read and write symbols words much better than long sequences of digits. Chapter 2 showed that we need not choose between numbers and words because computer instructions can be represented in many ways. Humans can write and read symbols and computers can execute the equivalent binary numbers. This appendix describes the process by which a human-readable program is translated into a form that a computer can execute provides a few hints about writing assembly programs and explains how to run these programs on SPIM a simulator that executes MIPS programs. UNIX Windows and Mac OS X versions of the SPIM simulator are available on the CD. Assembly language is the symbolic representation of a computer s binary encoding machine language. Assembly language is more readable than machine language because it uses symbols instead of bits. The symbols in assembly language name commonly occurring bit patterns such as opcodes and register specifiers so people can read and remember them. In addition assembly language machine language Binary representation used for communication within a computer system. A-4 Appendix A Assemblers Linkers and the SPIM Simulator assembler A program that translates a symbolic version of an instruction into the binary version. macro A pattern-matching .