1
0
Fork 0

add QFT-draw.s

This commit is contained in:
sup39 2023-01-29 03:51:32 +09:00
parent 408e468f91
commit 62cd98deb6
2 changed files with 98 additions and 0 deletions

5
src/QFT-draw.ld Normal file
View file

@ -0,0 +1,5 @@
$$ = 0;
/* $C2$.drawQFT = drawWater - 0x2c8; */
$C2$.drawQFT = drawWater - 0x20;
drawText = 0x817f0238;

93
src/QFT-draw.s Normal file
View file

@ -0,0 +1,93 @@
.include "./addrs.s"
/**
* 817F0110 (x, y)
* 817F0114 fontSize
* 817F0118 colorTop
* 817F011C colorBot
* 817F0120 bgColor
*/
.drawQFT:
## fill rect
lis r3, 0x817F
ori r4, r3, 0x120
addi r3, r3, 0x94
lis r12, fill_rect@ha
la r12, fill_rect@l(r12)
mtlr r12
blrl
## load time
lis r3, 0x817F
lbz r4, 0xB2(r3)
### r8 = stopped time
lwz r8, 0xB4(r3)
cmpwi r4, 0
### if not stopped
bne+ .loadTime.done
lwz r4, 0xBC(r3)
cmpwi r4, 0
### if not freezed
bne+ .updateFreezeCounter
### r8 = current time
lwz r8, gpMarDirector$r13(r13)
lwz r8, 0x5C(r8)
b .cumulateTime
.updateFreezeCounter:
subi r4, r4, 0x1
stw r4, 0xBC(r3)
### r8 = freezed time
lwz r8, 0xB8(r3)
.cumulateTime:
### r8 += cumulated time
lwz r0, 0xB4(r3)
add r8, r8, r0
.loadTime.done:
.capTimer:
lis r7, 0xA
ori r7, r7, 0xF9B0
cmpw r7, r8
bge+ .capTimer.done
mr r8, r7
stb r7, 0xB2(r3)
stw r7, 0xB4(r3)
.capTimer.done:
/**
* r3 = &opt = 817F0110
* r4 = &fmt = 817F00A4
* r5 = m
* r6 = s
* r7 = ms
*/
.drawText:
mulli r8, r8, 1001
li r0, 120
divwu r8, r8, r0
li r0, 1000
divwu r9, r8, r0
mullw r0, r9, r0
sub r7, r8, r0 # ms
li r0, 60
divwu r5, r9, r0 # m
mullw r0, r5, r0
sub r6, r9, r0 # s
lis r12, drawText@h
ori r12, r12, drawText@l
mtlr r12
addi r4, r3, 0xA4
addi r3, r3, 0x110
blrl
.restore.setup2D:
addi r3, r1, ctxSpOff
lis r12, setup2D@ha
la r12, setup2D@l(r12)
mtlr r12
blrl
.done:
#lbz r0, 0x46(r31)