- Lab
- The goal of this lab is to read a series of numbers from a block of contineous memory, three numbers at a time. Upon obtaining the three numbers, the program will add the three numbers together and store the result back into a second contineous block of memory.
- The program flow will look like this:
- START (Label)
- Call a "function"(1) named "ReadThree" to Read the next three numbers into registers %r1, %r2, and %r3.
- The ReadThree function should use a memory label "INPUT", plus an offset that you store in %r10 to load the values. %r10 should be incremented appropriately.
- When you have loaded the values into the registers, return using the JMPL command with %r15 as the destination address.
- Check to see if all three values (%r1, %r2, and %r3) are ZERO. If they are, go to the label named END.
- Call a "function" named "AddThree". This function will add the values in %r1, %r2 and %r3 and store the result in %r4, then return using JMPL.
- Call a "function" called "StoreResult". This function will take the value in %r4 and store it in a memory location with the label "OUTPUT", plus an offset that is stored in %r11. %r11 should be incremented appropriately so that the results are stored in sequence in memory. When the output has been stored, the function should return using JMPL and %r15, as appropriate.
- END (Label)
- Once we come to the end, we should HALT the program.
Instructions
By: microhaxo | Date: Jun 26 2009 20:31 | Format: None | Expires: never | Size: 1.43 KB | Hits: 902
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago