Question: Basic Example Program The following is a basic example program that allocates an array of 2 integers on the stack, puts random numbers in it

Basic Example Program
The following is a basic example program that allocates an array of 2 integers on the
stack, puts random numbers in it, and prints it out.
.data
NEWLINE: .asciiz "
"
.text
.globl main #required
main: #required
addi $sp, $sp,-8 # make space for 2 ints, 8 bytes on the stack
li $a0,0 #set up random number system call. use generator 0
li $a1,100 # max random number is 100
li $v0,42 # syscall 42 is random number in a range
syscall # random number is now in

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!