i m trying to write a MIPS program that will examine set of ten single digit numbers (positive, zero,or negative) that can be inputted from the terminal. After examining the numbers, only the negative numbers (with appropriate sign) along with their count needs to be outputted to the terminal.
BELOW IS MY MIPS PROGRAM
.data
prompt: .asciiz "Input Score: "
.align 2
HR_Neg: .asciiz "\n negative Scores: "
.align 2
HR_Pos: .asciiz "\n positive Scores: "
.align 2
HR_Negsc: .asciiz "\n Number of Negative Scores: "
.align 2
HR_Posc: .asciiz "\n Number of positive Scores: "
.align 2
HR_coma: .asciiz ", "
.align 2
HR_brk: .asciiz "\n\n"
.align 2
NEg: .space 10
.align 2
Pos: .space 10
.align 2
.globl main
.text
main:
li $t0, 0
la $t1, Neg
li $t2, 0
la $t3, pos
li $t4, 0
li $t5, 0
li $t6, 0
loop:
li $v0, 4
la $a0, prompt
syscall
li $v0, 5
syscall
bltu $v0, 50, else
sw $v0, 0($t1)
addi $t1, $t1, 4
addi $t0, $t0, 1
b l_end
else:
sw $v0, 0($t3)
addi $t3, $t3, 4
addi $t2, $t2, 1
l_end:
addi $t4, $t4, 1
bltu $t4, 15, loop
#output counts
li $v0, 4
la $a0, HR_negc
syscall
la $v0, 1
add $a0, $t0, 0
syscall
li $v0, 4
la $a0, HR_posc
syscall
la $v0, 1
add $a0, $t2, 0
syscall
#output neg scores
li $v0, 4
la $a0, HR_neg
syscall
la $t1, Neg
lw $a0, 0($t1)
li $v0, 1