CS/COE 447 Programming Assignment 1 Additional Information ======================== Below is some guidance about programming assignment 1 and what parts of Appendix A to focus on to do it. Also, are are some sample programs to help you get started: http://www.cs.pitt.edu/~wiebe/courses/CS447/Sp07/sample1.asm http://www.cs.pitt.edu/~wiebe/courses/CS447/Sp07/sample2.asm For printing, all the information you will need is on pages A-42 and A-43. Pages 226-227 show all the MIPS instructions: the MIPS core, the "remaining MIPS-32", and the Pseudo Ops. For this assignment, stick to the MIPS core (Figure 3.24) and the Pseudo Ops (right of Figure 3.25). To load a word from memory, the address of the memory location needs to be loaded into a register. This actually cannot be done directly. Pages A-19 and A-20 shows one way to do this. Note that that the Pseudo Op "la" enables you to load an address using one assembly language instruction. But you'll see in the simulator that multiple machine code instructions are generated by the assembler. Section A.6 is about calling procedures. It covers the notion of a "procedure call frame" ("stack frame"), which is a segment of the stack for passing arguments, saving registers that the procedure may modify but which the caller does not want to be modified, and allocating storage for local variables. We will cover stack frames later in the course, for example when we cover recursive procedures. For the first assignment, you do not need to create a stack frame or save anything on the stack. Note that you should use $a0 and $a1 to pass the arguments to your procedure, to follow MIPS convention. Most load and store instructions operate only on aligned data. A quantity is "aligned" if its memory address is a multiple of its size in bytes. Therefore, a half-word object must be stored at even addresses and a full word object must be stored at addresses that are a multiple of four. Page A-46 lists the .align directive. .align 2 means that the next value will start on a word boundary (an address divisible by 4). You might have to use .align 2 if, for example, you create a string in memory followed by an array of integers. Starting on page A-50, Appendix A goes through each individual instruction, including its machine code. You may find these listings useful. You can enter instructions a few at a time, assemble them, and step through them, to help you get up to speed. You will be asked on the exams to give the machine code corresponding to assembly language instructions, so it is good practice to try to come up with the machine code yourself, and then check your answers against the simulator.