-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacro_file.asm
More file actions
50 lines (37 loc) · 1004 Bytes
/
Copy pathmacro_file.asm
File metadata and controls
50 lines (37 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#/*********************************************************************
#* SAN DIEGO STATE UNIVERISTY *
#* DUC M LE 132485155
#* 44 55 43 20 4D 49 4E 48 20 4C 45 0A
#* 31 33 32 34 38 35 31 35 35 0A *
#**********************************************************************
.macro print_str_reg (%reg)
li $v0, 4
move $a0, %reg
syscall
.end_macro
.macro print_newline
li $v0, 4
la $a0, newline
syscall
.end_macro
.macro read_int (%reg)
li $v0, 5
syscall
move %reg, $v0
.end_macro
.macro delay (%time)
li $t2, %time
delay_loop:
addi $t2, $t2, -1
bnez $t2, delay_loop
.end_macro
.macro draw_pixel (%x, %y, %color)
add $a0, $0, %x
add $a1, $0, %y
add $a2, $0, %color
mul $t9, $a1, 32 # y * width (32 for 256x256 with 8x8 pixels)
add $t9, $t9, $a0
mul $t9, $t9, 4
add $t9, $t9, $gp
sw $a2, ($t9)
.end_macro