# Setup Base Registers
# Have operands located at 2000, 2004, and 3000. Need base registers with
# addresses within 4K of each of these addresses. Will setup GPR6 with a
# base address of 2000 and GPR7 with a base address of 3000.
1000 41100FFF # GPR1 <- FFF
1004 41101001 # GPR1 <- GPR1 + 1 (GPR1 <- 1000)
1008 41611000 # GPR6 <- GPR1 + GPR1 (GPR8 + 2000)
100C 41761000 # GPR7 <- GPR6 + GPR1 (GPR7 <- 3000)
# Calculate Value of a + b + 4
# Place Result in GPR1
1010 58107000 # GPR1 <- a
1014 58207004 # GPR2 <- b
1018 41300004 # GPR3 <- 4
101C 1A12 # GPR1 <- a + b (GPR1 = GPR1 + GPR2)
101E 1A13 # GPR1 <- a + b + 4 (GPR1 = GPR1 + GPR3)
# Calculate Value of 2(a + b + 4)
# Place Result in GPR3. Actually store the result of the multiply
# in the register pair starting in GPR2. This will cause the least
# significant 4 bytes of the product to be stored in GPR3.
1020 41200002 # GPR3 <- 2
1024 1C21 # GPR2, 3 <- GPR2 * GPR1
# Calculate Value of a + b + 6
# Will calculate this value by adding 2 to the previously calculated
# value of a + b + 4
1026 41101002 # GPR1 <- (a + b + 4) + 2 (GPR1 = GPR1 + 2)
# Calculate Value of 3(a + b + 6)
# Write Result In R5
102A 41400003 # GPR4 <- 3
102E 1C41 # GPR4, 5 <- GPR4 * GPR1
# Add 2(a + b + 4) and 3(a + b + c) and store the answer at x
1030 1A35 # GPR3 <- GPR3 + GPR5
1032 50306000 # GPR3 -> x