From b9c3594778f50a82027d2a5540611335da5752d7 Mon Sep 17 00:00:00 2001 From: sup39 Date: Wed, 2 Nov 2022 18:25:40 +0900 Subject: [PATCH] add QFST-with-index --- NTSC-J 1.0/QFST+index.txt | 41 ++++++++++++++++++++++++++ src/AttemptCounter.s | 13 ++------- src/QFST.s | 60 +++++++++++++++++++++++++-------------- src/macros.s | 15 ++++++++++ 4 files changed, 97 insertions(+), 32 deletions(-) create mode 100644 NTSC-J 1.0/QFST+index.txt create mode 100644 src/macros.s diff --git a/NTSC-J 1.0/QFST+index.txt b/NTSC-J 1.0/QFST+index.txt new file mode 100644 index 0000000..a206de8 --- /dev/null +++ b/NTSC-J 1.0/QFST+index.txt @@ -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 diff --git a/src/AttemptCounter.s b/src/AttemptCounter.s index 7e4d698..4bf2d67 100644 --- a/src/AttemptCounter.s +++ b/src/AttemptCounter.s @@ -1,3 +1,5 @@ +.include "./macros.s" + .set x, 144 .set y, 124 .set fontSize, 28 @@ -9,17 +11,6 @@ .set off$area0, 8 .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: .set r$$, 12 .set off$$, off$area0 diff --git a/src/QFST.s b/src/QFST.s index 0135af9..2e9c173 100644 --- a/src/QFST.s +++ b/src/QFST.s @@ -1,10 +1,18 @@ +.include "./macros.s" +.set $drawIndex$, 1 + .set x, 532 +.set x2, 488 .set y, 150 .set fontSize, 13 .set colorTop, 0xffffffff .set colorBot, 0xffffffff .set logN, 4 +.draw2D.fmt: .string "%2d.%03d" +.draw2D.fmt2: .string "[%02d]" +.align 2 + .set aBase, 0x817f<<16 .QFST.reset: li r29, 0 # orig @@ -13,13 +21,13 @@ stw r29, $QFST.t0-aBase(r3) b 4+$b$.QFST.reset -.set rmw, r28 +.set rmw, 28 .set rmwOff, 0xC .set rmwAdd, 0x20 -.set rTArr, r31 -.set rCnt, r30 -.set rY, r29 -.set rIdx, r28 +.set rTArr, 31 +.set rCnt, 30 +.set rY, 29 +.set rIdx, 28 .QFST.render: .QFST.render.setup: addi r3, r1, 0xE90 @@ -89,28 +97,38 @@ li r3, x mr r4, rY li r5, fontSize -.if colorTop < 0x8000 || colorTop >= 0xffff8000 - li r6, colorTop@l -.else - lis r6, colorTop@h - ori r6, r6, colorTop@l -.endif + liDX r6, colorTop .if colorTop == colorBot mr r7, r6 -.elseif colorBot < 0x8000 || colorBot >= 0xffff8000 - li r7, colorBot@l .else - lis r7, colorBot@h - ori r7, r7, colorBot@l + liDX r7, colorBot +.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 - bl .draw2D.fmt - .string "%2d.%03d" - .align 2 -.draw2D.fmt: - mflr r8 crclr 6 bl drawText ## next - addi rIdx, rIdx, 1 + #addi rIdx, rIdx, 1 # already added +.endif addi rY, rY, fontSize b .QFST.render.loop diff --git a/src/macros.s b/src/macros.s new file mode 100644 index 0000000..fa5f29d --- /dev/null +++ b/src/macros.s @@ -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