CSC 174 - Computer Organization and Assembly Language

Dr. R. M. Siegfried

Assignment #10 - Using Procedures

Due Monday, April 18, 2016

Write a procedure called add3, whic takes it three parameters from the stack and returns the sum, leaving it in the EAX registers. Also, you will need to write a main program, which pushes the three parameters on the stack, finds the sum in the EAX register and prints the value, with relevant text.

NB - The top item on the stack when you enter the procedure is the return address. Therefore, the first thing you need to do is save this and at the end of the routine, push it back on the stack. It will look like this:

RetAddr         DWORD    ?
... ...
add3      proc
          pop  RetAddr   ; Save the return address so you can pop the
                         ;  parameters
          .......
          push RetAddr   ; Restore the return address so you can go back to
                         ; the main program
          ret
add3      endp

[Back to the Assignment Index]