; Recitation 6 ; Author: ; Date: ; Email: ; Class: CS270 ; ; Description: Implements integer (16-bit) addition, subtraction, and ; multiplication. ; ;------------------------------------------------------------------------------ ; Begin reserved section: do not change ANYTHING in reserved section! .ORIG x3000 BR Main Functions .FILL IntAdd ; Address of IntAdd routine (option 0) .FILL IntSub ; Address of IntSub routine (option 1) .FILL IntMul ; Address of IntMul routine (option 2) Main LEA R0,Functions ; The main routine calls one of the LD R1,Option ; subroutines below based on the value of ADD R0,R0,R1 ; the Option parameter. LDR R0,R0,0 ; JSRR R0 ; EndProg HALT ; ; Parameters and return values for all functions Option .FILL #0 ; Which function to call Param1 .BLKW 1 ; Space to specify first parameter Param2 .BLKW 1 ; Space to specify second parameter Result .BLKW 1 ; Space to store result ; End reserved section: do not change ANYTHING in reserved section! ;------------------------------------------------------------------------------ IntAdd ; Your code goes here ; Solution has ~4 instructions ; DON'T USE REGISTERS 5, 6, or 7! RET ;------------------------------------------------------------------------------ IntSub ; Your code goes here ; Solution has ~6 instructions ; DON'T USE REGISTERS 5, 6, or 7! RET ;------------------------------------------------------------------------------ IntMul ; Your code goes here ; Solution has ~9 instructions ; DON'T USE REGISTERS 5, 6, or 7! RET ;------------------------------------------------------------------------------ .END