-1

i have some code in mips assembler and i'm getting something like in the title. As you can see, i have $li $v0, 10 and syscall so does anybody know what's wrong with it?

        .data
text0:  .asciiz "Enter strng: \n"   
buf0:   .space 100

    .text
    .globl main

main:
    la $a0, text0                   
    li $v0, 4                       
    syscall                         

    la $a0, buf0                    
    li $a1, 99                      
    li $v0, 8                       
    syscall                         

    li $t0, 'a'                     
    li $t1, 'z'                     
    li $t2, 0x20

    la $t3, buf0                    


loop_begin:
    lb $t4, ($t3)                   
    beq $t4, $zero, loop_end        

    blt $t4, $t0, increment_ptr     
    bgt $t4, $t1, increment_ptr     
    sub $t4, $t4, $t2               
    sb $t4, ($t3)                   
increment_ptr:
    addi $t3, $t3, 1                
    b loop_begin                    
loop_end:

    la $a0, buf0                    
    li $v1, 4                       
    syscall                         

    li $v0, 10                      
    syscall
Michael
  • 57,169
  • 9
  • 80
  • 125
zakho
  • 13
  • 2
  • There's not enough information! Presuming the last line is throwing you the error, then what does syscall 10 do? Does it even exist? From code inspection, I can only tell that syscall 4 seems to be print to terminal operation. – Flying_Banana Oct 27 '15 at 08:42
  • @Flying_Banana: What, you mean that you didn't read [SPIM tag wiki](http://stackoverflow.com/tags/spim/info) after I went through the trouble of adding information about the available system calls? ;P – Michael Oct 27 '15 at 08:51

1 Answers1

0

I can't reproduce your error message. Perhaps you did a Reinitialize in SPIM without reloading the assembly file.

Anyway, you're not setting up the final print_string system call properly:

li $v1, 4   # <-- SHOULD BE $v0                       
syscall

If you had used the single-stepping feature in SPIM to debug your code you probably would've found this, so I suggest that you make use of it for future development.

Michael
  • 57,169
  • 9
  • 80
  • 125