Git Product home page Git Product logo

mipspatterns's Introduction

MIPSPatterns

A resource for common coding structures in MIPS.

It's often difficult to translate high level programming structures that are often delimited by punctuation or indentation into the mostly syntax-free environment that is MIPS assembly. This resource aims to provide general patterns for beginning users to adapt for their needs as well as provide explanations that allow them to combine the different structures and eventually extend them to solve more subtle problems.

In this way, these files are meant to be suggestions or aids, not rules and laws. This is not the only way to solve your problems but it can help you get started.

Each file has two versions, one in explained/ and another in simplified/. The version in explained/ contains explanation and descriptions of why and how we do things as well as where things go and what things do. The version in simplified/ has nothing but the bare minimum of comments in an effort to distill the structure. Some of the explanations are rather long so the simplified files assume you already know why something might be done in a certain way.

The content is divided up as follows:

  1. Syntax and Structure: Discusses how a MIPS assembly file is structured.
    1. Labels and Sections: Introduces data/text section and labels within each.
    2. Data Section: Introduces common data section directives.
  2. Subroutines: Discusses how to interact with basic subroutines (leaf functions).
    1. Subroutines: Introduces basic leaf functions. More advanced functions use the stack.
    2. Main: Introduces what main should look like.
  3. Conditionals: Discusses how to form basic conditional statements.
    1. If: Introduces a basic if conditional.
    2. If/Else: Introduces an if with an unconditional else block.
    3. If/Elif/Else: Introduces an if with conditional elif blocks and finally an unconditional else block.
    4. Alternate If/Elif/Else: Shows a different style of conditionals that some may prefer.
  4. Loops: Discusses how to form basic loop statements.
    1. Precondition Loop: Introduces loops with a condition check before the body.
    2. Postcondition Loop: Introduces loops with an initial guard and then a condition check after the body.
  5. Complex Conditions: Discusses how to form composite conditions.
    1. And: Introduces a two-part condition joined by an and.
    2. Or: Introduces a two-part condition joined by an or.
  6. Stack: Discusses how to interact with the stack. This topic can be more difficult than previous sections.
    1. Saved Register Calling Convention: Introduces how to manage saved registers in a subroutine.
    2. Return Address Calling Convention: Introduces how to manage the return address register when a subroutine calls other subroutines.
    3. Temporary Register Calling Convention: Introduces how to manage temporary registers that are live across subroutine calls.
    4. Single Stack Unwind: Introduces a method to simplify subroutine code by using a single exit point.
  7. Kernel: Discusses how to act as the kernel. This topic can be more difficult than previous sections as well.
    1. Sections: Introduces the new sections used when acting as the kernel.
    2. __start: Introduces the __start label and how to use it.
    3. Register Saving: Introduces how to save registers in the kernel.

Contributors

  • Braedy Kuzma

mipspatterns's People

Contributors

kuzi117 avatar karimhamdanali avatar markholmstrom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.