cassemblymips32qtspim

qtspim unknown system call: 40?


when I tried to run this code two windows popped up and say

unknown system call: 40

and

unknown system call: 42

I suspect that this is not about the system calls themselves, but i'm not sure either. This is my first time writing with the MIPS assembly language so please let me now if there is anything I didn't do correctly in the code below.

.data

line1:    .asciiz     "Enter a maximum number"
line2:    .asciiz     "Enter a seed"
line3:    .asciiz     "Enter a guess"
line4:    .asciiz     "NO"
line5:    .asciiz     "YES"

.text
.globl main



main:

li $v0, 4
la $a0, line1        
syscall                        # output line 1

li $v0, 5                   
syscall

move $s0, $v0        # User input moved to s0



li $v0, 4
la $a0, line2                # output line 2     
syscall

li $v0, 5   
syscall    

move $s1, $v0    # User input moved to s1




li $v0, 40         # Creating a seed for the random number generator with user input
add $a0, $zero, 0       
add $a1, $zero, $s0
syscall




li $v0, 42         # Creating the random number generator with user input
add $a0, $zero, 0 
add $a1, $zero, $s1
syscall

move $s2, $a1  




li $v0, 1
move $a0, $s2
syscall


li $v0, 10
syscall


Solution

  • Spim is a limited number of system calls: http://students.cs.tamu.edu/tanzir/csce350/reference/syscalls.html so when using spim, using anything outside of them will not work.

    The mars simulator has more calls: http://courses.missouristate.edu/kenvollmar/mars/help/syscallhelp.html with the 40 and 42 syscalls being amongst them.

    So if you want to use those system calls, you must use the mars simulator.