More synthmacros, add txwin for the lulz

This commit is contained in:
Phillip Stephens 2023-02-25 20:51:09 -08:00
parent 045422bc52
commit c5a176c51b
9 changed files with 1958 additions and 124 deletions

858
asm/musyx/txwin/txwin.s Normal file
View File

@ -0,0 +1,858 @@
.include "macros.inc"
.file "txwin.c"
# 0x00000000 - 0x0000091C
.text
.balign 4
.fn winInit, global
/* 00000000 00000034 7C 08 02 A6 */ mflr r0
/* 00000004 00000038 90 01 00 04 */ stw r0, 0x4(r1)
/* 00000008 0000003C 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 0000000C 00000040 38 00 00 00 */ li r0, 0x0
/* 00000010 00000044 90 00 00 00 */ stw r0, __FirstNode@sda21(r0)
/* 00000014 00000048 38 00 00 00 */ li r0, 0x0
/* 00000018 0000004C 90 00 00 00 */ stw r0, __LastNode@sda21(r0)
/* 0000001C 00000050 38 00 00 00 */ li r0, 0x0
/* 00000020 00000054 90 00 00 00 */ stw r0, __CurrNode@sda21(r0)
/* 00000024 00000058 38 60 00 08 */ li r3, 0x8
/* 00000028 0000005C 48 00 00 01 */ bl winSetFontSize
/* 0000002C 00000060 48 00 00 01 */ bl DEMOGetRenderModeObj
/* 00000030 00000064 90 60 00 00 */ stw r3, __rmp@sda21(r0)
/* 00000034 00000068 80 00 00 00 */ lwz r0, "@13"@sda21(r0)
/* 00000038 0000006C 90 01 00 08 */ stw r0, 0x8(r1)
/* 0000003C 00000070 80 01 00 08 */ lwz r0, 0x8(r1)
/* 00000040 00000074 90 01 00 0C */ stw r0, 0xc(r1)
/* 00000044 00000078 38 61 00 0C */ addi r3, r1, 0xc
/* 00000048 0000007C 3C 80 01 00 */ lis r4, 0x100
/* 0000004C 00000080 38 84 FF FF */ addi r4, r4, -0x1
/* 00000050 00000084 48 00 00 01 */ bl GXSetCopyClear
/* 00000054 00000088 80 01 00 14 */ lwz r0, 0x14(r1)
/* 00000058 0000008C 38 21 00 10 */ addi r1, r1, 0x10
/* 0000005C 00000090 7C 08 03 A6 */ mtlr r0
/* 00000060 00000094 4E 80 00 20 */ blr
.endfn winInit
.fn winOpenWindow, global
/* 00000064 00000098 7C 08 02 A6 */ mflr r0
/* 00000068 0000009C 90 01 00 04 */ stw r0, 0x4(r1)
/* 0000006C 000000A0 94 21 FF C0 */ stwu r1, -0x40(r1)
/* 00000070 000000A4 BF 41 00 28 */ stmw r26, 0x28(r1)
/* 00000074 000000A8 3B 43 00 00 */ addi r26, r3, 0x0
/* 00000078 000000AC 3B 64 00 00 */ addi r27, r4, 0x0
/* 0000007C 000000B0 3B 85 00 00 */ addi r28, r5, 0x0
/* 00000080 000000B4 3B A6 00 00 */ addi r29, r6, 0x0
/* 00000084 000000B8 90 E1 00 18 */ stw r7, 0x18(r1)
/* 00000088 000000BC 91 01 00 1C */ stw r8, 0x1c(r1)
/* 0000008C 000000C0 91 21 00 20 */ stw r9, 0x20(r1)
/* 00000090 000000C4 3C 60 00 00 */ lis r3, ...data.0@ha
/* 00000094 000000C8 3B C3 00 00 */ addi r30, r3, ...data.0@l
/* 00000098 000000CC 7C 1A E0 00 */ cmpw r26, r28
/* 0000009C 000000D0 41 80 00 18 */ blt .L_000000B4
/* 000000A0 000000D4 38 60 00 00 */ li r3, "@19"@sda21
/* 000000A4 000000D8 38 80 00 6D */ li r4, 0x6d
/* 000000A8 000000DC 38 BE 00 00 */ addi r5, r30, 0x0
/* 000000AC 000000E0 4C C6 31 82 */ crclr 4*cr1+eq
/* 000000B0 000000E4 48 00 00 01 */ bl OSPanic
.L_000000B4:
/* 000000B4 000000E8 7C 1B E8 00 */ cmpw r27, r29
/* 000000B8 000000EC 41 80 00 18 */ blt .L_000000D0
/* 000000BC 000000F0 38 60 00 00 */ li r3, "@19"@sda21
/* 000000C0 000000F4 38 80 00 6E */ li r4, 0x6e
/* 000000C4 000000F8 38 BE 00 24 */ addi r5, r30, 0x24
/* 000000C8 000000FC 4C C6 31 82 */ crclr 4*cr1+eq
/* 000000CC 00000100 48 00 00 01 */ bl OSPanic
.L_000000D0:
/* 000000D0 00000104 80 60 00 00 */ lwz r3, __OSCurrHeap@sda21(r0)
/* 000000D4 00000108 38 80 00 4C */ li r4, 0x4c
/* 000000D8 0000010C 48 00 00 01 */ bl OSAllocFromHeap
/* 000000DC 00000110 7C 7F 1B 78 */ mr r31, r3
/* 000000E0 00000114 28 1F 00 00 */ cmplwi r31, 0x0
/* 000000E4 00000118 40 82 00 18 */ bne .L_000000FC
/* 000000E8 0000011C 38 60 00 00 */ li r3, "@19"@sda21
/* 000000EC 00000120 38 80 00 72 */ li r4, 0x72
/* 000000F0 00000124 38 BE 00 48 */ addi r5, r30, 0x48
/* 000000F4 00000128 4C C6 31 82 */ crclr 4*cr1+eq
/* 000000F8 0000012C 48 00 00 01 */ bl OSPanic
.L_000000FC:
/* 000000FC 00000130 7F E3 FB 78 */ mr r3, r31
/* 00000100 00000134 48 00 00 01 */ bl __win_add_node
/* 00000104 00000138 93 5F 00 00 */ stw r26, 0x0(r31)
/* 00000108 0000013C 93 7F 00 04 */ stw r27, 0x4(r31)
/* 0000010C 00000140 93 9F 00 08 */ stw r28, 0x8(r31)
/* 00000110 00000144 93 BF 00 0C */ stw r29, 0xc(r31)
/* 00000114 00000148 7C 7A E0 50 */ subf r3, r26, r28
/* 00000118 0000014C 38 03 00 01 */ addi r0, r3, 0x1
/* 0000011C 00000150 90 1F 00 20 */ stw r0, 0x20(r31)
/* 00000120 00000154 7C 7B E8 50 */ subf r3, r27, r29
/* 00000124 00000158 38 03 00 01 */ addi r0, r3, 0x1
/* 00000128 0000015C 90 1F 00 24 */ stw r0, 0x24(r31)
/* 0000012C 00000160 38 00 00 00 */ li r0, 0x0
/* 00000130 00000164 90 1F 00 18 */ stw r0, 0x18(r31)
/* 00000134 00000168 38 00 00 00 */ li r0, 0x0
/* 00000138 0000016C 90 1F 00 1C */ stw r0, 0x1c(r31)
/* 0000013C 00000170 80 01 00 18 */ lwz r0, 0x18(r1)
/* 00000140 00000174 90 1F 00 10 */ stw r0, 0x10(r31)
/* 00000144 00000178 80 1F 00 20 */ lwz r0, 0x20(r31)
/* 00000148 0000017C 7C 00 1E 70 */ srawi r0, r0, 3
/* 0000014C 00000180 7C 00 01 94 */ addze r0, r0
/* 00000150 00000184 90 1F 00 28 */ stw r0, 0x28(r31)
/* 00000154 00000188 80 1F 00 24 */ lwz r0, 0x24(r31)
/* 00000158 0000018C 7C 00 1E 70 */ srawi r0, r0, 3
/* 0000015C 00000190 7C 00 01 94 */ addze r0, r0
/* 00000160 00000194 90 1F 00 2C */ stw r0, 0x2c(r31)
/* 00000164 00000198 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 00000168 0000019C 90 1F 00 40 */ stw r0, 0x40(r31)
/* 0000016C 000001A0 80 01 00 20 */ lwz r0, 0x20(r1)
/* 00000170 000001A4 90 1F 00 14 */ stw r0, 0x14(r31)
/* 00000174 000001A8 7F E3 FB 78 */ mr r3, r31
/* 00000178 000001AC 80 01 00 44 */ lwz r0, 0x44(r1)
/* 0000017C 000001B0 BB 41 00 28 */ lmw r26, 0x28(r1)
/* 00000180 000001B4 38 21 00 40 */ addi r1, r1, 0x40
/* 00000184 000001B8 7C 08 03 A6 */ mtlr r0
/* 00000188 000001BC 4E 80 00 20 */ blr
.endfn winOpenWindow
.fn winOpenLogWindow, global
/* 0000018C 000001C0 7C 08 02 A6 */ mflr r0
/* 00000190 000001C4 90 01 00 04 */ stw r0, 0x4(r1)
/* 00000194 000001C8 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 00000198 000001CC BF C1 00 28 */ stmw r30, 0x28(r1)
/* 0000019C 000001D0 90 61 00 08 */ stw r3, 0x8(r1)
/* 000001A0 000001D4 90 81 00 0C */ stw r4, 0xc(r1)
/* 000001A4 000001D8 90 A1 00 10 */ stw r5, 0x10(r1)
/* 000001A8 000001DC 90 C1 00 14 */ stw r6, 0x14(r1)
/* 000001AC 000001E0 90 E1 00 18 */ stw r7, 0x18(r1)
/* 000001B0 000001E4 B1 01 00 1C */ sth r8, 0x1c(r1)
/* 000001B4 000001E8 80 61 00 08 */ lwz r3, 0x8(r1)
/* 000001B8 000001EC 80 81 00 0C */ lwz r4, 0xc(r1)
/* 000001BC 000001F0 80 A1 00 10 */ lwz r5, 0x10(r1)
/* 000001C0 000001F4 80 C1 00 14 */ lwz r6, 0x14(r1)
/* 000001C4 000001F8 80 E1 00 18 */ lwz r7, 0x18(r1)
/* 000001C8 000001FC 39 00 00 00 */ li r8, 0x0
/* 000001CC 00000200 39 20 00 00 */ li r9, 0x0
/* 000001D0 00000204 48 00 00 01 */ bl winOpenWindow
/* 000001D4 00000208 7C 7F 1B 78 */ mr r31, r3
/* 000001D8 0000020C 3C 60 00 00 */ lis r3, __win_log_refresh@ha
/* 000001DC 00000210 38 03 00 00 */ addi r0, r3, __win_log_refresh@l
/* 000001E0 00000214 90 1F 00 40 */ stw r0, 0x40(r31)
/* 000001E4 00000218 38 00 00 01 */ li r0, 0x1
/* 000001E8 0000021C 90 1F 00 14 */ stw r0, 0x14(r31)
/* 000001EC 00000220 38 00 00 00 */ li r0, 0x0
/* 000001F0 00000224 B0 1F 00 3A */ sth r0, 0x3a(r31)
/* 000001F4 00000228 38 00 00 00 */ li r0, 0x0
/* 000001F8 0000022C B0 1F 00 3C */ sth r0, 0x3c(r31)
/* 000001FC 00000230 80 1F 00 2C */ lwz r0, 0x2c(r31)
/* 00000200 00000234 54 03 04 3E */ clrlwi r3, r0, 16
/* 00000204 00000238 A0 01 00 1C */ lhz r0, 0x1c(r1)
/* 00000208 0000023C 7C 03 02 14 */ add r0, r3, r0
/* 0000020C 00000240 B0 1F 00 38 */ sth r0, 0x38(r31)
/* 00000210 00000244 80 60 00 00 */ lwz r3, __OSCurrHeap@sda21(r0)
/* 00000214 00000248 A0 1F 00 38 */ lhz r0, 0x38(r31)
/* 00000218 0000024C 54 04 10 3A */ slwi r4, r0, 2
/* 0000021C 00000250 48 00 00 01 */ bl OSAllocFromHeap
/* 00000220 00000254 90 7F 00 34 */ stw r3, 0x34(r31)
/* 00000224 00000258 80 1F 00 34 */ lwz r0, 0x34(r31)
/* 00000228 0000025C 28 00 00 00 */ cmplwi r0, 0x0
/* 0000022C 00000260 40 82 00 1C */ bne .L_00000248
/* 00000230 00000264 38 60 00 00 */ li r3, "@19"@sda21
/* 00000234 00000268 38 80 00 C1 */ li r4, 0xc1
/* 00000238 0000026C 3C A0 00 00 */ lis r5, "@29"@ha
/* 0000023C 00000270 38 A5 00 00 */ addi r5, r5, "@29"@l
/* 00000240 00000274 4C C6 31 82 */ crclr 4*cr1+eq
/* 00000244 00000278 48 00 00 01 */ bl OSPanic
.L_00000248:
/* 00000248 0000027C 3B C0 00 00 */ li r30, 0x0
/* 0000024C 00000280 48 00 00 6C */ b .L_000002B8
.L_00000250:
/* 00000250 00000284 80 60 00 00 */ lwz r3, __OSCurrHeap@sda21(r0)
/* 00000254 00000288 80 9F 00 28 */ lwz r4, 0x28(r31)
/* 00000258 0000028C 38 84 00 01 */ addi r4, r4, 0x1
/* 0000025C 00000290 48 00 00 01 */ bl OSAllocFromHeap
/* 00000260 00000294 80 9F 00 34 */ lwz r4, 0x34(r31)
/* 00000264 00000298 57 C0 13 BA */ clrlslwi r0, r30, 16, 2
/* 00000268 0000029C 7C 64 01 2E */ stwx r3, r4, r0
/* 0000026C 000002A0 80 7F 00 34 */ lwz r3, 0x34(r31)
/* 00000270 000002A4 57 C0 13 BA */ clrlslwi r0, r30, 16, 2
/* 00000274 000002A8 7C 63 00 2E */ lwzx r3, r3, r0
/* 00000278 000002AC 38 80 00 00 */ li r4, 0x0
/* 0000027C 000002B0 80 BF 00 28 */ lwz r5, 0x28(r31)
/* 00000280 000002B4 38 A5 00 01 */ addi r5, r5, 0x1
/* 00000284 000002B8 48 00 00 01 */ bl memset
/* 00000288 000002BC 80 7F 00 34 */ lwz r3, 0x34(r31)
/* 0000028C 000002C0 57 C0 13 BA */ clrlslwi r0, r30, 16, 2
/* 00000290 000002C4 7C 03 00 2E */ lwzx r0, r3, r0
/* 00000294 000002C8 28 00 00 00 */ cmplwi r0, 0x0
/* 00000298 000002CC 40 82 00 1C */ bne .L_000002B4
/* 0000029C 000002D0 38 60 00 00 */ li r3, "@19"@sda21
/* 000002A0 000002D4 38 80 00 C9 */ li r4, 0xc9
/* 000002A4 000002D8 3C A0 00 00 */ lis r5, "@30"@ha
/* 000002A8 000002DC 38 A5 00 00 */ addi r5, r5, "@30"@l
/* 000002AC 000002E0 4C C6 31 82 */ crclr 4*cr1+eq
/* 000002B0 000002E4 48 00 00 01 */ bl OSPanic
.L_000002B4:
/* 000002B4 000002E8 3B DE 00 01 */ addi r30, r30, 0x1
.L_000002B8:
/* 000002B8 000002EC 57 C3 04 3E */ clrlwi r3, r30, 16
/* 000002BC 000002F0 A0 1F 00 38 */ lhz r0, 0x38(r31)
/* 000002C0 000002F4 7C 03 00 40 */ cmplw r3, r0
/* 000002C4 000002F8 41 80 FF 8C */ blt .L_00000250
/* 000002C8 000002FC 7F E3 FB 78 */ mr r3, r31
/* 000002CC 00000300 80 01 00 34 */ lwz r0, 0x34(r1)
/* 000002D0 00000304 BB C1 00 28 */ lmw r30, 0x28(r1)
/* 000002D4 00000308 38 21 00 30 */ addi r1, r1, 0x30
/* 000002D8 0000030C 7C 08 03 A6 */ mtlr r0
/* 000002DC 00000310 4E 80 00 20 */ blr
.endfn winOpenLogWindow
.fn winPrintfXY, global
/* 000002E0 00000314 7C 08 02 A6 */ mflr r0
/* 000002E4 00000318 90 01 00 04 */ stw r0, 0x4(r1)
/* 000002E8 0000031C 94 21 FE F0 */ stwu r1, -0x110(r1)
/* 000002EC 00000320 BF 81 01 00 */ stmw r28, 0x100(r1)
/* 000002F0 00000324 40 86 00 24 */ bne cr1, .L_00000314
/* 000002F4 00000328 D8 21 00 28 */ stfd f1, 0x28(r1)
/* 000002F8 0000032C D8 41 00 30 */ stfd f2, 0x30(r1)
/* 000002FC 00000330 D8 61 00 38 */ stfd f3, 0x38(r1)
/* 00000300 00000334 D8 81 00 40 */ stfd f4, 0x40(r1)
/* 00000304 00000338 D8 A1 00 48 */ stfd f5, 0x48(r1)
/* 00000308 0000033C D8 C1 00 50 */ stfd f6, 0x50(r1)
/* 0000030C 00000340 D8 E1 00 58 */ stfd f7, 0x58(r1)
/* 00000310 00000344 D9 01 00 60 */ stfd f8, 0x60(r1)
.L_00000314:
/* 00000314 00000348 90 61 00 08 */ stw r3, 0x8(r1)
/* 00000318 0000034C 90 81 00 0C */ stw r4, 0xc(r1)
/* 0000031C 00000350 90 A1 00 10 */ stw r5, 0x10(r1)
/* 00000320 00000354 90 C1 00 14 */ stw r6, 0x14(r1)
/* 00000324 00000358 90 E1 00 18 */ stw r7, 0x18(r1)
/* 00000328 0000035C 91 01 00 1C */ stw r8, 0x1c(r1)
/* 0000032C 00000360 91 21 00 20 */ stw r9, 0x20(r1)
/* 00000330 00000364 91 41 00 24 */ stw r10, 0x24(r1)
/* 00000334 00000368 7C 7F 1B 78 */ mr r31, r3
/* 00000338 0000036C B0 81 00 6C */ sth r4, 0x6c(r1)
/* 0000033C 00000370 B0 A1 00 6E */ sth r5, 0x6e(r1)
/* 00000340 00000374 7C DC 33 78 */ mr r28, r6
/* 00000344 00000378 3C 00 04 00 */ lis r0, 0x400
/* 00000348 0000037C 90 01 00 F4 */ stw r0, 0xf4(r1)
/* 0000034C 00000380 38 01 01 18 */ addi r0, r1, 0x118
/* 00000350 00000384 90 01 00 F8 */ stw r0, 0xf8(r1)
/* 00000354 00000388 38 01 00 08 */ addi r0, r1, 0x8
/* 00000358 0000038C 90 01 00 FC */ stw r0, 0xfc(r1)
/* 0000035C 00000390 38 61 00 74 */ addi r3, r1, 0x74
/* 00000360 00000394 38 9C 00 00 */ addi r4, r28, 0x0
/* 00000364 00000398 38 A1 00 F4 */ addi r5, r1, 0xf4
/* 00000368 0000039C 48 00 00 01 */ bl vsprintf
/* 0000036C 000003A0 38 61 00 74 */ addi r3, r1, 0x74
/* 00000370 000003A4 48 00 00 01 */ bl strlen
/* 00000374 000003A8 80 1F 00 28 */ lwz r0, 0x28(r31)
/* 00000378 000003AC 7C 03 00 40 */ cmplw r3, r0
/* 0000037C 000003B0 40 81 00 14 */ ble .L_00000390
/* 00000380 000003B4 38 80 00 00 */ li r4, 0x0
/* 00000384 000003B8 80 1F 00 28 */ lwz r0, 0x28(r31)
/* 00000388 000003BC 38 61 00 74 */ addi r3, r1, 0x74
/* 0000038C 000003C0 7C 83 01 AE */ stbx r4, r3, r0
.L_00000390:
/* 00000390 000003C4 80 7F 00 00 */ lwz r3, 0x0(r31)
/* 00000394 000003C8 A8 01 00 6C */ lha r0, 0x6c(r1)
/* 00000398 000003CC 54 00 18 38 */ slwi r0, r0, 3
/* 0000039C 000003D0 7F C3 02 14 */ add r30, r3, r0
/* 000003A0 000003D4 80 7F 00 04 */ lwz r3, 0x4(r31)
/* 000003A4 000003D8 A8 01 00 6E */ lha r0, 0x6e(r1)
/* 000003A8 000003DC 54 00 18 38 */ slwi r0, r0, 3
/* 000003AC 000003E0 7F A3 02 14 */ add r29, r3, r0
/* 000003B0 000003E4 38 7E 00 00 */ addi r3, r30, 0x0
/* 000003B4 000003E8 38 9D 00 00 */ addi r4, r29, 0x0
/* 000003B8 000003EC 38 A0 00 00 */ li r5, 0x0
/* 000003BC 000003F0 38 C0 00 00 */ li r6, "@34"@sda21
/* 000003C0 000003F4 38 E1 00 74 */ addi r7, r1, 0x74
/* 000003C4 000003F8 4C C6 31 82 */ crclr 4*cr1+eq
/* 000003C8 000003FC 48 00 00 01 */ bl DEMOPrintf
/* 000003CC 00000400 80 01 01 14 */ lwz r0, 0x114(r1)
/* 000003D0 00000404 BB 81 01 00 */ lmw r28, 0x100(r1)
/* 000003D4 00000408 38 21 01 10 */ addi r1, r1, 0x110
/* 000003D8 0000040C 7C 08 03 A6 */ mtlr r0
/* 000003DC 00000410 4E 80 00 20 */ blr
.endfn winPrintfXY
.fn winLogPrintf, global
/* 000003E0 00000414 7C 08 02 A6 */ mflr r0
/* 000003E4 00000418 90 01 00 04 */ stw r0, 0x4(r1)
/* 000003E8 0000041C 94 21 FE F8 */ stwu r1, -0x108(r1)
/* 000003EC 00000420 BF C1 01 00 */ stmw r30, 0x100(r1)
/* 000003F0 00000424 40 86 00 24 */ bne cr1, .L_00000414
/* 000003F4 00000428 D8 21 00 28 */ stfd f1, 0x28(r1)
/* 000003F8 0000042C D8 41 00 30 */ stfd f2, 0x30(r1)
/* 000003FC 00000430 D8 61 00 38 */ stfd f3, 0x38(r1)
/* 00000400 00000434 D8 81 00 40 */ stfd f4, 0x40(r1)
/* 00000404 00000438 D8 A1 00 48 */ stfd f5, 0x48(r1)
/* 00000408 0000043C D8 C1 00 50 */ stfd f6, 0x50(r1)
/* 0000040C 00000440 D8 E1 00 58 */ stfd f7, 0x58(r1)
/* 00000410 00000444 D9 01 00 60 */ stfd f8, 0x60(r1)
.L_00000414:
/* 00000414 00000448 90 61 00 08 */ stw r3, 0x8(r1)
/* 00000418 0000044C 90 81 00 0C */ stw r4, 0xc(r1)
/* 0000041C 00000450 90 A1 00 10 */ stw r5, 0x10(r1)
/* 00000420 00000454 90 C1 00 14 */ stw r6, 0x14(r1)
/* 00000424 00000458 90 E1 00 18 */ stw r7, 0x18(r1)
/* 00000428 0000045C 91 01 00 1C */ stw r8, 0x1c(r1)
/* 0000042C 00000460 91 21 00 20 */ stw r9, 0x20(r1)
/* 00000430 00000464 91 41 00 24 */ stw r10, 0x24(r1)
/* 00000434 00000468 3B E3 00 00 */ addi r31, r3, 0x0
/* 00000438 0000046C 3B C4 00 00 */ addi r30, r4, 0x0
/* 0000043C 00000470 3C 00 02 00 */ lis r0, 0x200
/* 00000440 00000474 90 01 00 F0 */ stw r0, 0xf0(r1)
/* 00000444 00000478 38 01 01 10 */ addi r0, r1, 0x110
/* 00000448 0000047C 90 01 00 F4 */ stw r0, 0xf4(r1)
/* 0000044C 00000480 38 01 00 08 */ addi r0, r1, 0x8
/* 00000450 00000484 90 01 00 F8 */ stw r0, 0xf8(r1)
/* 00000454 00000488 38 61 00 70 */ addi r3, r1, 0x70
/* 00000458 0000048C 38 9E 00 00 */ addi r4, r30, 0x0
/* 0000045C 00000490 38 A1 00 F0 */ addi r5, r1, 0xf0
/* 00000460 00000494 48 00 00 01 */ bl vsprintf
/* 00000464 00000498 38 61 00 70 */ addi r3, r1, 0x70
/* 00000468 0000049C 48 00 00 01 */ bl strlen
/* 0000046C 000004A0 80 1F 00 28 */ lwz r0, 0x28(r31)
/* 00000470 000004A4 7C 03 00 40 */ cmplw r3, r0
/* 00000474 000004A8 40 81 00 14 */ ble .L_00000488
/* 00000478 000004AC 38 80 00 00 */ li r4, 0x0
/* 0000047C 000004B0 80 1F 00 28 */ lwz r0, 0x28(r31)
/* 00000480 000004B4 38 61 00 70 */ addi r3, r1, 0x70
/* 00000484 000004B8 7C 83 01 AE */ stbx r4, r3, r0
.L_00000488:
/* 00000488 000004BC 80 7F 00 34 */ lwz r3, 0x34(r31)
/* 0000048C 000004C0 A0 1F 00 3A */ lhz r0, 0x3a(r31)
/* 00000490 000004C4 54 00 10 3A */ slwi r0, r0, 2
/* 00000494 000004C8 7C 63 00 2E */ lwzx r3, r3, r0
/* 00000498 000004CC 38 81 00 70 */ addi r4, r1, 0x70
/* 0000049C 000004D0 48 00 00 01 */ bl strcpy
/* 000004A0 000004D4 A0 7F 00 3A */ lhz r3, 0x3a(r31)
/* 000004A4 000004D8 38 83 00 01 */ addi r4, r3, 0x1
/* 000004A8 000004DC A0 7F 00 38 */ lhz r3, 0x38(r31)
/* 000004AC 000004E0 7C 04 1B D6 */ divw r0, r4, r3
/* 000004B0 000004E4 7C 00 19 D6 */ mullw r0, r0, r3
/* 000004B4 000004E8 7C 60 20 50 */ subf r3, r0, r4
/* 000004B8 000004EC B0 7F 00 3A */ sth r3, 0x3a(r31)
/* 000004BC 000004F0 80 01 01 0C */ lwz r0, 0x10c(r1)
/* 000004C0 000004F4 BB C1 01 00 */ lmw r30, 0x100(r1)
/* 000004C4 000004F8 38 21 01 08 */ addi r1, r1, 0x108
/* 000004C8 000004FC 7C 08 03 A6 */ mtlr r0
/* 000004CC 00000500 4E 80 00 20 */ blr
.endfn winLogPrintf
.fn winClearLogWindow, global
/* 000004D0 00000504 7C 08 02 A6 */ mflr r0
/* 000004D4 00000508 90 01 00 04 */ stw r0, 0x4(r1)
/* 000004D8 0000050C 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 000004DC 00000510 BF C1 00 10 */ stmw r30, 0x10(r1)
/* 000004E0 00000514 7C 7F 1B 78 */ mr r31, r3
/* 000004E4 00000518 3B C0 00 00 */ li r30, 0x0
/* 000004E8 0000051C 48 00 00 24 */ b .L_0000050C
.L_000004EC:
/* 000004EC 00000520 80 7F 00 34 */ lwz r3, 0x34(r31)
/* 000004F0 00000524 57 C0 13 BA */ clrlslwi r0, r30, 16, 2
/* 000004F4 00000528 7C 63 00 2E */ lwzx r3, r3, r0
/* 000004F8 0000052C 38 80 00 00 */ li r4, 0x0
/* 000004FC 00000530 80 BF 00 28 */ lwz r5, 0x28(r31)
/* 00000500 00000534 38 A5 00 01 */ addi r5, r5, 0x1
/* 00000504 00000538 48 00 00 01 */ bl memset
/* 00000508 0000053C 3B DE 00 01 */ addi r30, r30, 0x1
.L_0000050C:
/* 0000050C 00000540 57 C3 04 3E */ clrlwi r3, r30, 16
/* 00000510 00000544 A0 1F 00 38 */ lhz r0, 0x38(r31)
/* 00000514 00000548 7C 03 00 40 */ cmplw r3, r0
/* 00000518 0000054C 41 80 FF D4 */ blt .L_000004EC
/* 0000051C 00000550 38 00 00 00 */ li r0, 0x0
/* 00000520 00000554 B0 1F 00 3A */ sth r0, 0x3a(r31)
/* 00000524 00000558 38 00 00 00 */ li r0, 0x0
/* 00000528 0000055C B0 1F 00 3C */ sth r0, 0x3c(r31)
/* 0000052C 00000560 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 00000530 00000564 BB C1 00 10 */ lmw r30, 0x10(r1)
/* 00000534 00000568 38 21 00 18 */ addi r1, r1, 0x18
/* 00000538 0000056C 7C 08 03 A6 */ mtlr r0
/* 0000053C 00000570 4E 80 00 20 */ blr
.fn winSetFontSize, global
.endfn winClearLogWindow
/* 00000540 00000574 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 00000544 00000578 54 60 04 3E */ clrlwi r0, r3, 16
/* 00000548 0000057C 28 00 00 08 */ cmplwi r0, 0x8
/* 0000054C 00000580 41 80 00 84 */ blt .L_000005D0
/* 00000550 00000584 54 60 04 3E */ clrlwi r0, r3, 16
/* 00000554 00000588 28 00 00 28 */ cmplwi r0, 0x28
/* 00000558 0000058C 41 81 00 78 */ bgt .L_000005D0
/* 0000055C 00000590 C8 60 00 00 */ lfd f3, "@49"@sda21(r0)
/* 00000560 00000594 C8 40 00 00 */ lfd f2, "@50"@sda21(r0)
/* 00000564 00000598 54 60 04 3E */ clrlwi r0, r3, 16
/* 00000568 0000059C C8 20 00 00 */ lfd f1, "@53"@sda21(r0)
/* 0000056C 000005A0 90 01 00 2C */ stw r0, 0x2c(r1)
/* 00000570 000005A4 3C 00 43 30 */ lis r0, 0x4330
/* 00000574 000005A8 90 01 00 28 */ stw r0, 0x28(r1)
/* 00000578 000005AC C8 01 00 28 */ lfd f0, 0x28(r1)
/* 0000057C 000005B0 EC 00 08 28 */ fsubs f0, f0, f1
/* 00000580 000005B4 FC 02 00 24 */ fdiv f0, f2, f0
/* 00000584 000005B8 FC 03 00 32 */ fmul f0, f3, f0
/* 00000588 000005BC FC 00 00 1E */ fctiwz f0, f0
/* 0000058C 000005C0 D8 01 00 20 */ stfd f0, 0x20(r1)
/* 00000590 000005C4 80 01 00 24 */ lwz r0, 0x24(r1)
/* 00000594 000005C8 B0 00 00 00 */ sth r0, __X_Res@sda21(r0)
/* 00000598 000005CC C8 40 00 00 */ lfd f2, "@51"@sda21(r0)
/* 0000059C 000005D0 A0 00 00 00 */ lhz r0, __X_Res@sda21(r0)
/* 000005A0 000005D4 C8 20 00 00 */ lfd f1, "@53"@sda21(r0)
/* 000005A4 000005D8 90 01 00 1C */ stw r0, 0x1c(r1)
/* 000005A8 000005DC 3C 00 43 30 */ lis r0, 0x4330
/* 000005AC 000005E0 90 01 00 18 */ stw r0, 0x18(r1)
/* 000005B0 000005E4 C8 01 00 18 */ lfd f0, 0x18(r1)
/* 000005B4 000005E8 EC 00 08 28 */ fsubs f0, f0, f1
/* 000005B8 000005EC FC 02 00 32 */ fmul f0, f2, f0
/* 000005BC 000005F0 FC 00 00 1E */ fctiwz f0, f0
/* 000005C0 000005F4 D8 01 00 10 */ stfd f0, 0x10(r1)
/* 000005C4 000005F8 80 01 00 14 */ lwz r0, 0x14(r1)
/* 000005C8 000005FC B0 00 00 00 */ sth r0, __Y_Res@sda21(r0)
/* 000005CC 00000600 48 00 00 14 */ b .L_000005E0
.L_000005D0:
/* 000005D0 00000604 38 00 02 80 */ li r0, 0x280
/* 000005D4 00000608 B0 00 00 00 */ sth r0, __X_Res@sda21(r0)
/* 000005D8 0000060C 38 00 01 E0 */ li r0, 0x1e0
/* 000005DC 00000610 B0 00 00 00 */ sth r0, __Y_Res@sda21(r0)
.L_000005E0:
/* 000005E0 00000614 38 21 00 30 */ addi r1, r1, 0x30
/* 000005E4 00000618 4E 80 00 20 */ blr
.endfn winSetFontSize
.fn winRefresh, global
/* 000005E8 0000061C 7C 08 02 A6 */ mflr r0
/* 000005EC 00000620 90 01 00 04 */ stw r0, 0x4(r1)
/* 000005F0 00000624 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 000005F4 00000628 93 E1 00 0C */ stw r31, 0xc(r1)
/* 000005F8 0000062C 80 00 00 00 */ lwz r0, __FirstNode@sda21(r0)
/* 000005FC 00000630 28 00 00 00 */ cmplwi r0, 0x0
/* 00000600 00000634 40 82 00 1C */ bne .L_0000061C
/* 00000604 00000638 38 60 00 00 */ li r3, "@19"@sda21
/* 00000608 0000063C 38 80 01 52 */ li r4, 0x152
/* 0000060C 00000640 3C A0 00 00 */ lis r5, "@64"@ha
/* 00000610 00000644 38 A5 00 00 */ addi r5, r5, "@64"@l
/* 00000614 00000648 4C C6 31 82 */ crclr 4*cr1+eq
/* 00000618 0000064C 48 00 00 01 */ bl OSPanic
.L_0000061C:
/* 0000061C 00000650 83 E0 00 00 */ lwz r31, __FirstNode@sda21(r0)
/* 00000620 00000654 38 60 00 02 */ li r3, 0x2
/* 00000624 00000658 A0 80 00 00 */ lhz r4, __X_Res@sda21(r0)
/* 00000628 0000065C A0 A0 00 00 */ lhz r5, __Y_Res@sda21(r0)
/* 0000062C 00000660 48 00 00 01 */ bl DEMOInitCaption
/* 00000630 00000664 48 00 00 24 */ b .L_00000654
.L_00000634:
/* 00000634 00000668 80 1F 00 40 */ lwz r0, 0x40(r31)
/* 00000638 0000066C 28 00 00 00 */ cmplwi r0, 0x0
/* 0000063C 00000670 41 82 00 14 */ beq .L_00000650
/* 00000640 00000674 7F E3 FB 78 */ mr r3, r31
/* 00000644 00000678 81 9F 00 40 */ lwz r12, 0x40(r31)
/* 00000648 0000067C 7D 88 03 A6 */ mtlr r12
/* 0000064C 00000680 4E 80 00 21 */ blrl
.L_00000650:
/* 00000650 00000684 83 FF 00 44 */ lwz r31, 0x44(r31)
.L_00000654:
/* 00000654 00000688 28 1F 00 00 */ cmplwi r31, 0x0
/* 00000658 0000068C 40 82 FF DC */ bne .L_00000634
/* 0000065C 00000690 80 01 00 14 */ lwz r0, 0x14(r1)
/* 00000660 00000694 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 00000664 00000698 38 21 00 10 */ addi r1, r1, 0x10
/* 00000668 0000069C 7C 08 03 A6 */ mtlr r0
/* 0000066C 000006A0 4E 80 00 20 */ blr
.fn __win_add_node, local
.endfn winRefresh
/* 00000670 000006A4 7C 08 02 A6 */ mflr r0
/* 00000674 000006A8 90 01 00 04 */ stw r0, 0x4(r1)
/* 00000678 000006AC 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 0000067C 000006B0 93 E1 00 14 */ stw r31, 0x14(r1)
/* 00000680 000006B4 7C 7F 1B 78 */ mr r31, r3
/* 00000684 000006B8 28 1F 00 00 */ cmplwi r31, 0x0
/* 00000688 000006BC 40 82 00 1C */ bne .L_000006A4
/* 0000068C 000006C0 38 60 00 00 */ li r3, "@19"@sda21
/* 00000690 000006C4 38 80 01 86 */ li r4, 0x186
/* 00000694 000006C8 3C A0 00 00 */ lis r5, "@69"@ha
/* 00000698 000006CC 38 A5 00 00 */ addi r5, r5, "@69"@l
/* 0000069C 000006D0 4C C6 31 82 */ crclr 4*cr1+eq
/* 000006A0 000006D4 48 00 00 01 */ bl OSPanic
.L_000006A4:
/* 000006A4 000006D8 38 60 00 00 */ li r3, 0x0
/* 000006A8 000006DC 80 00 00 00 */ lwz r0, __LastNode@sda21(r0)
/* 000006AC 000006E0 7C 03 00 40 */ cmplw r3, r0
/* 000006B0 000006E4 40 82 00 48 */ bne .L_000006F8
/* 000006B4 000006E8 93 E0 00 00 */ stw r31, __CurrNode@sda21(r0)
/* 000006B8 000006EC 93 E0 00 00 */ stw r31, __LastNode@sda21(r0)
/* 000006BC 000006F0 93 E0 00 00 */ stw r31, __FirstNode@sda21(r0)
/* 000006C0 000006F4 38 00 00 00 */ li r0, 0x0
/* 000006C4 000006F8 90 1F 00 44 */ stw r0, 0x44(r31)
/* 000006C8 000006FC 38 00 00 00 */ li r0, 0x0
/* 000006CC 00000700 90 1F 00 48 */ stw r0, 0x48(r31)
/* 000006D0 00000704 80 00 00 00 */ lwz r0, __FirstNode@sda21(r0)
/* 000006D4 00000708 28 00 00 00 */ cmplwi r0, 0x0
/* 000006D8 0000070C 40 82 00 3C */ bne .L_00000714
/* 000006DC 00000710 38 60 00 00 */ li r3, "@19"@sda21
/* 000006E0 00000714 38 80 01 94 */ li r4, 0x194
/* 000006E4 00000718 3C A0 00 00 */ lis r5, "@70"@ha
/* 000006E8 0000071C 38 A5 00 00 */ addi r5, r5, "@70"@l
/* 000006EC 00000720 4C C6 31 82 */ crclr 4*cr1+eq
/* 000006F0 00000724 48 00 00 01 */ bl OSPanic
/* 000006F4 00000728 48 00 00 20 */ b .L_00000714
.L_000006F8:
/* 000006F8 0000072C 80 60 00 00 */ lwz r3, __LastNode@sda21(r0)
/* 000006FC 00000730 93 E3 00 44 */ stw r31, 0x44(r3)
/* 00000700 00000734 38 00 00 00 */ li r0, 0x0
/* 00000704 00000738 90 1F 00 44 */ stw r0, 0x44(r31)
/* 00000708 0000073C 80 00 00 00 */ lwz r0, __LastNode@sda21(r0)
/* 0000070C 00000740 90 1F 00 48 */ stw r0, 0x48(r31)
/* 00000710 00000744 93 E0 00 00 */ stw r31, __LastNode@sda21(r0)
.L_00000714:
/* 00000714 00000748 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 00000718 0000074C 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 0000071C 00000750 38 21 00 18 */ addi r1, r1, 0x18
/* 00000720 00000754 7C 08 03 A6 */ mtlr r0
/* 00000724 00000758 4E 80 00 20 */ blr
.endfn __win_add_node
.fn __win_delete_node, local
/* 00000728 0000075C 7C 08 02 A6 */ mflr r0
/* 0000072C 00000760 90 01 00 04 */ stw r0, 0x4(r1)
/* 00000730 00000764 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 00000734 00000768 93 E1 00 14 */ stw r31, 0x14(r1)
/* 00000738 0000076C 7C 7F 1B 78 */ mr r31, r3
/* 0000073C 00000770 28 1F 00 00 */ cmplwi r31, 0x0
/* 00000740 00000774 40 82 00 1C */ bne .L_0000075C
/* 00000744 00000778 38 60 00 00 */ li r3, "@19"@sda21
/* 00000748 0000077C 38 80 01 B2 */ li r4, 0x1b2
/* 0000074C 00000780 3C A0 00 00 */ lis r5, "@84"@ha
/* 00000750 00000784 38 A5 00 00 */ addi r5, r5, "@84"@l
/* 00000754 00000788 4C C6 31 82 */ crclr 4*cr1+eq
/* 00000758 0000078C 48 00 00 01 */ bl OSPanic
.L_0000075C:
/* 0000075C 00000790 80 00 00 00 */ lwz r0, __FirstNode@sda21(r0)
/* 00000760 00000794 7C 00 F8 40 */ cmplw r0, r31
/* 00000764 00000798 40 82 00 50 */ bne .L_000007B4
/* 00000768 0000079C 80 1F 00 44 */ lwz r0, 0x44(r31)
/* 0000076C 000007A0 28 00 00 00 */ cmplwi r0, 0x0
/* 00000770 000007A4 41 82 00 28 */ beq .L_00000798
/* 00000774 000007A8 80 1F 00 44 */ lwz r0, 0x44(r31)
/* 00000778 000007AC 90 00 00 00 */ stw r0, __FirstNode@sda21(r0)
/* 0000077C 000007B0 38 00 00 00 */ li r0, 0x0
/* 00000780 000007B4 80 7F 00 44 */ lwz r3, 0x44(r31)
/* 00000784 000007B8 90 03 00 48 */ stw r0, 0x48(r3)
/* 00000788 000007BC 80 60 00 00 */ lwz r3, __OSCurrHeap@sda21(r0)
/* 0000078C 000007C0 7F E4 FB 78 */ mr r4, r31
/* 00000790 000007C4 48 00 00 01 */ bl OSFreeToHeap
/* 00000794 000007C8 48 00 00 9C */ b .L_00000830
.L_00000798:
/* 00000798 000007CC 38 00 00 00 */ li r0, 0x0
/* 0000079C 000007D0 90 00 00 00 */ stw r0, __LastNode@sda21(r0)
/* 000007A0 000007D4 90 00 00 00 */ stw r0, __FirstNode@sda21(r0)
/* 000007A4 000007D8 80 60 00 00 */ lwz r3, __OSCurrHeap@sda21(r0)
/* 000007A8 000007DC 7F E4 FB 78 */ mr r4, r31
/* 000007AC 000007E0 48 00 00 01 */ bl OSFreeToHeap
/* 000007B0 000007E4 48 00 00 80 */ b .L_00000830
.L_000007B4:
/* 000007B4 000007E8 80 00 00 00 */ lwz r0, __LastNode@sda21(r0)
/* 000007B8 000007EC 7C 00 F8 40 */ cmplw r0, r31
/* 000007BC 000007F0 40 82 00 50 */ bne .L_0000080C
/* 000007C0 000007F4 80 1F 00 48 */ lwz r0, 0x48(r31)
/* 000007C4 000007F8 28 00 00 00 */ cmplwi r0, 0x0
/* 000007C8 000007FC 41 82 00 28 */ beq .L_000007F0
/* 000007CC 00000800 80 1F 00 48 */ lwz r0, 0x48(r31)
/* 000007D0 00000804 90 00 00 00 */ stw r0, __LastNode@sda21(r0)
/* 000007D4 00000808 38 00 00 00 */ li r0, 0x0
/* 000007D8 0000080C 80 7F 00 48 */ lwz r3, 0x48(r31)
/* 000007DC 00000810 90 03 00 44 */ stw r0, 0x44(r3)
/* 000007E0 00000814 80 60 00 00 */ lwz r3, __OSCurrHeap@sda21(r0)
/* 000007E4 00000818 7F E4 FB 78 */ mr r4, r31
/* 000007E8 0000081C 48 00 00 01 */ bl OSFreeToHeap
/* 000007EC 00000820 48 00 00 44 */ b .L_00000830
.L_000007F0:
/* 000007F0 00000824 38 00 00 00 */ li r0, 0x0
/* 000007F4 00000828 90 00 00 00 */ stw r0, __LastNode@sda21(r0)
/* 000007F8 0000082C 90 00 00 00 */ stw r0, __FirstNode@sda21(r0)
/* 000007FC 00000830 80 60 00 00 */ lwz r3, __OSCurrHeap@sda21(r0)
/* 00000800 00000834 7F E4 FB 78 */ mr r4, r31
/* 00000804 00000838 48 00 00 01 */ bl OSFreeToHeap
/* 00000808 0000083C 48 00 00 28 */ b .L_00000830
.L_0000080C:
/* 0000080C 00000840 80 1F 00 44 */ lwz r0, 0x44(r31)
/* 00000810 00000844 80 7F 00 48 */ lwz r3, 0x48(r31)
/* 00000814 00000848 90 03 00 44 */ stw r0, 0x44(r3)
/* 00000818 0000084C 80 1F 00 48 */ lwz r0, 0x48(r31)
/* 0000081C 00000850 80 7F 00 44 */ lwz r3, 0x44(r31)
/* 00000820 00000854 90 03 00 48 */ stw r0, 0x48(r3)
/* 00000824 00000858 80 60 00 00 */ lwz r3, __OSCurrHeap@sda21(r0)
/* 00000828 0000085C 7F E4 FB 78 */ mr r4, r31
/* 0000082C 00000860 48 00 00 01 */ bl OSFreeToHeap
.L_00000830:
/* 00000830 00000864 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 00000834 00000868 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 00000838 0000086C 38 21 00 18 */ addi r1, r1, 0x18
/* 0000083C 00000870 7C 08 03 A6 */ mtlr r0
/* 00000840 00000874 4E 80 00 20 */ blr
.fn __win_log_refresh, local
.endfn __win_delete_node
/* 00000844 00000878 7C 08 02 A6 */ mflr r0
/* 00000848 0000087C 90 01 00 04 */ stw r0, 0x4(r1)
/* 0000084C 00000880 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 00000850 00000884 BF 61 00 14 */ stmw r27, 0x14(r1)
/* 00000854 00000888 7C 7F 1B 78 */ mr r31, r3
/* 00000858 0000088C 28 1F 00 00 */ cmplwi r31, 0x0
/* 0000085C 00000890 40 82 00 1C */ bne .L_00000878
/* 00000860 00000894 38 60 00 00 */ li r3, "@19"@sda21
/* 00000864 00000898 38 80 01 FA */ li r4, 0x1fa
/* 00000868 0000089C 3C A0 00 00 */ lis r5, "@91"@ha
/* 0000086C 000008A0 38 A5 00 00 */ addi r5, r5, "@91"@l
/* 00000870 000008A4 4C C6 31 82 */ crclr 4*cr1+eq
/* 00000874 000008A8 48 00 00 01 */ bl OSPanic
.L_00000878:
/* 00000878 000008AC A3 DF 00 3A */ lhz r30, 0x3a(r31)
/* 0000087C 000008B0 80 1F 00 00 */ lwz r0, 0x0(r31)
/* 00000880 000008B4 54 1C 04 3E */ clrlwi r28, r0, 16
/* 00000884 000008B8 3B A0 00 00 */ li r29, 0x0
/* 00000888 000008BC 48 00 00 70 */ b .L_000008F8
.L_0000088C:
/* 0000088C 000008C0 57 C4 04 3E */ clrlwi r4, r30, 16
/* 00000890 000008C4 A0 7F 00 38 */ lhz r3, 0x38(r31)
/* 00000894 000008C8 38 03 FF FF */ addi r0, r3, -0x1
/* 00000898 000008CC 7C 84 02 14 */ add r4, r4, r0
/* 0000089C 000008D0 A0 7F 00 38 */ lhz r3, 0x38(r31)
/* 000008A0 000008D4 7C 04 1B D6 */ divw r0, r4, r3
/* 000008A4 000008D8 7C 00 19 D6 */ mullw r0, r0, r3
/* 000008A8 000008DC 7C 00 20 50 */ subf r0, r0, r4
/* 000008AC 000008E0 54 1E 04 3E */ clrlwi r30, r0, 16
/* 000008B0 000008E4 57 A3 18 38 */ slwi r3, r29, 3
/* 000008B4 000008E8 80 1F 00 0C */ lwz r0, 0xc(r31)
/* 000008B8 000008EC 54 00 04 3E */ clrlwi r0, r0, 16
/* 000008BC 000008F0 7F 63 00 50 */ subf r27, r3, r0
/* 000008C0 000008F4 80 1F 00 28 */ lwz r0, 0x28(r31)
/* 000008C4 000008F8 54 00 04 3E */ clrlwi r0, r0, 16
/* 000008C8 000008FC 7C 1E 01 D6 */ mullw r0, r30, r0
/* 000008CC 00000900 B0 01 00 0C */ sth r0, 0xc(r1)
/* 000008D0 00000904 38 7C 00 00 */ addi r3, r28, 0x0
/* 000008D4 00000908 38 9B 00 00 */ addi r4, r27, 0x0
/* 000008D8 0000090C 38 A0 00 00 */ li r5, 0x0
/* 000008DC 00000910 38 C0 00 00 */ li r6, "@34"@sda21
/* 000008E0 00000914 80 FF 00 34 */ lwz r7, 0x34(r31)
/* 000008E4 00000918 57 C0 13 BA */ clrlslwi r0, r30, 16, 2
/* 000008E8 0000091C 7C E7 00 2E */ lwzx r7, r7, r0
/* 000008EC 00000920 4C C6 31 82 */ crclr 4*cr1+eq
/* 000008F0 00000924 48 00 00 01 */ bl DEMOPrintf
/* 000008F4 00000928 3B BD 00 01 */ addi r29, r29, 0x1
.L_000008F8:
/* 000008F8 0000092C 57 A3 04 3E */ clrlwi r3, r29, 16
/* 000008FC 00000930 80 1F 00 2C */ lwz r0, 0x2c(r31)
/* 00000900 00000934 7C 03 00 00 */ cmpw r3, r0
/* 00000904 00000938 41 80 FF 88 */ blt .L_0000088C
/* 00000908 0000093C 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 0000090C 00000940 BB 61 00 14 */ lmw r27, 0x14(r1)
/* 00000910 00000944 38 21 00 28 */ addi r1, r1, 0x28
/* 00000914 00000948 7C 08 03 A6 */ mtlr r0
/* 00000918 0000094C 4E 80 00 20 */ blr
.endfn __win_log_refresh
# 0x00000000 - 0x00000176
.data
.balign 8
.sym ...data.0, local
.obj "@20", local
.4byte 0x54585749
.4byte 0x4E3A2049
.4byte 0x6C6C6567
.4byte 0x616C2058
.4byte 0x20636F6F
.4byte 0x72647320
.4byte 0x666F7220
.4byte 0x77696E64
.4byte 0x6F770A00
.endobj "@20"
.obj "@21", local
.4byte 0x54585749
.4byte 0x4E3A2049
.4byte 0x6C6C6567
.4byte 0x616C2079
.4byte 0x20636F6F
.4byte 0x72647320
.4byte 0x666F7220
.4byte 0x77696E64
.4byte 0x6F770A00
.endobj "@21"
.obj "@22", local
.4byte 0x54585749
.4byte 0x4E3A2046
.4byte 0x41494C45
.4byte 0x4420544F
.4byte 0x20414C4C
.4byte 0x4F434154
.4byte 0x45205749
.4byte 0x4E444F57
.byte 0x21, 0x0A, 0x00
.endobj "@22"
.byte 0x00
.obj "@29", local
.4byte 0x54585749
.4byte 0x4E3A2055
.4byte 0x6E61626C
.4byte 0x6520746F
.4byte 0x20616C6C
.4byte 0x6F636174
.4byte 0x65206C6F
.4byte 0x67207769
.4byte 0x6E646F77
.4byte 0x20627566
.4byte 0x6665722E
.2byte 0x0A00
.endobj "@29"
.2byte 0x0000
.obj "@30", local
.4byte 0x54585749
.4byte 0x4E3A2046
.4byte 0x61696C65
.4byte 0x6420746F
.4byte 0x20616C6C
.4byte 0x6F636174
.4byte 0x65206275
.4byte 0x66666572
.4byte 0x20656C65
.4byte 0x6D656E74
.2byte 0x0A00
.endobj "@30"
.2byte 0x0000
.obj "@64", local
.4byte 0x3E3E2077
.4byte 0x696E5265
.4byte 0x66726573
.4byte 0x6828293A
.4byte 0x2077696E
.4byte 0x646F7720
.4byte 0x6C697374
.4byte 0x20697320
.4byte 0x656D7074
.4byte 0x79210A00
.endobj "@64"
.obj "@69", local
.4byte 0x5F5F6164
.4byte 0x645F6E6F
.4byte 0x64652829
.4byte 0x3A20796F
.4byte 0x75277265
.4byte 0x20616464
.4byte 0x696E6720
.4byte 0x61204E55
.4byte 0x4C4C206E
.4byte 0x6F646521
.2byte 0x0A00
.endobj "@69"
.2byte 0x0000
.obj "@70", local
.4byte 0x20203E20
.4byte 0x5F5F4669
.4byte 0x7273744E
.4byte 0x6F64653A
.4byte 0x204E554C
.4byte 0x4C204841
.4byte 0x4E444C45
.byte 0x21, 0x0A, 0x00
.endobj "@70"
.byte 0x00
.obj "@84", local
.4byte 0x5F5F6465
.4byte 0x6C657465
.4byte 0x5F6E6F64
.4byte 0x6528293A
.4byte 0x20796F75
.4byte 0x27726520
.4byte 0x64656C65
.4byte 0x74696E67
.4byte 0x2061204E
.4byte 0x554C4C20
.4byte 0x6E6F6465
.byte 0x21, 0x0A, 0x00
.endobj "@84"
.byte 0x00
.obj "@91", local
.4byte 0x4F484D59
.4byte 0x47415744
.2byte 0x0A00
.endobj "@91"
# 0x00000000 - 0x0000000B
.section .sdata, "wa"
.balign 8
.obj "@19", local
.4byte 0x74787769
.4byte 0x6E2E6300
.endobj "@19"
.obj "@34", local
.byte 0x25, 0x73, 0x00
.endobj "@34"
# 0x00000000 - 0x00000014
.section .sbss, "wa", @nobits
.balign 8
.obj __X_Res, local
.skip 0x2
.endobj __X_Res
.obj __Y_Res, local
.skip 0x2
.endobj __Y_Res
.obj __rmp, global
.skip 0x4
.obj __CurrNode, global
.endobj __rmp
.skip 0x4
.obj __LastNode, global
.endobj __CurrNode
.skip 0x4
.obj __FirstNode, global
.endobj __LastNode
.skip 0x4
.endobj __FirstNode
# 0x00000000 - 0x00000028
.section .sdata2, "a"
.balign 8
.obj "@13", local
.4byte 0x0A1019FF
.endobj "@13"
.4byte 0x00000000
.obj "@49", local
.4byte 0x40840000
.4byte 0x00000000
.endobj "@49"
.obj "@50", local
.4byte 0x40200000
.4byte 0x00000000
.endobj "@50"
.obj "@51", local
.4byte 0x3FE80000
.4byte 0x00000000
.endobj "@51"
.obj "@53", local
.4byte 0x43300000
.4byte 0x00000000
.endobj "@53"

