.ORIG x3000 Main LD R6, Stack ; Initialize the stack and LD R5, Stack ; frame pointers LD R0, Param1 LD R1, Param2 PUSH R1 ; Pushing the parameters PUSH R0 ; JSR IntAdd ; Call the callee POP R0 ; Retrieve the return value ADD R6, R6, #2 ; Get rid of the parameters HALT IntAdd ADD R6, R6, #-1 ; Allocate return value PUSH R7 ; Store return address PUSH R5 ; Store dynamic link ADD R5, R6, #-1 ; Setting up frame pointer ADD R6, R6, #-1 ; One local variable LDR R3, R5, #4 ; Loads A LDR R4, R5, #5 ; Loads B ADD R3, R3, R4 ; Actually add STR R3, R5, #3 ; Store return value ADD R6, R6, #1 ; Get rid of locals POP R5 ; Restore the dynamic link POP R7 ; Restore the return address RET Stack .FILL x4000 Param1 .FILL x0002 Param2 .FILL x0003 .END