views:

1317

answers:

7

Are there any command line interpreters around for x86 linux inorder to run MIPS assembly programs?

I'd like to be able to write simple MIPS assembly programs and run them from the console on my local machine.

I know of SPIM but it requires X Windows and I'm curious if there are better options out there.

Edit: Turns out it doesn't require X Windows. I still have issues with SPIM. Not the best in my humble opinion. Qemu / Cross compiled toolchain is a little more work but I have less quirks.

A: 

Maybe you can take a look at these emulators? I'm not an expert but the list seems good.

PolyThinker
This focuses on system emulation, not userland emulation. That is, that reference is good if you want to emulate a complete MIPS box, not just a given MIPS app.
Cody Brocious
+1  A: 

QEmu has a good MIPS emulator. Combine that with a cross-compiled GCC/binutils (technically you only need binutils to get GAS, the GNU assembler) and you're good to go.

Cody Brocious
Oh, and hi again. Apparently we're both emulator dorks on a similar sleep schedule ;)
Cody Brocious
@Cody Brocious, Hi, lol. Have you written your own disassembler or assembler? Is it worth writing either as a learning exercise? I have so many questions I want to throw your way, lol.
Simucal
I've done both on various occasions (written quite a few disasms while doing decompiler dev). Feel free to AIM me at bloomfilter to ask any questions you have.
Cody Brocious
+5  A: 

Incidentally, Spim does not require X Windows. It has a console interface as well. Run either spim or xspim.

Rob Kennedy
+3  A: 

You will need either a cross compilation toolchain, or to build your own cross binutils. For a prebuilt toolchain, you can visit code sourcery. If you just want to compile assembly, then all you need is binutils. There are some guidelines on the Linux Mips wiki

For the emulation part, QEmu would be my choice.

shodanex
Qemu + CodeSourcery fits all needs!
Nils Pipenbrinck
+1  A: 
Kim
If you ever find yourself without those, I found MARS to be much supieror to SPIM. It is a Java .jar file so it works across linux/windows. The reason I like it is it has a built in debugger and I can step through my code or codebreak, and see the value of all registers. Helps a ton in debugging.
Simucal
Thanks, that's actually what our university uses. But I wanted to be able to call c functions from assembly code and I don't think MARS supports this. ;) Also, it's nice to be able to examine the output of "gcc -S somecprog.c".
Kim
+1  A: 

You could use gxemul, which emulates a MIPS machine (among others, including Dreamcast), and is able to run many Operating systems (included linux, netbsd and some more).

gxemul-wikipedia

gxemul-home page

Tom
+1  A: 

MARS made my assembly programming for MIPS architecture so much easier. If you would like a GUI/IDE, I would recommend MARS for sure.

Derek B.