View File

@ -959,6 +959,15 @@ LIBS = [
["musyx/runtime/profile", True],
],
},
{
"lib": "txwin",
"mw_version": "1.2.5",
"cflags": "-Cpp_exceptions off -proc gecko -fp hard -nodefaults -nosyspath -i include -i libc -g -sym on -D_DEBUG=1 -enum int ",
"host": False,
"objects": [
["musyx/txwin/txwin", False],
],
},
{
"lib": "dtk",
"mw_version": "1.2.5",

View File

@ -214,6 +214,7 @@ void OSFatal(GXColor fg, GXColor bg, const char* msg);
#endif
#include <dolphin/os/OSAlarm.h>
#include <dolphin/os/OSAlloc.h>
#include <dolphin/os/OSArena.h>
#include <dolphin/os/OSCache.h>
#include <dolphin/os/OSContext.h>

View File

@ -0,0 +1,30 @@
#ifndef _DOLPHIN_OSALLOC
#define _DOLPHIN_OSALLOC
#include <dolphin/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int OSHeapHandle;
typedef void (*OSAllocVisitor)(void* obj, u32 size);
void* OSInitAlloc(void* arenaStart, void* arenaEnd, int maxHeaps);
OSHeapHandle OSCreateHeap(void* start, void* end);
void OSDestroyHeap(OSHeapHandle heap);
void OSAddToHeap(OSHeapHandle heap, void* start, void* end);
OSHeapHandle OSSetCurrentHeap(OSHeapHandle heap);
void* OSAllocFromHeap(OSHeapHandle heap, u32 size);
void* OSAllocFixed(void** rstart, void** rend);
void OSFreeToHeap(OSHeapHandle heap, void* ptr);
long OSCheckHeap(OSHeapHandle heap);
void OSDumpHeap(OSHeapHandle heap);
u32 OSReferentSize(void* ptr);
void OSVisitAllocated(OSAllocVisitor visitor);
extern volatile OSHeapHandle __OSCurrHeap;
#define OSAlloc(size) OSAllocFromHeap(__OSCurrHeap, (size))
#define OSFree(ptr) OSFreeToHeap(__OSCurrHeap, (ptr))
#ifdef __cplusplus
}
#endif
#endif // _DOLPHIN_OSALLOC

