Question: Add Two Integers: Your job is to create an assembly file called sum.s that takes two hard-coded integer values (hard-coded means the values are not
Add Two Integers: Your job is to create an assembly file called sum.s that takes two hard-coded integer values (hard-coded means the values are not read in from the keyboard but literal
constants that you code into the program), adds the two values together together and displays the
result. The guts of the code (the header and the syscall to exit) will resemble hello.s so you can
start by modifying the program. Before making any changes review hello.s until you understand
every line of code. You will need code to load the values of two integers into registers and sum
the two integers together. use li and addu
code give below
# hello.s
# a sample MIPS program to demonstrate MIPS basics
# Usage: $ spim -f hello.s
.data # data segment begins here
stuff: .asciiz "Hello World! "
.text # code segment begins here
main:
la $a0, stuff
li $v0, 4 # 4 is syscall to print a string
syscall # execute the call
li $a0, 10 # 10 is ascii value for linefeed
li $v0, 11 # 11 is syscall to print char
syscall
li $v0, 10 # 10 is system call to exit
syscall # execute the call
output is supposed to
the sum of 9 and 15 is 24
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
