MIPS assembly

Problem Description:

  • Problem 5: Self Modifying Code [2 marks: 1 public / 1 release / 0 secret] (filename: self-modifying.hex).
  • Register $$1$1x$. Do not modify the value in register $$2$.
  • The last two instructions in your program must be:
    • Add the value of $$0$2$0$.
    • Return to the address stored in register $$31$.

Requirements:
Write a MIPS program in machine code that modifies the second last instruction. Instead of adding $$0$2$0$, it will add $$0$2$x$1$).

Input Example:
Enter value for register 1: 19
Enter value for register 2: 0xAAAA5555

Running Result:
Running MIPS program.
MIPS program completed normally. $$01 = 0×00000013$, $$05 = 0×00029820$, $$02 = 0xaaaa5555$, $$06 = 0×00000000$, $$03 = 0×00020020$, $$07 = 0×00000000$, $$04 = 0×00000800$, $$08 = 0×00000000$, $$09 = 0×00000000$, $$13 = 0×00000000$, $$10 = 0×00000000$, $$14 = 0×00000000$, $$15 = 0×00000000$, $$11 = 0×00000000$, $$12 = 0×00000000$, $$16 = 0×00000000$, $$17 = 0×00000000$, $$21 = 0×00000000$, $$18 = 0×00000000$, $$22 = 0×00000000$, $$19 = 0xaaaa5555$, $$23 = 0×00000000$, $$20 = 0×00000000$, $$24 = 0×00000000$, $$25 = 0x00$, $$26 = 0×00000000$, $$27 = 0×00000000$, $$28 = 0×00000000$, $$30 = 0×01000000$, $$31 = 0×8123456c$.