Question: USING SYSCALLS MIPS A syscall is a function that is provided by the operating system of the MIPS computer, not by the MIPS architecture itself.

USING SYSCALLS

MIPS

A syscall is a function that is provided by the operating system of the MIPS computer, not by the MIPS architecture itself. Examples are the ability to print data to the MIPS computers display monitor, obtain the time of day, etc.

Open the MARS help screen, and select the Syscalls tab to bring up the available syscalls. Find and review the section How to use SYSCALL system services.

You will use syscall 41, random int. Use of a syscall requires a series of MIPS instructions. You must provide the setup of a syscall by setting values in registers, then make the syscall itself.

MIPS instruction to put the value 41 into register $v0. This specifies which syscall will be executed.

The random integer syscall needs no other parameters. In general a syscall may require that other parameter values be placed in registers.

MIPS instruction syscall( just the word syscall by itself on a line.

The outcome of this syscall is that a random number will have been places into a register. Use the documentation in the help page to find out which register.

Write a loop that will generate 6 random integers and store them in arrayB.

Write instructions to prepare for a future loop, including the following actions:

Initialize a loop counter

Put the address of arrayB into a register, using the la instruction.

Write instructions to complete the body of the loop, including the following actions:

Syscalls for random integer(see above)

Store that random integer into the arrayB at the correct location.

Modify the base address for the next iteration of the loop

Modify the loop counter value.

Below is the beginning of the MIPS code and is provided for a consistent filename spelling:

.data

arrayB: .word 0xffff, 0xffff, 0xffff, 0xffff

.text

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!