Fill in the following program with the appropriate assembly to
produce the results of the
module described. Using MARS.
====== T A S K =======
# Program performs the following mathematical operation:
# f = (g + h) - (j - 12)
# where: g = 12, h = 3, j = 27
#
# --Global Variables:
# * print = Print out message - "f = "
# ******************** Math Operations ******************** #
.data # GLOBAL VARIABLES go in the data segment
.text # All instructions go in the text segment
# ***Begin the Main Program***
main:
# f = $s0
# f = (g + h) - (j - 12)
# g = 12 -> g = $t0
# h = 3 -> h = $t1
# j = 27 -> j = $t2
# $t3 = (j - 12)
# $t4 = (g + h)
# f = $t4 - $t3
# print out "f = " and $s0
# ** terminate program **
li $v0, 10
syscall
# ***End the Main Program***
Please find the code below:
# Program performs the following mathematical operation:
# f = (g + h) - (j - 12)
# where: g = 12, h = 3, j = 27
#
# --Global Variables:
# * print = Print out message - "f = "
# ******************** Math Operations ******************** #
.data # GLOBAL VARIABLES go in the data segment
prompt: .asciiz "\nf = "
g : .word 12
h : .word 3
j : .word 27
.text # All instructions go in the text segment
# ***Begin the Main Program***
main:
# f = $s0
# f = (g + h) - (j - 12)
# g = 12 -> g = $t0
lw $t0,g #load g
# h = 3 -> h = $t1
lw $t1,h #load h
# j = 27 -> j = $t2
lw $t2,j #load j
sub $t3,$t2,12 # $t3 = (j - 12)
add $t4,$t0,$t1# $t4 = (g + h)
# f = $t4 - $t3
sub $s0,$t4,$t3
# print out "f = " and $s0
li $v0,4
la $a0,prompt #it will print prompt
syscall
li $v0,1
move $a0,$s0
syscall
# ** terminate program **
li $v0, 10
syscall
# ***End the Main Program***
output:

Fill in the following program with the appropriate assembly to produce the results of the module...