View File

@ -856,6 +856,7 @@ u32 dataInsertMacro(u16 mid, void* macroaddr);
u32 dataRemoveMacro(u16 mid);
u32 dataInsertCurve(u16 cid, void* curvedata);
u32 dataRemoveCurve(u16 sid);
long dataGetSample(u16 sid, SAMPLE_INFO* newsmp);
u32 dataAddSampleReference(u16 sid);
u32 dataRemoveSampleReference(u16 sid);
u32 dataInsertKeymap(u16 cid, void* keymapdata);
@ -865,6 +866,8 @@ u32 dataRemoveLayer(u16 sid);
u32 dataInsertFX(u16 gid, FX_TAB* fx, u16 fxNum);
FX_TAB* dataGetFX(u16 fid);
s32 hwInit(u32* frq, u16 numVoices, u16 numStudios, u32 flags); /* extern */
void hwInitSamplePlayback(u32 v, u16 smpID, void* newsmp, u32 set_defadsr, u32 prio,
u32 callbackUserValue, u32 setSRC, u8 itdMode);
void hwEnableIrq();
void hwDisableIrq();
void* hwTransAddr(void* samples);
@ -957,6 +960,11 @@ typedef struct SND_STREAM_INFO {
} SND_STREAM_INFO;
void streamOutputModeChanged();
void inpSetExCtrl(struct SYNTH_VOICE* svoice, unsigned char ctrl, signed short v);
CHANNEL_DEFAULTS* inpGetChannelDefaults(unsigned char midi, unsigned char midiSet);
void inpSetMidiLastNote(u8 midi, u8 midiSet, u8 key);
u8 inpGetMidiLastNote(u8 midi, u8 midiSet);
unsigned short inpGetExCtrl(SYNTH_VOICE* svoice, unsigned char ctrl);
unsigned short inpGetMidiCtrl(unsigned char ctrl, unsigned char channel, unsigned char set);
void inpSetMidiLastNote(unsigned char midi, unsigned char midiSet, unsigned char key);
u16 inpGetModulation(SYNTH_VOICE* svoice);

