0
votes

No recorder seems receive value

.data
.text

main:
    li $t1,2
    li $t0,3
    li $t2,1
    j inicio
    syscall

inicio:
    move $t2,$t1
    move $t1,$t0
    move $t0,$t1
    j end

end:
    li $v0,1
    syscall                     
1

1 Answers

0
votes

You never set $a0 with a value before doing the syscall 1, so it would just output whatever was in $a0, which would be zero

Also, setting $t0-$t2 didn't do anything in your program.

Here's a slightly more cleaned up demo program:

    .data
msg_space:  .asciiz     " "

    .text
    .globl  main
main:
    li      $a1,1
    jal     prtnum

    li      $a1,2
    jal     prtnum

    li      $a1,3
    jal     prtnum

    li      $a1,37
    jal     prtnum

    li      $v0,10                  # syscall for exit program
    syscall

prtnum:
    # output a space
    li      $v0,4                   # syscall for print string
    la      $a0,msg_space
    syscall

    # NOTE: setting a0 with the number was the missing step
    move    $a0,$a1                 # get number to print
    li      $v0,1                   # syscall for print integer
    syscall

    jr      $ra                     # return from function