https://github.com/halaway/asm-display
https://github.com/halaway/asm-display
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/halaway/asm-display
- Owner: halaway
- License: gpl-3.0
- Created: 2024-04-21T22:55:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T03:09:32.000Z (about 2 years ago)
- Last Synced: 2025-06-04T12:55:11.288Z (about 1 year ago)
- Language: Assembly
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://courses.missouristate.edu/kenvollmar/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:
```c
struct asmInput {
unsigned w, h, l; // size parameters
unsigned bgcol; // background color
}
```
| Proposed Output | Solution |
| :------------ |:---------------:|
|
|
|
### 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.
```asm
# 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.