I am trying to learn the MIPS assembly since I have free time and I am trying to write a program that pushes numbers to the stack and then pushes them. I want him to count the number of numbers that popped up before reaching a negative number, and then every time he gets a negative, consider the number of negative and positive numbers.
so far i got this:
.text
.globl main
main: la $t0, test
lw $t1, num
loop: lw $t2,($t0)
sub $sp, $sp, 4
sw $t2($sp)
add $t0, $t0, 4
add $t1, $t1, -1
bnez $t1, loop
.data
test: .word
2, 0xfffabfff,2,-4,-9,0x99999999,0x90000000,-2147479536,0x80000000
num: .word 10
ans: .asciiz "Number is = "
endl: .asciiz "\n"
I got this to push as far as I can judge, but I can't figure out what needs to be done. what do i need to do here?
source
share