Yes.
Let us write a program that evaluates the formula
5 × x - 74
where the
value x
is in register $8.
Assume that x
is two's complement.
Here is the program:
## newMult.asm ## ## Program to calculate 5 × x - 74 ## ## Register Use: ## $8 x ## $9 result .text .globl main main: ori $8, $0, 12 # put x into $8 ori $___, $0, 5 # put 5 into $___ mult $___, $___ # ___ <-- 5x mflo $___ # $___ = 5x addiu $___, $___,-74 # $___ = 5x - 74 ## End of file