1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-14 09:09:02 -08:00
mm/asm/simple text.asm

52 lines
1.1 KiB
NASM
Raw Normal View History

2016-01-12 06:59:29 -08:00
textdata:
.word 0, 0, 0, 0, 0
simple_text:
// a0: xxxxyyyy
// a1: rrggbbaa
// a2: printf formatting string
// a3: first argument for format string (optional)
// TODO: support more than 4 args
push 4, 1, s0, s1, ra
la s0, textdata
sw a0, 32(sp)
sw a1, 36(sp)
sw a2, 40(sp)
sw a3, 44(sp)
li t0, @TxtPrinter
sw t0, 0(s0) // printer
sw r0, 4(s0) // dlist end
sh r0, 8(s0) // x
sh r0, 10(s0) // y
li t0, 0xC
sw t0, 12(s0) // unknown
sw r0, 16(s0) // color
li t0, @global_context
lw s1, 0(t0)
lw t2, @dlist_offset(s1)
2016-05-18 03:24:20 -07:00
call @DoTxtStruct, s0, t2
2016-01-12 06:59:29 -08:00
lbu a1, 36(sp)
lbu a2, 37(sp)
lbu a3, 38(sp)
lbu t1, 39(sp)
2016-05-18 03:24:20 -07:00
call @SetTextRGBA, s0, a1, a2, a3, t1
2016-01-12 06:59:29 -08:00
lh a1, 32(sp)
lh a2, 34(sp)
2016-05-18 03:24:20 -07:00
call @SetTextXY, s0, a1, a2
2016-01-12 06:59:29 -08:00
lw a1, 40(sp)
lw a2, 44(sp)
2016-05-18 03:24:20 -07:00
call @SetTextString, s0, a1, a2
2016-01-12 06:59:29 -08:00
2016-05-18 03:24:20 -07:00
call @UpdateTxtStruct, s0
2016-01-12 06:59:29 -08:00
sw v0, @dlist_offset(s1)
2016-05-18 03:24:20 -07:00
ret 4, 1, s0, s1, ra