1
0
Fork 0

add QFST-with-index

This commit is contained in:
sup39 2022-11-02 18:25:40 +09:00
parent 39f5d7fb25
commit b9c3594778
4 changed files with 97 additions and 32 deletions

41
NTSC-J 1.0/QFST+index.txt Normal file
View file

@ -0,0 +1,41 @@
$ QF Segment Timer with index (v0.1.0, 2022/11/01) [sup39]
040F9DD0 496FDE88
042069D0 495F129C
077F7C48 00000128
2532642E 25303364
005B2530 32645D00
3BA00000 3C60817F
93A37C40 93A37C44
4A90216C 38610E90
4A83D5B9 3821FFE0
BF81000C 3C60817F
3BE37C00 83C37C40
3BA00096 80C300BC
2C060000 41A2002C
808300B8 80A37C44
7C042800 40A1001C
7C052050 57CC16BA
7C1F612E 90837C44
3BDE0001 93C37C40
3B9EFFF0 2C1E0010
40800008 3B800000
7C1CF000 41A00014
BB81000C 38210020
3C60803B 4AA0ECF0
578316BA 7C1F182E
1C0003E9 39600078
7D405B96 396003E8
7D2A5B96 1D6903E8
7D4B5050 38600214
7FA4EB78 38A0000D
38C0FFFF 7CC73378
3D00817F 61087C48
4CC63182 4BFF850D
3B9C0001 38000064
7D3C0396 7D2901D6
7D29E050 3D00817F
61087C51 386001E8
7FA4EB78 38A0000D
38C0FFFF 7CC73378
4CC63182 4BFF84D5
3BBD000D 4BFFFF64

View file

@ -1,3 +1,5 @@
.include "./macros.s"
.set x, 144 .set x, 144
.set y, 124 .set y, 124
.set fontSize, 28 .set fontSize, 28
@ -9,17 +11,6 @@
.set off$area0, 8 .set off$area0, 8
.set off$freeze, 10 .set off$freeze, 10
.macro liDX reg val
.if -0x8000 <= \val && \val < 0x8000 || 0xffff8000 <= \val
li \reg, \val@l
.else
lis \reg, \val@h
.if \val&0xffff != 0
ori \reg, \reg, \val@l
.endif
.endif
.endm
.onStart: .onStart:
.set r$$, 12 .set r$$, 12
.set off$$, off$area0 .set off$$, off$area0

View file

@ -1,10 +1,18 @@
.include "./macros.s"
.set $drawIndex$, 1
.set x, 532 .set x, 532
.set x2, 488
.set y, 150 .set y, 150
.set fontSize, 13 .set fontSize, 13
.set colorTop, 0xffffffff .set colorTop, 0xffffffff
.set colorBot, 0xffffffff .set colorBot, 0xffffffff
.set logN, 4 .set logN, 4
.draw2D.fmt: .string "%2d.%03d"
.draw2D.fmt2: .string "[%02d]"
.align 2
.set aBase, 0x817f<<16 .set aBase, 0x817f<<16
.QFST.reset: .QFST.reset:
li r29, 0 # orig li r29, 0 # orig
@ -13,13 +21,13 @@
stw r29, $QFST.t0-aBase(r3) stw r29, $QFST.t0-aBase(r3)
b 4+$b$.QFST.reset b 4+$b$.QFST.reset
.set rmw, r28 .set rmw, 28
.set rmwOff, 0xC .set rmwOff, 0xC
.set rmwAdd, 0x20 .set rmwAdd, 0x20
.set rTArr, r31 .set rTArr, 31
.set rCnt, r30 .set rCnt, 30
.set rY, r29 .set rY, 29
.set rIdx, r28 .set rIdx, 28
.QFST.render: .QFST.render:
.QFST.render.setup: .QFST.render.setup:
addi r3, r1, 0xE90 addi r3, r1, 0xE90
@ -89,28 +97,38 @@
li r3, x li r3, x
mr r4, rY mr r4, rY
li r5, fontSize li r5, fontSize
.if colorTop < 0x8000 || colorTop >= 0xffff8000 liDX r6, colorTop
li r6, colorTop@l
.else
lis r6, colorTop@h
ori r6, r6, colorTop@l
.endif
.if colorTop == colorBot .if colorTop == colorBot
mr r7, r6 mr r7, r6
.elseif colorBot < 0x8000 || colorBot >= 0xffff8000
li r7, colorBot@l
.else .else
lis r7, colorBot@h liDX r7, colorBot
ori r7, r7, colorBot@l .endif
li32 r8 .draw2D.fmt
crclr 6
bl drawText
## draw index
### r9 = (idx+1)%100
addi rIdx, rIdx, 1
.if $drawIndex$
li r0, 100
divwu r9, rIdx, r0
mullw r9, r9, r0
sub r9, rIdx, r9
### params
li32 r8 .draw2D.fmt2
li r3, x2
mr r4, rY
li r5, fontSize
liDX r6, colorTop
.if colorTop == colorBot
mr r7, r6
.else
liDX r7, colorBot
.endif .endif
bl .draw2D.fmt
.string "%2d.%03d"
.align 2
.draw2D.fmt:
mflr r8
crclr 6 crclr 6
bl drawText bl drawText
## next ## next
addi rIdx, rIdx, 1 #addi rIdx, rIdx, 1 # already added
.endif
addi rY, rY, fontSize addi rY, rY, fontSize
b .QFST.render.loop b .QFST.render.loop

15
src/macros.s Normal file
View file

@ -0,0 +1,15 @@
.macro li32 reg val
lis \reg, \val@h
ori \reg, \reg, \val@l
.endm
.macro liDX reg val
.if -0x8000 <= \val && \val < 0x8000 || 0xffff8000 <= \val
li \reg, \val@l
.else
lis \reg, \val@h
.if \val&0xffff != 0
ori \reg, \reg, \val@l
.endif
.endif
.endm