#Spring20 Lab5 Template File# Macro that stores the value in %reg on the stack# and moves the stack pointer..macro push(%reg)subi $sp $sp 4sw %reg 0($sp).end_macro# Macro takes the value on the top of the stack and# loads it into %reg then moves the stack pointer..macro pop(%reg)lw %reg 0($sp)addi $sp $sp 4.end_macro# Macro that takes as input coordinates in the format# (0x00XX00YY) and returns 0x
...[Show More]
#Spring20 Lab5 Template File
# Macro that stores the value in %reg on the stack
# and moves the stack pointer.
.macro push(%reg)
subi $sp $sp 4
sw %reg 0($sp)
.end_macro
# Macro takes the value on the top of the stack and
# loads it into %reg then moves the stack pointer.
.macro pop(%reg)
lw %reg 0($sp)
addi $sp $sp 4
.end_macro
# Macro that takes as input coordinates in the format
# (0x00XX00YY) and returns 0x000000XX in %x and
# returns 0x000000YY in %y
.macro getCoordinates(%input %x %y)
push(%input)
andi %y, %input, 0x000000FF
andi %x, %input, 0x00FF0000
srl %x, %input, 16
pop(%input)
.end_macro
# Macro that takes Coordinates in (%x,%y) where
# %x = 0x000000XX and %y= 0x000000YY and
# returns %output = (0x00XX00YY)
.macro formatCoordinates(%output %x %y)
push(%x)
push(%y)
sll %x, %x, 16
add %output, %x, %y
pop(%y)
pop(%x)
.end_macro
.data
originAddress: .word 0xFFFF0000
.text
j done
done: nop
li $v0 10
syscall
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Subroutines defined below
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#*****************************************************
#Clear_bitmap: Given a color, will fill the bitmap display with that color.
# Inputs:
# $a0 = Color in format (0x00RRGGBB)
# Outputs:
# No register outputs
# Side-Effects:
# Colors the Bitmap display all the same color
#*****************************************************
clear_bitmap: nop
[Show Less]