Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26655

Getting to run more MIPS assembly programs?

I'd like to run more MIPS assembly programs. I can run the emulator (MARS) and I can run basic assembly programs. Now I have for instance this program to study, which is OK for my current level:

.data
prompt: .asciiz "\n Please Input a Value: "
bye: .asciiz "\n Bye!"
.globl main
.text

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

   li $v0, 5
   syscall
   beqz $v0, end
   move $a0, $v0
   li $v0, 1
   syscall
   b main


end:
   li $v0, 4
   la $a0, bye
   syscall

   li $v0, 10
   syscall

I have 2 book that discuss the theory but they are more about the electronics and how CPU is contructed and not so much teach you how to write complete programs (the books I follow are Computer Organization and Design and a book in Swedish called Datorsystem and while these books describe fairly well the background and individual instruction, I need more pointer to complete programs that I can learn from modifying, some similar simple programs with basic i/o like the one above. Since many programs in the books make assumptions that are not realistic e.g. that a certain value already is in a certain register. Practicing on the program above is really good since it is a complete program. Can you help me?

Upvotes: 1

Views: 1243

Answers (1)

markgz
markgz

Reputation: 6266

All this assumes that you want to become a competent MIPS assembly programmer:

  • See MIPS Run is the canonical book on MIPS CPUs. This book explains the MIPS instruction set, CPU architecture and how they relate to MIPS Linux.

  • Get a MIPS cross compiler toolchain, like the free Mentor/CodeSourcery toolchain, use it to compile your favorite C/C++ programs into MIPS, and study the assembler output.

  • You can download and study a MIPS port of Linux from Timesys.

  • You can find a free and complete MIPS simulator here (MARS and SPIM are not complete enough for anything more than homework problems). If you want to run MIPS programs on cheap real hardware, start with OpenWrt.

Upvotes: 3

Related Questions