Controller
Controller

Reputation: 529

printing a message in mips

I have the following code in my program

li $v1, 4              #system call code for Print String
la $a0, LC             #load address of message into $a0
syscall                #print the string
li $v1, 1              #system call code for Print Integer
move $a0, $v0          #move value to be printed to $a0
syscall                #print result

and

.rdata
LC: .asciiz "The factorial of 10 is : "

but when I try to use it in mips it says:

Unknown system call: 3628800

where 3628800 is the result I want to print!

What is going wrong?Can I use jal printf instead and how should I write it? thanks in advance

Upvotes: 2

Views: 7653

Answers (1)

Michael
Michael

Reputation: 58517

The system call number goes into $v0, not $v1.

Upvotes: 3

Related Questions