made a snafo on last commit, fixed it now
parent
eb67ac6c5e
commit
a7979dfeab
|
@ -200,7 +200,7 @@ class Assembler
|
||||||
|
|
||||||
# load immediate
|
# load immediate
|
||||||
# TODO: check if we need to use 1 or 2 ops and output that
|
# TODO: check if we need to use 1 or 2 ops and output that
|
||||||
def li(val, dest)
|
def li(dest, val)
|
||||||
lui val >> 16, dest
|
lui val >> 16, dest
|
||||||
ori dest, val, dest
|
ori dest, val, dest
|
||||||
end
|
end
|
||||||
|
|
24
main.asm.rb
24
main.asm.rb
|
@ -21,9 +21,9 @@ label :printf
|
||||||
label :draw_line
|
label :draw_line
|
||||||
# todo: draw line function, take args in a0 - a3
|
# todo: draw line function, take args in a0 - a3
|
||||||
# tood: implement shift left so we can use that to combine x and y co-ords
|
# tood: implement shift left so we can use that to combine x and y co-ords
|
||||||
li $gp0, t0
|
li t0, $gp0
|
||||||
|
|
||||||
li 0x40_ffffff, t1 # monochrome line, color ffffff
|
li t1, 0x40_ffffff # monochrome line, color ffffff
|
||||||
sw t1, 0, t0
|
sw t1, 0, t0
|
||||||
|
|
||||||
# lwi st, t1 # line vert 1
|
# lwi st, t1 # line vert 1
|
||||||
|
@ -36,27 +36,27 @@ label :start
|
||||||
nop ; nop ; nop ; nop
|
nop ; nop ; nop ; nop
|
||||||
|
|
||||||
# THIS IS NEEDED
|
# THIS IS NEEDED
|
||||||
li $gp1, t0
|
li t0, $gp1
|
||||||
li 0x03_00_00_00, t1 # display enable
|
li t1, 0x03_00_00_00 # display enable
|
||||||
sw t1, 0, t0
|
sw t1, 0, t0
|
||||||
|
|
||||||
li $gp0, t0
|
li t0, $gp0
|
||||||
|
|
||||||
li 0xe1_000000 + 0b0_0_0_1_0_01_00_0_0000, t1
|
li t1, 0xe1_000000 + 0b0_0_0_1_0_01_00_0_0000
|
||||||
sw t1, 0, t0
|
sw t1, 0, t0
|
||||||
|
|
||||||
# THIS IS NEEDED
|
# THIS IS NEEDED
|
||||||
li 0xe4_000000 + (640) + (480 << 10), t1 # Drawing Area bottom right
|
li t1, 0xe4_000000 + (640) + (480 << 10) # Drawing Area bottom right
|
||||||
sw t1, 0, t0
|
sw t1, 0, t0
|
||||||
|
|
||||||
def line(st, en)
|
def line(st, en)
|
||||||
li 0x40_ffffff, t1 # monochrome line, color ffffff
|
li t1, 0x40_ffffff # monochrome line, color ffffff
|
||||||
sw t1, 0, t0
|
sw t1, 0, t0
|
||||||
|
|
||||||
li st, t1 # line vert 1
|
li t1, st # line vert 1
|
||||||
sw t1, 0, t0
|
sw t1, 0, t0
|
||||||
|
|
||||||
li en, t1 # line vert 2
|
li t1, en # line vert 2
|
||||||
sw t1, 0, t0
|
sw t1, 0, t0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,13 +64,13 @@ label :start
|
||||||
line 0x0030_0030, 0x0060_0000
|
line 0x0030_0030, 0x0060_0000
|
||||||
line 0x0060_000a, 0x00f0_0060
|
line 0x0060_000a, 0x00f0_0060
|
||||||
|
|
||||||
li l_hello_world, a0
|
li a0, l_hello_world
|
||||||
jal l_printf
|
jal l_printf
|
||||||
addiu sp, -16, sp # delay slot
|
addiu sp, -16, sp # delay slot
|
||||||
addiu sp, 16, sp
|
addiu sp, 16, sp
|
||||||
|
|
||||||
label :end_loop
|
label :end_loop
|
||||||
li l_end_loop, t9
|
li t9, l_end_loop
|
||||||
jr t9
|
jr t9
|
||||||
nop
|
nop
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue