Public paste
By: microhaxo | Date: Jun 26 2009 20:31 | Format: None | Expires: never | Size: 1.43 KB | Hits: 831

  1. Lab
  3. 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.
  5. The program flow will look like this:
  7. START (Label)
  9.     Call a "function"(1) named "ReadThree" to Read the next three numbers into registers %r1, %r2, and %r3.
  10.     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.
  11.     When you have loaded the values into the registers, return using the JMPL command with %r15 as the destination address.
  13.     Check to see if all three values (%r1, %r2, and %r3) are ZERO.  If they are, go to the label named END.
  15.     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.
  17.     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.
  19. END (Label)
  21.     Once we come to the end, we should HALT the program.