项目作者: PaquitoelChocolatero

项目描述 :
MIPS 32 examples and guides
高级语言: Assembly
项目地址: git://github.com/PaquitoelChocolatero/Assembly-for-beginners.git
创建时间: 2018-10-06T13:48:21Z
项目社区:https://github.com/PaquitoelChocolatero/Assembly-for-beginners

开源协议:GNU General Public License v3.0

下载


Assembly for Beginners

HitCount

In this repository you will find a beginner’s guide to MIPS programming



Every example used can be run so you can see what the output is.

Getting Started

A
ssembly files use the “.s” extension



The structure is the following:

tag , dest , rs1 , rs2



Where ‘tag’ is the desired instruction (add, li, move, etc.), ‘dest’ is the register where the result of the instruction (if it has one) goes and ‘rs1’ and ‘rs2’ are the two registers involving the operation

Compiling with QTSpim

We recommend QtSpim:

alt text

From the top you can find in orange the reset and open option. It is very important that before every compilation you restore the registers and data.

In blue there are the play, pause and stop controls, used to run the program. Followed by the step by step control (in yellow) which will be very useful when debugging.

At the bottom in green are the registers of our processor, they will be filled with whatever you load them with.

And last but not least, in red, the instructions. This is a visual way to know the current instruction, it is very useful with the step by step control in case the program isn’t working or has a bug.

Compiling with Mars

You can also use MARS. In order to execute it:

  1. java Mars

alt text

In Mars you can write your code in de Edit Window, or load your ‘.s’ file, clicking on File>Open and looking for your file. For compiling it click on Run>Assemble or use the shortcut F3. Then you will enter on the Execute window, where you can run it completely or step by step, with the green play button placed in the top.

Index of contents:

  1. Guides
  2. MIPS 101
  3. Examples

Credits: