Question: use MIPS assembly language to write this program Reading and Printing SPIM provides a small set of operating system-like services through the system call instruction,

 use MIPS assembly language to write this program Reading and Printing
SPIM provides a small set of operating system-like services through the systemuse MIPS assembly language to write this program

Reading and Printing SPIM provides a small set of operating system-like services through the system call instruction, named syscall. To request a service, a program loads the system call code it can be found in MIPS System calls uploaded in the Useful Resources folder in Sakai) into register $v0 and arguments into register file registers $a0-$a3 (or $f12 for floating-point values). System calls that return values put their results in the register $v0 (or $f0 for floating-point results) [1] Reading and printing operations can be done with syscall. In order to become familiar with syscall, read the following example first. # Registers used : $to -used to hold the first number # $t1 - used to hold th@ second numb@r $t2 - used to hold the difference of the contents of $t1 and $to # Svo - syscall parameter and return value # $a0 - syscall argument text main: ## Get first number from the user, store it into $t0 li $v0, 5 syscal move $t0, $v0 # load syscall read-int into $v0 # make the syscall. # move the number read into $t0 ## Get second number from the user, put into $t1 l vo, 5 # load syscall read-int into $v0 syscall # make the syscall. move $t1, v0 # move the number read into register t1 In this example, the syscall instruction is first used to read input. The system code for this operation is 5. Then we use system code 1 to print this input. Notice that we also use code 10 to terminate the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!