Assembly Macros COMPSCI 110SS C
This assignment is due Mar 7, 2020 and is worth 1% of your final grade.
This assignment helps you understand assembly macros.
LC-3 does not have a sub instruction for subtraction. It is implemented as an assembly macro instead. The
definition of the sub is as follows. SUB Rd, Rs1, Rs2 subtracts the content of the register Rs2 from the the content of
the register Rs1, and places the result in the register Rd.
An implementation of the sub macro is as follows.
NOT Rt, Rs2
ADD Rt, Rt, #1
ADD Rd, Rs1, Rt
Discuss the drawback(s) of this implementation, and discuss how these drawback(s) can be rectified. Provide your
implementation of the macro avoiding the said drawback(s).