49
include/musyx/txwin.h Normal file
View File

@ -0,0 +1,49 @@
#ifndef _MUSYX_TXWIN
#define _MUSYX_TXWIN
#include <dolphin/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct STRUCT_WIN {
s32 x1;
s32 y1;
s32 x2;
s32 y2;
char* caption;
u32 flags;
s32 curr_x;
s32 curr_y;
s32 pixel_width;
s32 pixel_height;
s32 char_width;
s32 char_height;
u16 num_lines;
char** buffer;
u16 total_lines;
u16 curr_output_line;
u16 curr_view_line;
void (*refresh)();
struct STRUCT_WIN* next;
struct STRUCT_WIN* prev;
} sWIN;
void winInit(void);
void winRefresh(void);
void winLogPrintf(sWIN* handle, char* fmt, ...);
void winPrintfXY(sWIN* handle, s16 char_x, s16 char_y, char* fmt, ...);
void winClearLogWindow(sWIN* handle);
void winSetFontSize(u16 size);
sWIN* winOpenLogWindow(s32 x1, s32 y1, s32 x2, s32 y2, char* caption, u16 num_lines, u32 flags);
sWIN* winOpenWindow(s32 x1, s32 y1, s32 x2, s32 y2, char* caption, void* func, u32 flags);
WXOpenWindow();
#ifdef __cpluplus
}
#endif // __cpluplus
#endif // _MUSYX_TXWIN

