LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   MIPS assembly question (https://www.linuxquestions.org/questions/programming-9/mips-assembly-question-221354/)

Gnute 08-23-2004 11:44 AM

MIPS assembly question
 
Just out of curiosity, if you were writing code to assemble with as rather than SPIM, (MIPS code) exactly what registers can you use? And which is read by 'syscall'? (And which is read by syscall for something like print)
Also, are the syscall numbers for read_int and such similar to that of SPIM?
I ask because as failes to assemble when I use $a0 or $v0.
Thanks.

Mara 08-24-2004 05:33 PM

Try registers $0, $1 and so on. It should work that way. It also looks that 'syscal' instruction exists in real mips, but printing anything is not as easy as when using the similator.
IMHO the easiest thing would be (if you have MIPS version of gcc, but if you have as...) to write a short C program with 'printf' and compile it this way
gcc -O2 -S prog.c
You'll get your program compiled to assembly.


All times are GMT -5. The time now is 06:23 AM.