CS250 Lab 6: Practice with Functions

Due Wednesday, March 6

This is another assembly practice lab. For this one, create a function called round. It should take two parameters:
  1. A number to round
  2. A power of 10 for the rounding. 0 indicates no rounding, 1 means round to the nearest 10, 2 means round to the nearest 100, and so on.
Write this function in assembly, along with a main function that will test your function. Call it at least 3 times in your test code, with different parameters.

Calling Convention

You can follow C calling conventions if you want to. Or you can follow 32-bit C calling conventions, like the book describes, where parameters are pushed onto the stack. Or you can do your own thing. Explain the calling convention you chose in a comment above the function, with enough detail that theoretically I could add another call to your function without actually reading the assembly.