View File

@ -140,7 +140,7 @@ void hwSetMesgCallback(SND_MESSAGE_CALLBACK callback) { salMessageCallback = cal
void hwSetPriority(u32 idx, u32 priority) { dspVoice[idx].prio = priority; }
void hwInitSamplePlayback(s32 v, u16 smpID, void* newsmp, u32 set_defadsr, u32 priority,
void hwInitSamplePlayback(u32 v, u16 smpID, void* newsmp, u32 set_defadsr, u32 prio,
u32 callbackUserValue, u32 setSRC, u8 itdMode) {
unsigned char i; // r30
unsigned long bf; // r29
@ -151,7 +151,7 @@ void hwInitSamplePlayback(s32 v, u16 smpID, void* newsmp, u32 set_defadsr, u32 p
}
dspVoice[v].changed[0] = bf;
dspVoice[v].prio = priority;
dspVoice[v].prio = prio;
dspVoice[v].mesgCallBackUserValue = callbackUserValue;
dspVoice[v].flags = 0;
dspVoice[v].smp_id = smpID;

File diff suppressed because it is too large Load Diff

233
src/musyx/txwin/txwin.c Normal file
View File

@ -0,0 +1,233 @@
#include "musyx/txwin.h"
#include "dolphin/gx.h"
#include "dolphin/os.h"
#include "musyx/assert.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
/* TODO: TEMPORARY HACKS */
extern GXRenderModeObj* DEMOGetRenderModeObj();
extern void DEMOPrintf(s16, s16, s16, char*, ...);
static void __win_log_refresh(sWIN* handle);
static void __win_add_node(sWIN* handle);
static void __win_delete_node(sWIN* handle);
static unsigned short __X_Res = 0;
static unsigned short __Y_Res = 0;
GXRenderModeObj* __rmp = NULL;
sWIN* __CurrNode = NULL;
sWIN* __LastNode = NULL; // size: 0x4
sWIN* __FirstNode = NULL; // size: 0x4
void winInit() {
__FirstNode = NULL;
__LastNode = NULL;
__CurrNode = NULL;
winSetFontSize(8);
__rmp = DEMOGetRenderModeObj();
GXSetCopyClear((GXColor){0x0A, 0x10, 0x19, 0xFF}, 0xFFFFFF);
}
sWIN* winOpenWindow(s32 x1, s32 y1, s32 x2, s32 y2, char* caption, void* func, u32 flags) {
sWIN* handle; // r31
#line 109
ASSERT_MSG(x1 < x2, "TXWIN: Illegal X coords for window\n");
ASSERT_MSG(y1 < y2, "TXWIN: Illegal y coords for window\n");
handle = OSAlloc(sizeof(sWIN));
ASSERT_MSG(handle != NULL, "TXWIN: FAILED TO ALLOCATE WINDOW!\n");
__win_add_node(handle);
handle->x1 = x1;
handle->y1 = y1;
handle->x2 = x2;
handle->y2 = y2;
handle->pixel_width = (x2 - x1) + 1;
handle->pixel_height = (y2 - y1) + 1;
handle->curr_x = 0;
handle->curr_y = 0;
handle->caption = caption;
handle->char_width = handle->pixel_width / 8;
handle->char_height = handle->pixel_height / 8;
handle->refresh = func;
handle->flags = flags;
return handle;
}
sWIN* winOpenLogWindow(s32 x1, s32 y1, s32 x2, s32 y2, char* caption, u16 num_lines, u32 flags) {
sWIN* handle; // r31
u16 i; // r30
handle = winOpenWindow(x1, y1, x2, y2, caption, NULL, 0);
handle->refresh = __win_log_refresh;
handle->flags = 1;
handle->curr_output_line = 0;
handle->curr_view_line = 0;
handle->total_lines = (u16)handle->char_height + num_lines;
handle->buffer = OSAlloc(handle->total_lines * 4);
#line 192
ASSERT_MSG(handle->buffer != NULL, "TXWIN: Unable to allocate log window buffer.\n");
for (i = 0; i < handle->total_lines; ++i) {
handle->buffer[i] = OSAlloc(handle->char_width + 1);
memset(handle->buffer[i], 0, handle->char_width + 1);
ASSERT_MSG(handle->buffer[i] != NULL, "TXWIN: Failed to allocate buffer element\n");
}
return handle;
}
void winPrintfXY(sWIN* handle, s16 char_x, s16 char_y, char* fmt, ...) {
va_list args;
char buffer[128];
s16 x;
s16 y;
va_start(args, fmt);
vsprintf(buffer, fmt, args);
va_end(args);
if (strlen(buffer) > (u32)handle->char_width) {
buffer[handle->char_width] = '\0';
}
x = handle->x1 + (char_x * 8);
y = handle->y1 + (char_y * 8);
DEMOPrintf(x, y, 0, "%s", buffer);
}
void winLogPrintf(sWIN* handle, char* fmt, ...) {
va_list args;
char buffer[128];
va_start(args, fmt);
vsprintf(buffer, fmt, args);
va_end(args);
if (strlen(buffer) > (u32)handle->char_width) {
buffer[handle->char_width] = '\0';
}
strcpy(handle->buffer[handle->curr_output_line], buffer);
handle->curr_output_line = (handle->curr_output_line + 1) % handle->total_lines;
}
void winClearLogWindow(sWIN* handle) {
u16 i;
for (i = 0; i < handle->total_lines; ++i) {
memset(handle->buffer[i], 0, handle->char_width + 1);
}
handle->curr_output_line = 0;
handle->curr_view_line = 0;
}
void winSetFontSize(u16 size) {
if (size >= 8 && size <= 40) {
__X_Res = (8.0 / (float)size) * 640.0;
__Y_Res = (float)__X_Res * 0.75;
} else {
__X_Res = 640;
__Y_Res = 480;
}
}
void winRefresh() {
sWIN* ptr;
#line 338
ASSERT_MSG(__FirstNode != NULL, ">> winRefresh(): window list is empty!\n");
ptr = __FirstNode;
DEMOInitCaption(2, __X_Res, __Y_Res);
while (ptr != NULL) {
if (ptr->refresh) {
ptr->refresh(ptr);
}
ptr = ptr->next;
}
}
void __win_add_node(sWIN* handle) {
#line 390
ASSERT_MSG(handle != NULL, "__add_node(): you're adding a NULL node!\n");
if ((sWIN*)NULL == __LastNode) {
__CurrNode = handle;
__LastNode = handle;
__FirstNode = handle;
handle->next = NULL;
handle->prev = NULL;
ASSERT_MSG(__FirstNode != NULL, " > __FirstNode: NULL HANDLE!\n");
} else {
__LastNode->next = handle;
handle->next = NULL;
handle->prev = __LastNode;
__LastNode = handle;
}
}
void __win_delete_node(sWIN* handle) {
#line 434
ASSERT_MSG(handle != NULL, "__delete_node(): you're deleting a NULL node!\n");
if (__FirstNode == handle) {
if (handle->next != NULL) {
__FirstNode = handle->next;
handle->next->prev = NULL;
OSFree(handle);
} else {
__FirstNode = __LastNode = NULL;
OSFree(handle);
}
} else if (__LastNode == handle) {
if (handle->prev != NULL) {
__LastNode = handle->prev;
handle->prev->next = NULL;
OSFree(handle);
} else {
__FirstNode = __LastNode = NULL;
OSFree(handle);
}
} else {
handle->prev->next = handle->next;
handle->next->prev = handle->prev;
OSFree(handle);
}
}
void __win_log_refresh(struct STRUCT_WIN* handle) {
u32 uVar1;
int iVar2;
unsigned short n; // r30
unsigned short i; // r29
unsigned short x; // r28
unsigned short y; // r27
unsigned short index; // r1+0xC
#line 506
ASSERT_MSG(handle != NULL, "OHMYGAWD\n");
n = (u32)handle->curr_output_line;
x = handle->x1;
y = handle->y2;
i = 0;
for (i = 0; i < handle->char_height; ++i) {
n = index = (u16)(n + (handle->total_lines - 1)) % (u32)handle->total_lines;
DEMOPrintf(x, (y + i) % 2, 0, "%s", handle->buffer[index]);
}
}