Git Product home page Git Product logo

asm-display's Introduction

MIPS Assembly Bitmap Display

As part of a uni architecture course, the following creates a rendering of an image on a 512 x 256 2D Bitmap display. Using the MIPS Assembler and Runtime Simulator MARS, the program uses MIPS assembly code for the MIPS Architecture- a Reduced Instruction Set Computer(RISC) with C-style structures containing 32-bit ints in the form:

struct asmInput {
  unsigned w, h, l; // size parameters
  unsigned bgcol; // background color
}
Proposed Output Solution
Screen Shot 2024-04-21 at 7 49 48 PM Screen Shot 2024-04-21 at 8 29 26 PM

Implementation

While a considerably trivial program, a requirement is to not make use of custom built-in function calls, multiplication, or division operators. Regardless, the approach was to traverse the display using the frame buffer in row-major form while calculating starting corner positions using the geometric properties of each shape when considered as a separate unit.

#   t3 - y coordinate of top left cap corner
#   t5 - base and height of trapezoid with 45-degree angles
mathPortion:	  
	addi 	$t5, $t6, -48		# $t5 ← w - 48
	srl 	$t5, $t5, 1		# $t5 ← w - 48 / 2
	add 	$t3, $t7, $t8 		# $t3 ← h + l
	add 	$t3, $t3, $t5		# $t3 ← h + l + b
  ...

Note

The program is relatively straightforward and was meant to simulate low-level programming while directly accessing and manipulating registers using the available instruction set. I genuinely hope this helps future CS students and clarifies some nuances when applying classroom theory to possible real-world examples.

asm-display's People

Contributors

halaway avatar

Watchers

 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.