An answer for part (a):

(offsets graded very loosely -- accept "8" for 10, accept off by two, accept having them backwards.)
SUBR: MOV R1, -(R6)
      MOV 10(R6), R1
      MUL R1, R1
      MUL #3, R1
      MOV R1, R0
      ADD 6(R6), R0
      MOV 4(R6), R1
      MUL #6, R1
      ADD R1, R0
      MOV (R6)+, R1
      RTS R7

An answer for part (b):

    MOV R0, -(R6)
    MOV 100, -(R6)
    MOV 102, R0
    DEC R0
    MOV R0, -(R6)
    JSR R7, SUBR
    ADD #6, R6
    MOV R0, 104
    HALT


[exam] [CSC 258 additional problems] [main course page]