Objective Write a MIPS assembly language program which will prompt the user for
ID: 3546452 • Letter: O
Question
Objective
Write a MIPS assembly language program which will prompt the user for 10 positive integers and then display the following information:
(1) Maximum, Minimum, & average integer. (Display these three values in base 10.)
(2) The list of integers in the Reverse order entered and displayed in three bases (Binary, Decimal, Hex)
Specification
Store the numbers in an array
Use at least three MIPS procedures to do logical things.
You need not pass parameters or have return values
Document appropriately
PLEASE HELP! Totally lost & Don't know where to start.
Much appreciated
Explanation / Answer
DATA section
.data
prompt: .asciiz " How many integer numbers?(5 integers,minimum)"
result: .asciiz "The minimum integer is "
CODE SECTION
.text
.globl main
main:
li $v0, 4 # system call code for Print String
la $a0, prompt # load address of prompt into $a0
syscall # print the prompt message
li $v0, 5 # system call code for Read Integer
syscall # reads the value into $v0
blez $v0, end # branch to end if $v0 < = 0
li $t0, 0 # clear register $t0 to zero
loop:
add $t0, $t0, $v0 # sum of integers in register $t0
addi $v0, $v0, -1 # summing integers in reverse order
bnez $v0, loop # branch to loop if $v0 is != zero
li $v0, 4 # system call code for Print String
la $a0, result # load address of message into $a0
syscall # print the string
li $v0, 1 # system call code for Print Integer
move $a0, $t0 # move value to be printed to $a0
syscall # print sum of integers
b main # branch to main
end: li $v0, 4 # system call code for Print String
la $a0, # load address of msg. into $a0
syscall # print the string
li $v0, 10 # terminate program run and
syscall # return control to system
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.