dolphin/docs/DSP/DSP_UC_SuperMarioGalaxy.txt

3174 lines
131 KiB
Plaintext
Raw Normal View History

// Memory map:
//
// 0x0D00: final right buffer #1
// 0x0D60: final left buffer #1
// 0x0F40: final right buffer #2
// 0x0CA0: final left buffer #2
0000 029f 0012 jmp 0x0012 // Reset()
0002 0000 nop
0003 0000 nop
0004 02ff rti
0005 0000 nop
0006 02ff rti
0007 0000 nop
0008 02ff rti
0009 0000 nop
000a 02ff rti
000b 0000 nop
000c 02ff rti
000d 0000 nop
000e 029f 06e9 jmp 0x06e9 // Exception_0E()
0010 029f 004c jmp 0x004c // TaskStart()
// Reset()
0012 1205 sbclr #0x05
0013 02bf 0055 call 0x0055
0015 8100 clr $ACC0
0016 009f 1000 lri $AC1.M, #0x1000
0018 0080 0000 lri $AR0, #0x0000
001a 005f loop $AC1.M
001b 1b1e srri @$AR0, $AC0.M
001c 02bf 07b9 call 0x07b9 // InitGlobalVars()
001e 02bf 0f0a call 0x0f0a // InitUnkTable()
0020 0e00 lris $AC0.M, #0x00
0021 02bf 079b call 0x079b // SendMail_DCD1(0x0000)
0023 009e 1111 lri $AC0.M, #0x1111
0025 02bf 07a5 call 0x07a5 // sendMail_F355(0x1111)
0027 0e00 lris $AC0.M, #0x00
0028 00fe 034e sr @0x034e, $AC0.M
002a 1305 sbset #0x05
002b 029f 07f6 jmp 0x07f6 // jump to MessageLoop()
// OpcodeHandler()
002d 00df 0357 lr $AC1.M, @0x0357
002f 00ff 0345 sr @0x0345, $AC1.M
0031 00de 0356 lr $AC0.M, @0x0356
0033 1ffe mrr $AC1.M, $AC0.M
0034 0340 00ff andi $AC1.M, #0x00ff
0036 00ff 0344 sr @0x0344, $AC1.M
0038 1479 lsr $ACC0, #-7
0039 0240 007e andi $AC0.M, #0x007e
003b 00fe 0343 sr @0x0343, $AC0.M
003d 0200 0073 addi $AC0.M, #0x0073 // Opcode jump table address (0x0073)
003f 1c1e mrr $AR0, $AC0.M
0040 170f jmpr $AR0 // jump to opcode handler
0041 0092 00ff lri $CR, #0x00ff // Return address from opcode handler
0043 0e04 lris $AC0.M, #0x04
0044 02bf 079b call 0x079b // SendMail_DCD1(0x0004)
0046 00de 0356 lr $AC0.M, @0x0356
0048 02bf 07a5 call 0x07a5 // SendMail_F355(mail_high_part)
004a 029f 002b jmp 0x002b // jump back to MessageLoop()
// TaskStart()
004c 1205 sbclr #0x05
004d 02bf 0055 call 0x0055
004f 0e01 lris $AC0.M, #0x01
0050 02bf 079b call 0x079b // SendMail_DCD1(0x0001)
0052 1305 sbset #0x05
0053 029f 002b jmp 0x002b // jump back to MessageLoop()
//
0055 1202 sbclr #0x02
0056 1203 sbclr #0x03
0057 1204 sbclr #0x04
0058 1306 sbset #0x06
0059 8e00 set16
005a 8c00 clr15
005b 8b00 m0
005c 009e ffff lri $AC0.M, #0xffff
005e 1d1e mrr $WR0, $AC0.M
005f 1d3e mrr $WR1, $AC0.M
0060 1d5e mrr $WR2, $AC0.M
0061 1d7e mrr $WR3, $AC0.M
0062 0092 00ff lri $CR, #0x00ff
0064 02df ret
// ReadWholeMessage()
0065 0081 0358 lri $AR1, #0x0358
0067 0090 0000 lri $AC0.H, #0x0000
0069 0c00 lris $AC0.L, #0x00
006a 007e 006f bloop $AC0.M, 0x006f
006c 193e lrri $AC0.M, @$AR1
006d 1b1e srri @$AR0, $AC0.M
006e 193e lrri $AC0.M, @$AR1
006f 1b1e srri @$AR0, $AC0.M
0070 02df ret
// Opcode_03() (dummy)
0071 029f 0041 jmp 0x0041
// Opcode jump table (16 opcodes available)
0073 029f 0041 jmp 0x0041 // 0 (dummy)
0075 029f 0093 jmp 0x0093 // 1 (DsetupTable)
0077 029f 029d jmp 0x029d // 2 (SyncFrame)
0079 029f 0071 jmp 0x0071 // 3 (dummy)
007b 029f 0616 jmp 0x0616 // 4 ()
007d 029f 0628 jmp 0x0628 // 5 ()
007f 029f 0041 jmp 0x0041 // 6 (dummy)
0081 029f 055f jmp 0x055f // 7 ()
0083 029f 05ab jmp 0x05ab // 8 ()
0085 029f 058f jmp 0x058f // 9 ()
0087 029f 0041 jmp 0x0041 // A (dummy)
0089 029f 0041 jmp 0x0041 // B (dummy)
008b 029f 0041 jmp 0x0041 // C (dummy)
008d 029f 00bd jmp 0x00bd // D (DsetDolbyDelay)
008f 029f 00b0 jmp 0x00b0 // E ()
0091 029f 0041 jmp 0x0041 // F (dummy)
// Opcode_01() - DsetupTable
// Message body: 5 mails
// Mail 1: bit0-15 = max (see inner loop of SyncFrame), bit16-32 = 0, bit24-30 = command (0x01)
// Mail 2: Address in main memory of parameter blocks used during mixing; there are X blocks of 384 bytes (192 words) each
// Mail 3: Address in main memory of something (640 words copied to 0x0000)
// Mail 4: Address in main memory of something (32 words copied to 0x0300)
// Mail 5: Address in main memory of other parameter blocks; there are 4 blocks (or more?) of 32 bytes (16 words) each
// Stores the mail body to 0x0380.
0093 0080 0380 lri $AR0, #0x0380
0095 0e04 lris $AC0.M, #0x04
0096 02bf 0065 call 0x0065
0098 0081 0382 lri $AR1, #0x0382
009a 009f 0000 lri $AC1.M, #0x0000
009c 0080 0280 lri $AR0, #0x0280
009e 02bf 05e6 call 0x05e6 // DmaCopy(0x0000, Dword[0x0382], 0x280)
00a0 0081 0384 lri $AR1, #0x0384
00a2 009f 0300 lri $AC1.M, #0x0300
00a4 0080 0020 lri $AR0, #0x0020
00a6 02bf 05e6 call 0x05e6 // DmaCopy(0x0300, Dword[0x0384], 32)
00a8 00de 0345 lr $AC0.M, @0x0345
00aa 00fe 0342 sr @0x0342, $AC0.M
00ac 02bf 0d01 call 0x0d01
00ae 029f 0041 jmp 0x0041
// Opcode_0E()
00b0 0080 037d lri $AR0, #0x037d
00b2 0e01 lris $AC0.M, #0x01
00b3 02bf 0065 call 0x0065
00b5 00de 037d lr $AC0.M, @0x037d
00b7 0240 7fff andi $AC0.M, #0x7fff
00b9 00fe 037d sr @0x037d, $AC0.M
00bb 029f 0041 jmp 0x0041
// Opcode_0D() - DsetDolbyDelay
00bd 0080 0374 lri $AR0, #0x0374
00bf 0e01 lris $AC0.M, #0x01
00c0 00fe 0377 sr @0x0377, $AC0.M
00c2 00fe 037c sr @0x037c, $AC0.M
00c4 02bf 0065 call 0x0065
00c6 00de 0345 lr $AC0.M, @0x0345
00c8 00fe 0376 sr @0x0376, $AC0.M
00ca 029f 0041 jmp 0x0041
// read PB
00cc 0081 034c lri $AR1, #0x034c
00ce 009f 0400 lri $AC1.M, #0x0400
00d0 0080 00c0 lri $AR0, #0x00c0
00d2 02bf 05e6 call 0x05e6 // DmaCopy(0x0400, Dword[0x034C], 192)
00d4 02df ret
// writeback PB
00d5 0081 034c lri $AR1, #0x034c
00d7 009f 0400 lri $AC1.M, #0x0400
00d9 0080 0080 lri $AR0, #0x0080
00db 0081 034c lri $AR1, #0x034c
00dd 193e lrri $AC0.M, @$AR1
00de 193c lrri $AC0.L, @$AR1
00df 0098 0000 lri $AX0.L, #0x0000
00e1 7000 addaxl $ACC0, $AX0.L
00e2 02bf 05f5 call 0x05f5 // DmaCopy(Dword[0x034C], 0x0400, 128)
00e4 02df ret
//
00e5 191e lrri $AC0.M, @$AR0
00e6 191a lrri $AX0.H, @$AR0
00e7 005f loop $AC1.M
00e8 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
00e9 1b7e srri @$AR3, $AC0.M
00ea 1b7a srri @$AR3, $AX0.H
00eb 02df ret
// memcpy(destination, source, length)
// AR0 = source address
// AR3 = destination address
// AC1.M = length in dwords
00ec 0000 nop
00ed 007f 00f2 bloop $AC1.M, 0x00f2
00ef 191e lrri $AC0.M, @$AR0
00f0 1b7e srri @$AR3, $AC0.M
00f1 191e lrri $AC0.M, @$AR0
00f2 1b7e srri @$AR3, $AC0.M
00f3 0000 nop
00f4 02df ret
//
00f5 191e lrri $AC0.M, @$AR0
00f6 191a lrri $AX0.H, @$AR0
00f7 007f 00fc bloop $AC1.M, 0x00fc
00f9 32b2 xorr'sl $AC0.M, $AX1.H : $AC0.M, $AX1.H
00fa 65a0 movr'ls $ACC1, $AX0.H : $AX0.H, $AC0.M
00fb 33ba xorr'slm $AC1.M, $AX1.H : $AC0.M, $AX1.H
00fc 64a1 movr'ls $ACC0, $AX0.H : $AX0.H, $AC1.M
00fd 0000 nop
00fe 02df ret
// multiply routine
// AC1.M = size in words
// AR0 = source addres
// AR3 = destination address
00ff 8a00 m2 // multiply result by 2
0100 157f lsr $ACC1, #-1 // size >>= 1 (process buffers per dwords)
0101 1c20 mrr $AR1, $AR0 // AR1 = AR0
0102 1c03 mrr $AR0, $AR3 // AR0 = AR3
0103 193a lrri $AX0.H, @$AR1 // AX0.H = Mem[AR1]; AR1++;
0104 9051 mul'l $AX0.L, $AX0.H : $AX0.H, @$AR1 // prod = AX0.L * AX0.H; AX0.H = Mem[AR1]; AR1++;
0105 925b mulmvz'l $AX0.L, $AX0.H, $ACC0 : $AX1.H, @$AR3 // AC0.M = prod; AC0.L = 0; prod = AX0.L * AX0.H; AX1.H = Mem[AR3]; AR3++;
0106 007f 010b bloop $AC1.M, 0x010b
0108 4651 addr'l $ACC0, $AX1.H : $AX0.H, @$AR1 // ACC0 += AX1.H; AX0.H = Mem[AR1]; AR1++;
0109 92b2 mulmvz'sl $AX0.L, $AX0.H, $ACC0 : $AC0.M, $AX1.H // AC0.M = prod; AC0.L = 0; prod = AX0.L * AX0.H; ...
010a 4651 addr'l $ACC0, $AX1.H : $AX0.H, @$AR1
010b 92b2 mulmvz'sl $AX0.L, $AX0.H, $ACC0 : $AC0.M, $AX1.H
010c 8b00 m0 // don't multiply result
010d 02df ret
//
010e 8a00 m2
010f 191a lrri $AX0.H, @$AR0
0110 9050 mul'l $AX0.L, $AX0.H : $AX0.H, @$AR0
0111 9250 mulmvz'l $AX0.L, $AX0.H, $ACC0 : $AX0.H, @$AR0
0112 005f loop $AC1.M
0113 92a0 mulmvz'ls $AX0.L, $AX0.H, $ACC0 : $AX0.H, $AC0.M
0114 8b00 m0
0115 02df ret
// ClearBuffers()
// clears:
// - 80 words at 0x0D00 (right buffer #1)
// - 80 words at 0x0D60 (left buffer #1)
// - 80 words at 0x0CA0 (left buffer #2)
// - 80 words at 0x0F40 (right buffer #2)
// - 80 words at 0x0FA0
// - 80 words at 0x0A00
// - 80 words at 0x09A0
// - 80 words at 0x0DC8
// - 80 words at 0x0E28
// - 80 words at 0x0E88
// - 80 words at 0x0EE8
// copies:
// - 8 words from 0x0E10 to 0x0DC0
// - 8 words from 0x0E70 to 0x0E20
// - 8 words from 0x0ED0 to 0x0E80
// - 8 words from 0x0F30 to 0x0EE0
0116 8100 clr $ACC0
0117 8900 clr $ACC1
0118 0e50 lris $AC0.M, #0x50
0119 0080 0d00 lri $AR0, #0x0d00
011b 005e loop $AC0.M
011c 1b1f srri @$AR0, $AC1.M
011d 0080 0d60 lri $AR0, #0x0d60
011f 005e loop $AC0.M
0120 1b1f srri @$AR0, $AC1.M
0121 00da 0374 lr $AX0.H, @0x0374
0123 8600 tstaxh $AX0.H
0124 02b5 0f35 callz 0x0f35 // call this mixer if right buffer address is 0??? uh???
0126 8100 clr $ACC0
0127 8900 clr $ACC1
0128 0e50 lris $AC0.M, #0x50
0129 0080 0ca0 lri $AR0, #0x0ca0
012b 005e loop $AC0.M
012c 1b1f srri @$AR0, $AC1.M
012d 0080 0f40 lri $AR0, #0x0f40
012f 005e loop $AC0.M
0130 1b1f srri @$AR0, $AC1.M
0131 0080 0fa0 lri $AR0, #0x0fa0
0133 005e loop $AC0.M
0134 1b1f srri @$AR0, $AC1.M
0135 0080 0a00 lri $AR0, #0x0a00
0137 005e loop $AC0.M
0138 1b1f srri @$AR0, $AC1.M
0139 0080 09a0 lri $AR0, #0x09a0
013b 005e loop $AC0.M
013c 1b1f srri @$AR0, $AC1.M
013d 0f04 lris $AC1.M, #0x04
013e 0080 0e10 lri $AR0, #0x0e10
0140 0083 0dc0 lri $AR3, #0x0dc0
0142 02bf 00ec call 0x00ec // memcpy(0x0DC0, 0x0E10, 4);
0144 0080 0e70 lri $AR0, #0x0e70
0146 0083 0e20 lri $AR3, #0x0e20
0148 02bf 00ec call 0x00ec // memcpy(0x0E20, 0x0E70, 4);
014a 0080 0ed0 lri $AR0, #0x0ed0
014c 0083 0e80 lri $AR3, #0x0e80
014e 02bf 00ec call 0x00ec // memcpy(0x0E80, 0x0ED0, 4);
0150 0080 0f30 lri $AR0, #0x0f30
0152 0083 0ee0 lri $AR3, #0x0ee0
0154 02bf 00ec call 0x00ec // memcpy(0x0EE0, 0x0F30, 4);
0156 8100 clr $ACC0
0157 0e50 lris $AC0.M, #0x50
0158 8900 clr $ACC1
0159 0080 0dc8 lri $AR0, #0x0dc8
015b 005e loop $AC0.M
015c 1b1f srri @$AR0, $AC1.M
015d 0080 0e28 lri $AR0, #0x0e28
015f 005e loop $AC0.M
0160 1b1f srri @$AR0, $AC1.M
0161 0080 0e88 lri $AR0, #0x0e88
0163 005e loop $AC0.M
0164 1b1f srri @$AR0, $AC1.M
0165 0080 0ee8 lri $AR0, #0x0ee8
0167 005e loop $AC0.M
0168 1b1f srri @$AR0, $AC1.M
0169 02df ret
//
016a 009f 0580 lri $AC1.M, #0x0580
016c 009b 00a0 lri $AX1.H, #0x00a0
016e 0081 0393 lri $AR1, #0x0393
0170 18bc lrrd $AC0.L, @$AR1 // AC0.L = Mem[0x0393];
0171 b871 mulx'l $AX0.H, $AX1.H : $AC0.M, @$AR1 // AC0.M = Mem[0x0392];
0172 bc00 mulxac $AX0.H, $AX1.H, $ACC0 // ACC0 += (AX0.H * AX1.H); (Mem[0x03A4] * 160)
0173 0080 0050 lri $AR0, #0x0050
0175 02bf 05e8 call 0x05e8 // DmaCopy(0x0580, ((Dword[0x0392 << 16) | Dword[0x0393]) + (Mem[0x03A4] * 160), 80);
0177 02df ret
//
0178 00df 03a1 lr $AC1.M, @0x03a1
017a 0508 addis $ACC1, #0x08
017b 0080 0580 lri $AR0, #0x0580
017d 1c7f mrr $AR3, $AC1.M
017e 0098 7fff lri $AX0.L, #0x7fff
0180 8900 clr $ACC1
0181 0f50 lris $AC1.M, #0x50
0182 02bf 00ff call 0x00ff // mult routine
0184 02df ret
// mix?
0185 00c0 03a0 lr $AR0, @0x03a0
0187 191a lrri $AX0.H, @$AR0 // AX0.H = Mem[0x03A4];
0188 02bf 016a call 0x016a // get music?
018a 02bf 0178 call 0x0178
018c 8100 clr $ACC0
018d 8900 clr $ACC1
018e 00de 0390 lr $AC0.M, @0x0390 // First word of PB: status; 1 = playing, 0 = not playing
0190 02a0 0001 andf $AC0.M, #0x0001
0192 029d 019b jlz 0x019b
0194 0080 0398 lri $AR0, #0x0398 //
0196 0e08 lris $AC0.M, #0x08
0197 00c1 03a1 lr $AR1, @0x03a1
0199 02bf 0c43 call 0x0c43 // ???
019b 0f50 lris $AC1.M, #0x50
019c 00c0 03a1 lr $AR0, @0x03a1
019e 00da 0394 lr $AX0.H, @0x0394 //
01a0 8600 tstaxh $AX0.H
01a1 0295 01a8 jz 0x01a8
01a3 1c7a mrr $AR3, $AX0.H
01a4 00d8 0395 lr $AX0.L, @0x0395
01a6 02bf 00ff call 0x00ff // mult routine
01a8 0f50 lris $AC1.M, #0x50
01a9 00c0 03a1 lr $AR0, @0x03a1
01ab 00da 0396 lr $AX0.H, @0x0396
01ad 8600 tstaxh $AX0.H
01ae 0295 01b5 jz 0x01b5
01b0 1c7a mrr $AR3, $AX0.H
01b1 00d8 0397 lr $AX0.L, @0x0397
01b3 02bf 00ff call 0x00ff
01b5 00de 0390 lr $AC0.M, @0x0390
01b7 02a0 0002 andf $AC0.M, #0x0002
01b9 02dd retlz
01ba 0080 0398 lri $AR0, #0x0398
01bc 0e08 lris $AC0.M, #0x08
01bd 00c1 03a1 lr $AR1, @0x03a1
01bf 02bf 0c43 call 0x0c43
01c1 02df ret
// mix background music? called by cmd 02 (SyncFrame)
// uses the 4 first PBs
// so these PBs would be for background music?
01c2 8900 clr $ACC1
01c3 009f 0dc0 lri $AC1.M, #0x0dc0
01c5 00ff 03a1 sr @0x03a1, $AC1.M
01c7 009f 03a8 lri $AC1.M, #0x03a8
01c9 00ff 03a2 sr @0x03a2, $AC1.M
01cb 009f 03a4 lri $AC1.M, #0x03a4
01cd 00ff 03a0 sr @0x03a0, $AC1.M
01cf 1104 01ef bloopi #0x04, 0x01ef // Perform mixing for 4 PBs
01d1 00c0 03a2 lr $AR0, @0x03a2 // Inited to 0x03A8
01d3 0083 0390 lri $AR3, #0x0390
01d5 8900 clr $ACC1
01d6 0f08 lris $AC1.M, #0x08
01d7 02bf 00ec call 0x00ec // memcpy(0x0390, Mem[0x03A2], 8); Copy the current PB to 0x0390
01d9 00da 0390 lr $AX0.H, @0x0390
01db 8600 tstaxh $AX0.H
01dc 0295 01e0 jz 0x01e0 // skip the call below if [0x0390] is nonzero? ([0x0390] = first word of PB, probably start/stop flag?)
01de 02bf 0185 call 0x0185 // mix?
01e0 8100 clr $ACC0
01e1 00de 03a2 lr $AC0.M, @0x03a2
01e3 0410 addis $ACC0, #0x10 // Increment address to next PB
01e4 00fe 03a2 sr @0x03a2, $AC0.M
01e6 00de 03a1 lr $AC0.M, @0x03a1
01e8 0460 addis $ACC0, #0x60 // Increment another value (buffer address???)
01e9 00fe 03a1 sr @0x03a1, $AC0.M
01eb 00de 03a0 lr $AC0.M, @0x03a0
01ed 7400 incm $AC0.M // Increment another value (address of something)
01ee 00fe 03a0 sr @0x03a0, $AC0.M
01f0 00da 0374 lr $AX0.H, @0x0374
01f2 8600 tstaxh $AX0.H
01f3 0294 0219 jnz 0x0219
01f5 0f50 lris $AC1.M, #0x50
01f6 0080 0be0 lri $AR0, #0x0be0
01f8 0083 0e80 lri $AR3, #0x0e80
01fa 0098 7fff lri $AX0.L, #0x7fff // +32767
01fc 02bf 00ff call 0x00ff // mult routine
01fe 0f50 lris $AC1.M, #0x50
01ff 0080 0be0 lri $AR0, #0x0be0
0201 0083 0ee0 lri $AR3, #0x0ee0
0203 0098 b820 lri $AX0.L, #0xb820 // -18400
0205 02bf 00ff call 0x00ff // mult routine
0207 0f28 lris $AC1.M, #0x28
0208 0080 0c68 lri $AR0, #0x0c68
020a 0083 0e80 lri $AR3, #0x0e80
020c 0098 b820 lri $AX0.L, #0xb820 // -18400
020e 02bf 00ff call 0x00ff // mult routine
0210 0f28 lris $AC1.M, #0x28
0211 0080 0c68 lri $AR0, #0x0c68
0213 0083 0ee0 lri $AR3, #0x0ee0
0215 0098 7fff lri $AX0.L, #0x7fff // +32767
0217 02bf 00ff call 0x00ff // mult routine
// clear buffers at 0x0BE0 and 0x0C40 (80 words(160 bytes) each)
0219 8100 clr $ACC0
021a 8900 clr $ACC1
021b 0e50 lris $AC0.M, #0x50
021c 0080 0be0 lri $AR0, #0x0be0
021e 005e loop $AC0.M
021f 1b1f srri @$AR0, $AC1.M
0220 0080 0c40 lri $AR0, #0x0c40
0222 005e loop $AC0.M
0223 1b1f srri @$AR0, $AC1.M
0224 02df ret
//
0225 00c0 03a0 lr $AR0, @0x03a0
0227 181a lrr $AX0.H, @$AR0
0228 8100 clr $ACC0
0229 181e lrr $AC0.M, @$AR0
022a 00db 0391 lr $AX1.H, @0x0391
022c 7400 incm $AC0.M
022d d100 cmpar $ACC1, $AX0.H
022e 0270 ifns
022f 8100 clr $ACC0
0230 1b1e srri @$AR0, $AC0.M
0231 00df 03a1 lr $AC1.M, @0x03a1
0233 009b 00a0 lri $AX1.H, #0x00a0
0235 0081 0393 lri $AR1, #0x0393
0237 18bc lrrd $AC0.L, @$AR1
0238 b871 mulx'l $AX0.H, $AX1.H : $AC0.M, @$AR1
0239 bc00 mulxac $AX0.H, $AX1.H, $ACC0
023a 0080 0050 lri $AR0, #0x0050
023c 02bf 05f5 call 0x05f5 // DmaCopy((Mem[0x0392] << 16 | Mem[0x0393]), Mem[0x03A1], 80);
023e 02df ret
// another mixer?
023f 00da 0374 lr $AX0.H, @0x0374
0241 8600 tstaxh $AX0.H
0242 0294 0258 jnz 0x0258
0244 8900 clr $ACC1
0245 0f28 lris $AC1.M, #0x28
0246 0080 0c40 lri $AR0, #0x0c40
0248 0083 0ea8 lri $AR3, #0x0ea8
024a 0098 b820 lri $AX0.L, #0xb820
024c 02bf 00ff call 0x00ff
024e 8900 clr $ACC1
024f 0f28 lris $AC1.M, #0x28
0250 0080 0c40 lri $AR0, #0x0c40
0252 0083 0f08 lri $AR3, #0x0f08
0254 0098 7fff lri $AX0.L, #0x7fff
0256 02bf 00ff call 0x00ff
0258 009f 0dc0 lri $AC1.M, #0x0dc0
025a 00ff 03a1 sr @0x03a1, $AC1.M
025c 009f 03a8 lri $AC1.M, #0x03a8
025e 00ff 03a2 sr @0x03a2, $AC1.M
0260 009f 03a4 lri $AC1.M, #0x03a4
0262 00ff 03a0 sr @0x03a0, $AC1.M
0264 1104 0282 bloopi #0x04, 0x0282
0266 00c0 03a2 lr $AR0, @0x03a2
0268 0083 0390 lri $AR3, #0x0390
026a 0f08 lris $AC1.M, #0x08
026b 02bf 00ec call 0x00ec // memcpy(0x0390, Mem[0x03A2], 8);
026d 00da 0390 lr $AX0.H, @0x0390
026f 8600 tstaxh $AX0.H
0270 0295 0274 jz 0x0274
0272 02bf 0225 call 0x0225
0274 00de 03a2 lr $AC0.M, @0x03a2
0276 0410 addis $ACC0, #0x10
0277 00fe 03a2 sr @0x03a2, $AC0.M
0279 00de 03a1 lr $AC0.M, @0x03a1
027b 0460 addis $ACC0, #0x60
027c 00fe 03a1 sr @0x03a1, $AC0.M
027e 00de 03a0 lr $AC0.M, @0x03a0
0280 7400 incm $AC0.M
0281 00fe 03a0 sr @0x03a0, $AC0.M
0283 02df ret
// CopyPBs()
// Copies some main memory region to 0x03A8
// The memory region contains what seems to be PBs...
// Each PB is 32 bytes (16 words) long
// The transfer copies 64 words, ie 4 PBs.
// There may be more PBs, though. Dunno...
0284 0081 0386 lri $AR1, #0x0386 // address of PBs, set by DsetupTable
0286 009f 03a8 lri $AC1.M, #0x03a8
0288 0080 0040 lri $AR0, #0x0040
028a 02bf 05e6 call 0x05e6 // DmaCopy(0x03A8, Dword[0x0386], 64)
028c 02df ret
// Helper
// Increment the 32-bit value at AR0 by the value
// in AX0.L.
028d 191e lrri $AC0.M, @$AR0
028e 189c lrrd $AC0.L, @$AR0
028f 4800 addax $ACC0, $AX0.L
0290 1b1e srri @$AR0, $AC0.M
0291 1b1c srri @$AR0, $AC0.L
0292 02df ret
// WaitForNextSyncMessage()
// Note: the wait loop continues until two values become non-equal.
// One of these values is set when sync mails are received.
// These mails, as well as 'regular' mails, are processed by the
// exception 7 handler. That's why that wait loop never checks for
// new mails.
0293 8100 clr $ACC0
0294 8900 clr $ACC1
0295 00df 0354 lr $AC1.M, @0x0354
0297 00de 034e lr $AC0.M, @0x034e
0299 8200 cmp
029a 0293 0293 jle 0x0293
029c 02df ret
// Opcode_02() - SyncFrame
// Message body: 5 mails
// Mail 1: bit0-15 = some number, bit16-32 = number of buffers to fill, bit24-30 = command (0x02)
// Mail 2: Address of right buffers in main memory (each buffer is 160 bytes long)
// Mail 3: Address of left buffers in main memory (each buffer is 160 bytes long)
// Mail 4: unused (zero)
// Mail 5: unused (zero)
// Stores the message body to 0x0388 and 0x0374.
// Performs mixing synchronously with the game.
029d 0080 0388 lri $AR0, #0x0388
029f 0081 0065 lri $AR1, #0x0065
02a1 0e02 lris $AC0.M, #0x02 // Copy only 2 mails. The 2 last mails are unused.
02a2 173f callr $AR1 // Copy message body to 0x0388
02a3 02bf 0476 call 0x0476 // Copy message body to 0x0374
02a5 00de 0344 lr $AC0.M, @0x0344
02a7 00fe 0341 sr @0x0341, $AC0.M
02a9 00de 0345 lr $AC0.M, @0x0345
02ab 00fe 038e sr @0x038e, $AC0.M // Mem[0x038E] = Mem[0x0345] (set by DsetupTable)
02ad 8100 clr $ACC0
02ae 00fe 0355 sr @0x0355, $AC0.M
02b0 02bf 0284 call 0x0284 // Copy 4 PBs to 0x03A8
02b2 0092 00ff lri $CR, #0x00ff
02b4 00de 0341 lr $AC0.M, @0x0341
02b6 007e 0471 bloop $AC0.M, 0x0471 // Outer loop: for(i = 0; i < number_of_buffers; i++)
02b8 02bf 0116 call 0x0116 // ClearBuffers()
02ba 02bf 01c2 call 0x01c2 // ??? mix background music? echo processing?
02bc 02bf 04e2 call 0x04e2 // ??? again a mixer?
02be 02bf 0a91 call 0x0a91 // ??? multiplications
02c0 00de 0355 lr $AC0.M, @0x0355
02c2 7400 incm $AC0.M // increment some counter
02c3 00fe 0355 sr @0x0355, $AC0.M
02c5 8100 clr $ACC0
02c6 00fe 0354 sr @0x0354, $AC0.M // reset some counter
02c8 00de 0342 lr $AC0.M, @0x0342
02ca 007e 0415 bloop $AC0.M, 0x0415 // Inner loop: for(j = 0; j < max (usually 64; set by DsetupTable); j++)
02cc 02bf 0293 call 0x0293 // WaitForNextSyncMessage()
02ce 8100 clr $ACC0
02cf 8900 clr $ACC1
02d0 00de 0354 lr $AC0.M, @0x0354
02d2 147c lsr $ACC0, #-4
02d3 0200 04fc addi $AC0.M, #0x04fc
02d5 1c1e mrr $AR0, $AC0.M
02d6 181f lrr $AC1.M, @$AR0
02d7 00de 0354 lr $AC0.M, @0x0354
02d9 0240 000f andi $AC0.M, #0x000f
02db 3d80 andc'ls $AC1.M : $AX0.L, $AC0.M
02dc 03c0 8000 andcf $AC1.M, #0x8000
02de 029c 0411 jlnz 0x0411 // skip if (AC1.M & 0x8000) != 0x8000
02e0 00d8 0354 lr $AX0.L, @0x0354
02e2 009a 0180 lri $AX0.H, #0x0180
02e4 8100 clr $ACC0
02e5 00de 0380 lr $AC0.M, @0x0380
02e7 00dc 0381 lr $AC0.L, @0x0381
02e9 9000 mul $AX0.L, $AX0.H
02ea 9400 mulac $AX0.L, $AX0.H, $ACC0 // ACC0 += (j * 384);
02eb 00fe 034c sr @0x034c, $AC0.M
02ed 00fc 034d sr @0x034d, $AC0.L
02ef 02bf 00cc call 0x00cc // read PB; dma transfer from (Dword[0x0380] + (j*384)) to 0x0400, 192 words
02f1 00da 0400 lr $AX0.H, @0x0400
02f3 8600 tstaxh $AX0.H
02f4 0295 0411 jz 0x0411 // skip if Mem[0x0400] is zero
02f6 00da 0401 lr $AX0.H, @0x0401
02f8 8600 tstaxh $AX0.H
02f9 0294 0411 jnz 0x0411 // skip if Mem[0x0401] is nonzero
02fb 00da 0433 lr $AX0.H, @0x0433
02fd 00fa 03f8 sr @0x03f8, $AX0.H // Mem[0x03F8] = Mem[0x0433]
02ff 00da 0406 lr $AX0.H, @0x0406
0301 8600 tstaxh $AX0.H
0302 0294 0ef5 jnz 0x0ef5 // jump to 0x0EF5 if Mem[0x0406] is nonzero
0304 8100 clr $ACC0
0305 00de 0480 lr $AC0.M, @0x0480 // switch (Mem[0x0480]) ; sound format?
0307 0609 cmpis $ACC0, #0x09 // case 0x09: (smg)
0308 0295 031b jz 0x031b
030a 0605 cmpis $ACC0, #0x05 // case 0x05:
030b 0295 031b jz 0x031b
030d 0608 cmpis $ACC0, #0x08 // case 0x08:
030e 0295 0ac1 jz 0x0ac1
0310 0610 cmpis $ACC0, #0x10 // case 0x10: (smg)
0311 0295 0b3e jz 0x0b3e
0313 0620 cmpis $ACC0, #0x20 // case 0x20:
0314 0295 0baf jz 0x0baf
0316 0621 cmpis $ACC0, #0x21 // case 0x21:
0317 0295 0bb7 jz 0x0bb7
0319 029f 09ae jmp 0x09ae // default:
// sound types 9 and 5
// no compression?
031b 00d8 0402 lr $AX0.L, @0x0402 // 0x0D71
031d 8100 clr $ACC0
031e 8900 clr $ACC1
031f 00dc 0430 lr $AC0.L, @0x0430 // 0x0000
0321 8d00 set15
0322 0950 lris $AX1.L, #0x50
0323 a000 mulx $AX0.L, $AX1.L
0324 a400 mulxac $AX0.L, $AX1.L, $ACC0
0325 1404 lsl $ACC0, #4 // ACC0 = (Mem[0x0430] + (Mem[0x0402] * 80)) << 4; (AC0.L = 0x3500; AC0.M = 0x0043; AC0.H = 0x00;)
0326 8c00 clr15
0327 1ffe mrr $AC1.M, $AC0.M // AC1.M = 0x0043;
0328 0083 0580 lri $AR3, #0x0580 // AR3 = 0x0580;
032a 02bf 086e call 0x086e
032c 029f 032e jmp 0x032e
032e 0080 0580 lri $AR0, #0x0580
0330 0081 0520 lri $AR1, #0x0520
0332 0099 0000 lri $AX1.L, #0x0000
0334 02bf 0e75 call 0x0e75 // store ramp
0336 009e 0520 lri $AC0.M, #0x0520
0338 00fe 038f sr @0x038f, $AC0.M // Mem[0x038F] = 0x0520;
033a 8900 clr $ACC1
033b 00df 0484 lr $AC1.M, @0x0484
033d 0340 001f andi $AC1.M, #0x001f
033f b900 tst $ACC1
0340 0295 0366 jz 0x0366
0342 00de 038f lr $AC0.M, @0x038f
0344 5c00 sub $ACC0, $AC1.L
0345 00fe 038f sr @0x038f, $AC0.M // Mem[0x038F] -= AC1.L; uh?
0347 1c7e mrr $AR3, $AC0.M
0348 0080 0440 lri $AR0, #0x0440
034a 05fe addis $ACC1, #0xfe
034b 02bf 00e5 call 0x00e5 // ???
034d 0080 0490 lri $AR0, #0x0490
034f 00c1 038f lr $AR1, @0x038f
0351 8900 clr $ACC1
0352 00df 0484 lr $AC1.M, @0x0484
0354 0340 001f andi $AC1.M, #0x001f
0356 02bf 0c62 call 0x0c62 // ???
0358 00de 038f lr $AC0.M, @0x038f
035a 0450 addis $ACC0, #0x50
035b 1c1e mrr $AR0, $AC0.M
035c 0083 0440 lri $AR3, #0x0440
035e 8900 clr $ACC1
035f 00df 0484 lr $AC1.M, @0x0484
0361 0340 001f andi $AC1.M, #0x001f
0363 05fe addis $ACC1, #0xfe
0364 02bf 00e5 call 0x00e5 // ???
0366 00de 0484 lr $AC0.M, @0x0484
0368 0240 0020 andi $AC0.M, #0x0020
036a 0295 0388 jz 0x0388
036c 0080 04a4 lri $AR0, #0x04a4
036e 00c1 038f lr $AR1, @0x038f
0370 0082 0454 lri $AR2, #0x0454
0372 0083 04a7 lri $AR3, #0x04a7
0374 18fa lrrd $AX0.H, @$AR3
0375 8600 tstaxh $AX0.H
0376 0294 0386 jnz 0x0386
0378 18fa lrrd $AX0.H, @$AR3
0379 8600 tstaxh $AX0.H
037a 0294 0386 jnz 0x0386
037c 18fa lrrd $AX0.H, @$AR3
037d 8600 tstaxh $AX0.H
037e 0294 0386 jnz 0x0386
0380 8100 clr $ACC0
0381 18fe lrrd $AC0.M, @$AR3
0382 0280 7fff cmpi $AC0.M, #0x7fff
0384 0295 0388 jz 0x0388
0386 02bf 0c7d call 0x0c7d // ???
0388 8100 clr $ACC0
0389 00de 042c lr $AC0.M, @0x042c // 0x0001
038b b100 tst $ACC0
038c 0295 0392 jz 0x0392
038e 02bf 0dc3 call 0x0dc3 // ???
0390 029f 0407 jmp 0x0407
0392 8100 clr $ACC0
0393 1c9e mrr $IX0, $AC0.M
0394 1cde mrr $IX2, $AC0.M
0395 7400 incm $AC0.M
0396 1cfe mrr $IX3, $AC0.M
0397 8100 clr $ACC0
0398 00de 0407 lr $AC0.M, @0x0407
039a b100 tst $ACC0
039b 0295 03aa jz 0x03aa
039d 00c3 038f lr $AR3, @0x038f
039f 0007 dar $AR3
03a0 0080 0477 lri $AR0, #0x0477
03a2 0084 ffff lri $IX0, #0xffff
03a4 0087 ffff lri $IX3, #0xffff
03a6 199a lrrn $AX0.H, @$AR0
03a7 6554 movr'ln $ACC1, $AX0.H : $AX0.H, @$AR0
03a8 005e loop $AC0.M
03a9 65ad movr'lsnm $ACC1, $AX0.H : $AX0.H, $AC1.M
03aa 00da 0485 lr $AX0.H, @0x0485
03ac 8600 tstaxh $AX0.H
03ad 0295 03c0 jz 0x03c0
03af 8900 clr $ACC1
03b0 0086 0005 lri $IX2, #0x0005
03b2 0082 040a lri $AR2, #0x040a
03b4 1106 03b8 bloopi #0x06, 0x03b8
03b6 18de lrrd $AC0.M, @$AR2
03b7 147f lsr $ACC0, #-1
03b8 4d36 add'sn $ACC1, $AC0.L : @$AR2, $AC0.M
03b9 b900 tst $ACC1
03ba 0294 03c0 jnz 0x03c0
03bc 009a 0001 lri $AX0.H, #0x0001
03be 00fa 0401 sr @0x0401, $AX0.H // Key Off
03c0 8f00 set40
03c1 0086 0002 lri $IX2, #0x0002
03c3 0082 0408 lri $AR2, #0x0408
03c5 1106 03f0 bloopi #0x06, 0x03f0
03c7 8100 clr $ACC0
03c8 195e lrri $AC0.M, @$AR2
03c9 1200 sbclr #0x00
03ca b100 tst $ACC0
03cb 0275 ifz
03cc 1300 sbset #0x00
03cd 1c7e mrr $AR3, $AC0.M
03ce 195e lrri $AC0.M, @$AR2
03cf 195f lrri $AC1.M, @$AR2
03d0 5c00 sub $ACC0, $AC1.L
03d1 14fb asr $ACC0, #-5
03d2 1f5e mrr $AX0.H, $AC0.M
03d3 1f1c mrr $AX0.L, $AC0.L
03d4 185e lrr $AC0.M, @$AR2
03d5 0240 00ff andi $AC0.M, #0x00ff
03d7 1f7e mrr $AX1.H, $AC0.M
03d8 185e lrr $AC0.M, @$AR2
03d9 1478 lsr $ACC0, #-8
03da 009c 0000 lri $AC0.L, #0x0000
03dc d100 cmpar $ACC1, $AX0.H
03dd 0295 03e5 jz 0x03e5
03df 185e lrr $AC0.M, @$AR2
03e0 0272 ifg
03e1 7400 incm $AC0.M
03e2 0271 ifs
03e3 7800 decm $AC0.M
03e4 1a5e srr @$AR2, $AC0.M
03e5 0006 dar $AR2
03e6 00de 038f lr $AC0.M, @0x038f
03e8 5600 subr $ACC0, $AX1.H
03e9 029d 03ee jlz 0x03ee
03eb 1c1e mrr $AR0, $AC0.M
03ec 02bf 0d99 call 0x0d99 // ???
03ee 0000 nop
03ef 1b5f srri @$AR2, $AC1.M
03f0 000a iar $AR2
03f1 8e00 set16
03f2 8100 clr $ACC0
03f3 00de 0407 lr $AC0.M, @0x0407
03f5 b100 tst $ACC0
03f6 0295 0407 jz 0x0407
03f8 00c3 038f lr $AR3, @0x038f
03fa 0087 004f lri $IX3, #0x004f
03fc 001f addarn $AR3, $IX3
03fd 0080 0477 lri $AR0, #0x0477
03ff 0084 ffff lri $IX0, #0xffff
0401 0087 ffff lri $IX3, #0xffff
0403 19fa lrrn $AX0.H, @$AR3
0404 6557 movr'ln $ACC1, $AX0.H : $AX0.H, @$AR3
0405 005e loop $AC0.M
0406 65af movr'slnm $ACC1, $AX0.H : $AC1.M, $AX0.H
0407 00da 0406 lr $AX0.H, @0x0406
0409 8600 tstaxh $AX0.H
040a 0294 040f jnz 0x040f // skip zeroing of Mem[0x0404] if Mem[0x0406] is nonzero
040c 8100 clr $ACC0
040d 00fe 0404 sr @0x0404, $AC0.M // Mem[0x0404] = 0x0000;
040f 02bf 00d5 call 0x00d5 // write back PB
0411 00de 0354 lr $AC0.M, @0x0354
0413 7400 incm $AC0.M // increment some counter
0414 00fe 0354 sr @0x0354, $AC0.M
// end of inner loop
0416 0e00 lris $AC0.M, #0x00
0417 00fe 034e sr @0x034e, $AC0.M
0419 0e04 lris $AC0.M, #0x04
041a 02bf 079b call 0x079b // SendMail_DCD1(0x0004)
041c 00de 0355 lr $AC0.M, @0x0355
041e 0260 ff00 ori $AC0.M, #0xff00
0420 02bf 07a5 call 0x07a5 // SendMail_F355(0xFF00 | Mem[0x0355])
0422 02bf 0d1f call 0x0d1f // ???
0424 02bf 0d31 call 0x0d31 // ???
0426 02bf 0d86 call 0x0d86 // perform mults on buffer #1
0428 00de 0341 lr $AC0.M, @0x0341
042a 7800 decm $AC0.M // decrement some counter
042b 00fe 0341 sr @0x0341, $AC0.M
042d 0080 09a0 lri $AR0, #0x09a0
042f 0083 0d00 lri $AR3, #0x0d00
0431 0f50 lris $AC1.M, #0x50
0432 0098 5a82 lri $AX0.L, #0x5a82
0434 02bf 00ff call 0x00ff // operations on right buffer
0436 0080 09a0 lri $AR0, #0x09a0
0438 0083 0d60 lri $AR3, #0x0d60
043a 0f50 lris $AC1.M, #0x50
043b 02bf 00ff call 0x00ff // operations on left buffer
043d 0083 0d00 lri $AR3, #0x0d00
043f 02bf 0db1 call 0x0db1 // operations on right buffer
0441 0081 0388 lri $AR1, #0x0388
0443 009f 0d00 lri $AC1.M, #0x0d00
0445 0080 0050 lri $AR0, #0x0050
0447 02bf 05f3 call 0x05f3 // DmaCopy(Dword[0x0388], 0x0D00, 80); Copy the final right buffer to main memory
0449 0080 0fa0 lri $AR0, #0x0fa0
044b 0083 0d60 lri $AR3, #0x0d60
044d 0f50 lris $AC1.M, #0x50
044e 0098 8000 lri $AX0.L, #0x8000
0450 02bf 00ff call 0x00ff // operations on left buffer (uh? again?)
0452 0083 0d60 lri $AR3, #0x0d60
0454 02bf 0db1 call 0x0db1 // operations on left buffer
0456 0081 038a lri $AR1, #0x038a
0458 009f 0d60 lri $AC1.M, #0x0d60
045a 0080 0050 lri $AR0, #0x0050
045c 02bf 05f3 call 0x05f3 // DmaCopy(Dword[0x038A], 0x0D60, 80); Copy the final left buffer to main memory
045e 009a 0000 lri $AX0.H, #0x0000
0460 0098 00a0 lri $AX0.L, #0x00a0
0462 0080 0388 lri $AR0, #0x0388
0464 02bf 028d call 0x028d // Increment right buffer address
0466 0080 038a lri $AR0, #0x038a
0468 02bf 028d call 0x028d // Increment left buffer address
046a 02bf 023f call 0x023f // call that other mixer
046c 02bf 04b1 call 0x04b1
046e 02bf 0488 call 0x0488 // copy other buffers to main memory
0470 0000 nop
0471 0000 nop
// end of outer loop
0472 0080 002b lri $AR0, #0x002b
0474 029f 0734 jmp 0x0734
// copy the message body to 0x0374
0476 0080 0374 lri $AR0, #0x0374
0478 0e02 lris $AC0.M, #0x02
0479 02bf 0067 call 0x0067
047b 00de 0374 lr $AC0.M, @0x0374
047d 0240 7fff andi $AC0.M, #0x7fff
047f 00fe 0374 sr @0x0374, $AC0.M
0481 00de 0376 lr $AC0.M, @0x0376
0483 0240 7fff andi $AC0.M, #0x7fff
0485 00fe 0376 sr @0x0376, $AC0.M
0487 02df ret
// copy other buffers to main memory
// that's probably why the mail body of cmd 0x02 is copied
// to two locations...
0488 00da 0374 lr $AX0.H, @0x0374
048a 8600 tstaxh $AX0.H // Return immediately if right buffer address is zero
048b 02d5 retz // But what happens if the left buffer address is zero?
048c 0083 0f40 lri $AR3, #0x0f40
048e 02bf 0db1 call 0x0db1 // copy right buffer
0490 0083 0ca0 lri $AR3, #0x0ca0
0492 02bf 0db1 call 0x0db1 // copy left buffer
0494 0081 0374 lri $AR1, #0x0374
0496 009f 0f40 lri $AC1.M, #0x0f40
0498 0080 0050 lri $AR0, #0x0050
049a 02bf 05f3 call 0x05f3 // DmaCopy(Dword[0x0374], 0x0F40, 80); Right buffer
049c 0081 0376 lri $AR1, #0x0376
049e 009f 0ca0 lri $AC1.M, #0x0ca0
04a0 0080 0050 lri $AR0, #0x0050
04a2 02bf 05f3 call 0x05f3 // DmaCopy(Dword[0x0376], 0x0CA0, 80); Left buffer
04a4 009a 0000 lri $AX0.H, #0x0000
04a6 0098 00a0 lri $AX0.L, #0x00a0
04a8 0080 0374 lri $AR0, #0x0374
04aa 02bf 028d call 0x028d // Increment right buffer address
04ac 0080 0376 lri $AR0, #0x0376
04ae 02bf 028d call 0x028d // Increment left buffer address
04b0 02df ret
//
04b1 00da 0374 lr $AX0.H, @0x0374
04b3 8600 tstaxh $AX0.H
04b4 02d5 retz
04b5 009f 0be0 lri $AC1.M, #0x0be0
04b7 00ff 03a1 sr @0x03a1, $AC1.M
04b9 00df 03ca lr $AC1.M, @0x03ca
04bb 00ff 0392 sr @0x0392, $AC1.M
04bd 00df 03cb lr $AC1.M, @0x03cb
04bf 00ff 0393 sr @0x0393, $AC1.M
04c1 009f 03a6 lri $AC1.M, #0x03a6
04c3 00ff 03a0 sr @0x03a0, $AC1.M
04c5 00df 03c9 lr $AC1.M, @0x03c9
04c7 00ff 0391 sr @0x0391, $AC1.M
04c9 02bf 0225 call 0x0225
04cb 009f 0c40 lri $AC1.M, #0x0c40
04cd 00ff 03a1 sr @0x03a1, $AC1.M
04cf 00df 03da lr $AC1.M, @0x03da
04d1 00ff 0392 sr @0x0392, $AC1.M
04d3 00df 03db lr $AC1.M, @0x03db
04d5 00ff 0393 sr @0x0393, $AC1.M
04d7 009f 03a7 lri $AC1.M, #0x03a7
04d9 00ff 03a0 sr @0x03a0, $AC1.M
04db 00df 03d9 lr $AC1.M, @0x03d9
04dd 00ff 0391 sr @0x0391, $AC1.M
04df 02bf 0225 call 0x0225
04e1 02df ret
// mixer?
04e2 00da 0374 lr $AX0.H, @0x0374 // Check if right buffer address is zero
04e4 8600 tstaxh $AX0.H
04e5 02d5 retz
04e6 00da 03d8 lr $AX0.H, @0x03d8 // uh?
04e8 8600 tstaxh $AX0.H
04e9 02d5 retz
04ea 0083 0be0 lri $AR3, #0x0be0
04ec 0080 0c30 lri $AR0, #0x0c30
04ee 0f04 lris $AC1.M, #0x04
04ef 02bf 00ec call 0x00ec // memcpy(0x0BE0, 0x0C30, 4);
04f1 0083 0c40 lri $AR3, #0x0c40
04f3 0080 0c90 lri $AR0, #0x0c90
04f5 0f04 lris $AC1.M, #0x04
04f6 02bf 00ec call 0x00ec // memcpy(0x0C40, 0x0C90, 4);
04f8 00df 03ca lr $AC1.M, @0x03ca
04fa 00ff 0392 sr @0x0392, $AC1.M
04fc 00df 03cb lr $AC1.M, @0x03cb
04fe 00ff 0393 sr @0x0393, $AC1.M
0500 00df 03a6 lr $AC1.M, @0x03a6
0502 7500 incm $AC1.M
0503 1f5f mrr $AX0.H, $AC1.M
0504 009f 0be8 lri $AC1.M, #0x0be8
0506 02bf 016c call 0x016c
0508 00df 03da lr $AC1.M, @0x03da
050a 00ff 0392 sr @0x0392, $AC1.M
050c 00df 03db lr $AC1.M, @0x03db
050e 00ff 0393 sr @0x0393, $AC1.M
0510 00df 03a7 lr $AC1.M, @0x03a7
0512 7500 incm $AC1.M
0513 1f5f mrr $AX0.H, $AC1.M
0514 009f 0c48 lri $AC1.M, #0x0c48
0516 02bf 016c call 0x016c
0518 00de 03c8 lr $AC0.M, @0x03c8
051a 02a0 0001 andf $AC0.M, #0x0001
051c 029d 0525 jlz 0x0525
051e 0080 03d0 lri $AR0, #0x03d0
0520 0e08 lris $AC0.M, #0x08
0521 0081 0be0 lri $AR1, #0x0be0
0523 02bf 0c43 call 0x0c43
0525 00de 03d8 lr $AC0.M, @0x03d8
0527 02a0 0001 andf $AC0.M, #0x0001
0529 029d 0532 jlz 0x0532
052b 0080 03e0 lri $AR0, #0x03e0
052d 0e08 lris $AC0.M, #0x08
052e 0081 0c40 lri $AR1, #0x0c40
0530 02bf 0c43 call 0x0c43
0532 0f50 lris $AC1.M, #0x50
0533 0080 0be0 lri $AR0, #0x0be0
0535 0083 0f40 lri $AR3, #0x0f40
0537 00d8 03cd lr $AX0.L, @0x03cd
0539 02bf 00ff call 0x00ff
053b 0f50 lris $AC1.M, #0x50
053c 0080 0c40 lri $AR0, #0x0c40
053e 0083 0ca0 lri $AR3, #0x0ca0
0540 00d8 03df lr $AX0.L, @0x03df
0542 02bf 00ff call 0x00ff
0544 00de 03c8 lr $AC0.M, @0x03c8
0546 02a0 0002 andf $AC0.M, #0x0002
0548 029d 0551 jlz 0x0551
054a 0080 03d0 lri $AR0, #0x03d0
054c 0e08 lris $AC0.M, #0x08
054d 0081 0be0 lri $AR1, #0x0be0
054f 02bf 0c43 call 0x0c43
0551 00de 03d8 lr $AC0.M, @0x03d8
0553 02a0 0002 andf $AC0.M, #0x0002
0555 029d 055e jlz 0x055e
0557 0080 03e0 lri $AR0, #0x03e0
0559 0e08 lris $AC0.M, #0x08
055a 0081 0c40 lri $AR1, #0x0c40
055c 02bf 0c43 call 0x0c43
055e 02df ret
// Opcode_07() -
055f 0080 0346 lri $AR0, #0x0346
0561 02bf 0065 call 0x0065
0563 02bf 0065 call 0x0065
0565 0081 0346 lri $AR1, #0x0346
0567 193e lrri $AC0.M, @$AR1
0568 193c lrri $AC0.L, @$AR1
0569 009f 0400 lri $AC1.M, #0x0400
056b 00c0 0345 lr $AR0, @0x0345
056d 02bf 05e8 call 0x05e8
056f 0081 0348 lri $AR1, #0x0348
0571 193e lrri $AC0.M, @$AR1
0572 193c lrri $AC0.L, @$AR1
0573 009f 0800 lri $AC1.M, #0x0800
0575 00c0 0345 lr $AR0, @0x0345
0577 02bf 05e8 call 0x05e8
0579 0081 0346 lri $AR1, #0x0346
057b 193e lrri $AC0.M, @$AR1
057c 193c lrri $AC0.L, @$AR1
057d 009f 0800 lri $AC1.M, #0x0800
057f 00c0 0345 lr $AR0, @0x0345
0581 02bf 05f5 call 0x05f5
0583 0081 0348 lri $AR1, #0x0348
0585 193e lrri $AC0.M, @$AR1
0586 193c lrri $AC0.L, @$AR1
0587 009f 0400 lri $AC1.M, #0x0400
0589 00c0 0345 lr $AR0, @0x0345
058b 02bf 05f5 call 0x05f5
058d 029f 0041 jmp 0x0041
// Opcode_09() -
058f 0080 0346 lri $AR0, #0x0346
0591 02bf 0065 call 0x0065
0593 02bf 0065 call 0x0065
0595 0081 0346 lri $AR1, #0x0346
0597 193e lrri $AC0.M, @$AR1
0598 193c lrri $AC0.L, @$AR1
0599 009f 0400 lri $AC1.M, #0x0400
059b 00c0 0345 lr $AR0, @0x0345
059d 02bf 05e8 call 0x05e8
059f 0081 0348 lri $AR1, #0x0348
05a1 193e lrri $AC0.M, @$AR1
05a2 193c lrri $AC0.L, @$AR1
05a3 009f 0400 lri $AC1.M, #0x0400
05a5 00c0 0345 lr $AR0, @0x0345
05a7 02bf 05f5 call 0x05f5
05a9 029f 0041 jmp 0x0041
// Opcode_08() -
05ab 0080 0346 lri $AR0, #0x0346
05ad 02bf 0065 call 0x0065
05af 02bf 0065 call 0x0065
05b1 0081 0346 lri $AR1, #0x0346
05b3 193e lrri $AC0.M, @$AR1
05b4 193c lrri $AC0.L, @$AR1
05b5 009f 0400 lri $AC1.M, #0x0400
05b7 00c0 0344 lr $AR0, @0x0344
05b9 02bf 05e8 call 0x05e8
05bb 0081 0348 lri $AR1, #0x0348
05bd 193e lrri $AC0.M, @$AR1
05be 193c lrri $AC0.L, @$AR1
05bf 009f 0800 lri $AC1.M, #0x0800
05c1 00c0 0344 lr $AR0, @0x0344
05c3 02bf 05e8 call 0x05e8
05c5 0080 0400 lri $AR0, #0x0400
05c7 0083 0800 lri $AR3, #0x0800
05c9 0084 0000 lri $IX0, #0x0000
05cb 00da 0345 lr $AX0.H, @0x0345
05cd 00df 0344 lr $AC1.M, @0x0344
05cf 8f00 set40
05d0 197b lrri $AX1.H, @$AR3
05d1 b800 mulx $AX0.H, $AX1.H
05d2 197b lrri $AX1.H, @$AR3
05d3 007f 05d8 bloop $AC1.M, 0x05d8
05d5 199e lrrn $AC0.M, @$AR0
05d6 bc00 mulxac $AX0.H, $AX1.H, $ACC0
05d7 80b2 nx'sl : $AC0.M, $AX1.H
05d8 0000 nop
05d9 8e00 set16
05da 0081 0346 lri $AR1, #0x0346
05dc 193e lrri $AC0.M, @$AR1
05dd 193c lrri $AC0.L, @$AR1
05de 009f 0400 lri $AC1.M, #0x0400
05e0 00c0 0344 lr $AR0, @0x0344
05e2 02bf 05f5 call 0x05f5
05e4 029f 0041 jmp 0x0041
// DmaCopy(destination, source, len)
// AR1 = source: pointer to the main memory (32-bit) address
// AC1.M = destination: DSP memory address
// AR0 = len: length in words
05e6 193e lrri $AC0.M, @$AR1
05e7 193c lrri $AC0.L, @$AR1
05e8 2fcd srs @DSPA, $AC1.M
05e9 0f00 lris $AC1.M, #0x00
05ea 2fc9 srs @DSCR, $AC1.M
05eb 2ece srs @DSMAH, $AC0.M
05ec 2ccf srs @DSMAL, $AC0.L
05ed 1fe0 mrr $AC1.M, $AR0
05ee 1501 lsl $ACC1, #1
05ef 2fcb srs @DSBL, $AC1.M
05f0 02bf 05f9 call 0x05f9
05f2 02df ret
// DmaCopy(destination, source, len)
// AR1 = destination: pointer to the main memory (32-bit) address
// AC1.M = source: DSP memory address
// AR0 = len: length in words
05f3 193e lrri $AC0.M, @$AR1
05f4 193c lrri $AC0.L, @$AR1
05f5 2fcd srs @DSPA, $AC1.M
05f6 0f01 lris $AC1.M, #0x01
05f7 029f 05ea jmp 0x05ea
// wait for dma completion?
05f9 26c9 lrs $AC0.M, @DSCR
05fa 02a0 0004 andf $AC0.M, #0x0004
05fc 029c 05f9 jlnz 0x05f9
05fe 02df ret
// unused dma routine
05ff 193e lrri $AC0.M, @$AR1
0600 193c lrri $AC0.L, @$AR1
0601 00ff ffcd sr @DSPA, $AC1.M
0603 0f00 lris $AC1.M, #0x00
0604 00ff ffc9 sr @DSCR, $AC1.M
0606 00fe ffce sr @DSMAH, $AC0.M
0608 00fc ffcf sr @DSMAL, $AC0.L
060a 1fe0 mrr $AC1.M, $AR0
060b 1501 lsl $ACC1, #1
060c 00ff ffcb sr @DSBL, $AC1.M
060e 02df ret
//
060f 00de ffc9 lr $AC0.M, @DSCR
0611 02a0 0004 andf $AC0.M, #0x0004
0613 029c 060f jlnz 0x060f
0615 02df ret
// Opcode_04() -
0616 0080 0346 lri $AR0, #0x0346
0618 02bf 0065 call 0x0065
061a 02bf 0065 call 0x0065 // wtf?
061c 0081 0346 lri $AR1, #0x0346
061e 00df 0349 lr $AC1.M, @0x0349
0620 0340 ffff andi $AC1.M, #0xffff
0622 00c0 0345 lr $AR0, @0x0345
0624 02bf 05e6 call 0x05e6 // DmaCopy(0x0349, Dword[0x0346], Mem[0x0345])
0626 029f 0041 jmp 0x0041
// Opcode_05() -
0628 0080 0346 lri $AR0, #0x0346
062a 02bf 0065 call 0x0065
062c 02bf 0065 call 0x0065 // wtf?
062e 0081 0346 lri $AR1, #0x0346
0630 00df 0349 lr $AC1.M, @0x0349
0632 0340 ffff andi $AC1.M, #0xffff
0634 00c0 0345 lr $AR0, @0x0345
0636 02bf 05f3 call 0x05f3
0638 029f 0041 jmp 0x0041
// ReadSoundData(addr)
// AC0.M:AC0.L = main memory address
// read 128 samples of PCM8 sound from main memory to DSP memory at 0x0B00
063a 1ffc mrr $AC1.M, $AC0.L
063b 0340 001f andi $AC1.M, #0x001f
063d 00ff 037f sr @0x037f, $AC1.M
063f 1ffc mrr $AC1.M, $AC0.L
0640 0340 ffe0 andi $AC1.M, #0xffe0
0642 1f9f mrr $AC0.L, $AC1.M
0643 00df 037d lr $AC1.M, @0x037d
0645 00dd 037e lr $AC1.L, @0x037e
0647 4c00 add $ACC0, $AC1.L
0648 00fe ffce sr @DSMAH, $AC0.M
064a 00fc ffcf sr @DSMAL, $AC0.L
064c 0f00 lris $AC1.M, #0x00
064d 00ff ffc9 sr @DSCR, $AC1.M
064f 009f 0b20 lri $AC1.M, #0x0b20
0651 00ff ffcd sr @DSPA, $AC1.M
0653 0f40 lris $AC1.M, #0x40
0654 00ff ffcb sr @DSBL, $AC1.M
0656 00de ffc9 lr $AC0.M, @DSCR
0658 02a0 0004 andf $AC0.M, #0x0004
065a 029c 0656 jlnz 0x0656
065c 1fe1 mrr $AC1.M, $AR1
065d 0081 0b00 lri $AR1, #0x0b00 // Dst = 0x0B00;
065f 0080 0b20 lri $AR0, #0x0b20 // Src = 0x0B20;
// for(i = 0; i < 32; i++)
0661 1120 066a bloopi #0x20, 0x066a
0663 8100 clr $ACC0
0664 191e lrri $AC0.M, @$AR0
0665 1478 lsr $ACC0, #-8
0666 1b3e srri @$AR1, $AC0.M // Dst[i*2] = Src[i] >> 8;
0667 1408 lsl $ACC0, #8
0668 0240 00ff andi $AC0.M, #0x00ff
066a 1b3e srri @$AR1, $AC0.M // Dst[i*2 + 1] = Src[i] & 0xFF;
066b 1c3f mrr $AR1, $AC1.M // Keep AR1 value to 0x0B00
066c 029f 092b jmp 0x092b
066e 02df ret
// dma?
066f 1fc3 mrr $AC0.M, $AR3
0670 043f addis $ACC0, #0x3f
0671 0240 fff0 andi $AC0.M, #0xfff0
0673 00fe ffcd sr @DSPA, $AC0.M
0675 1c1a mrr $AR0, $AX0.H
0676 00da 037f lr $AX0.H, @0x037f
0678 4400 addr $ACC0, $AX0.H
0679 1f40 mrr $AX0.H, $AR0
067a 1c1e mrr $AR0, $AC0.M
067b 1fda mrr $AC0.M, $AX0.H
067c 041f addis $ACC0, #0x1f
067d 0240 fff0 andi $AC0.M, #0xfff0
067f 1401 lsl $ACC0, #1
0680 00fe ffcb sr @DSBL, $AC0.M
0682 00de ffc9 lr $AC0.M, @DSCR
0684 02a0 0004 andf $AC0.M, #0x0004
0686 029c 0682 jlnz 0x0682
0688 007a 068b bloop $AX0.H, 0x068b
068a 191e lrri $AC0.M, @$AR0
068b 1b7e srri @$AR3, $AC0.M
068c 02df ret
// setup DSMAH, DSMAL and DSCR (RAM -> DSP memory)
068d 8900 clr $ACC1
068e 1ffc mrr $AC1.M, $AC0.L
068f 0340 001f andi $AC1.M, #0x001f
0691 00ff 037f sr @0x037f, $AC1.M
0693 1ffc mrr $AC1.M, $AC0.L
0694 0340 ffe0 andi $AC1.M, #0xffe0 // addr &= 0xFFFFFFE0;
0696 1f9f mrr $AC0.L, $AC1.M
0697 00df 037d lr $AC1.M, @0x037d // 0x1000
0699 00dd 037e lr $AC1.L, @0x037e // 0x0800
069b 4c00 add $ACC0, $AC1.L // addr += 0x10000800;
069c 00fe ffce sr @DSMAH, $AC0.M
069e 00fc ffcf sr @DSMAL, $AC0.L
06a0 0f00 lris $AC1.M, #0x00
06a1 00ff ffc9 sr @DSCR, $AC1.M
06a3 02df ret
// setup DSPA and DSBL (and thus complete DMA transfer)
// memory transferred is stored (temporarily) to 0x0780
// then it's copied to the address specified by AR3
06a4 00df 037f lr $AC1.M, @0x037f
06a6 157f lsr $ACC1, #-1
06a7 00ff 037f sr @0x037f, $AC1.M
06a9 02df ret
06aa 8600 tstaxh $AX0.H
06ab 02d5 retz
06ac 1f1a mrr $AX0.L, $AX0.H
06ad 009e 0780 lri $AC0.M, #0x0780
06af 00fe ffcd sr @DSPA, $AC0.M
06b1 1fda mrr $AC0.M, $AX0.H
06b2 043f addis $ACC0, #0x3f
06b3 0240 ffe0 andi $AC0.M, #0xffe0
06b5 00fe ffcb sr @DSBL, $AC0.M
06b7 00de ffc9 lr $AC0.M, @DSCR
06b9 02a0 0004 andf $AC0.M, #0x0004
06bb 029c 06b7 jlnz 0x06b7
06bd 8100 clr $ACC0
06be 00de 037f lr $AC0.M, @0x037f
06c0 147f lsr $ACC0, #-1
06c1 0200 0780 addi $AC0.M, #0x0780
06c3 1c1e mrr $AR0, $AC0.M
06c4 00de 037f lr $AC0.M, @0x037f
06c6 02a0 0001 andf $AC0.M, #0x0001
06c8 029d 06d1 jlz 0x06d1
06ca 8100 clr $ACC0
06cb 191e lrri $AC0.M, @$AR0
06cc 1488 asl $ACC0, #8
06cd 1b7e srri @$AR3, $AC0.M
06ce 1fda mrr $AC0.M, $AX0.H
06cf 7800 decm $AC0.M
06d0 1f5e mrr $AX0.H, $AC0.M
06d1 8100 clr $ACC0
06d2 1fda mrr $AC0.M, $AX0.H
06d3 147f lsr $ACC0, #-1
06d4 007e 06dd bloop $AC0.M, 0x06dd
06d6 8100 clr $ACC0
06d7 181e lrr $AC0.M, @$AR0
06d8 0240 ff00 andi $AC0.M, #0xff00
06da 1b7e srri @$AR3, $AC0.M
06db 191e lrri $AC0.M, @$AR0
06dc 1488 asl $ACC0, #8
06dd 1b7e srri @$AR3, $AC0.M
06de 1fda mrr $AC0.M, $AX0.H
06df 1f58 mrr $AX0.H, $AX0.L
06e0 02a0 0001 andf $AC0.M, #0x0001
06e2 02dd retlz
06e3 8100 clr $ACC0
06e4 181e lrr $AC0.M, @$AR0
06e5 0240 ff00 andi $AC0.M, #0xff00
06e7 1b7e srri @$AR3, $AC0.M
06e8 02df ret
// Exception_0E()
06e9 1205 sbclr #0x05
06ea 8e00 set16
06eb 00f0 03fd sr @0x03fd, $AC0.H
06ed 00fc 03ff sr @0x03ff, $AC0.L
06ef f400 lsr16 $ACC0
06f0 00fc 03fe sr @0x03fe, $AC0.L
06f2 00fa 03fa sr @0x03fa, $AX0.H
06f4 8100 clr $ACC0
06f5 00de fffe lr $AC0.M, @CMBH // check for new mail
06f7 02c0 8000 andcf $AC0.M, #0x8000
06f9 029c 07ea jlnz 0x07ea // If we received no mail
06fb 00da ffff lr $AX0.H, @CMBL
06fd 8600 tstaxh $AX0.H
06fe 0294 07c3 jnz 0x07c3 // If we received a mail beginning a list, WaitForNextMails()
0700 00de fffe lr $AC0.M, @CMBH // if we received an empty mail, wait for the next mail
0702 02c0 8000 andcf $AC0.M, #0x8000
0704 029c 0700 jlnz 0x0700
0706 0240 000f andi $AC0.M, #0x000f // get the number in the high part of the mail
0708 1f5e mrr $AX0.H, $AC0.M
0709 7400 incm $AC0.M // number++;
070a 0c00 lris $AC0.L, #0x00
070b 1404 lsl $ACC0, #4 // number <<= 4;
070c 00fe 034e sr @0x034e, $AC0.M
070e 1fda mrr $AC0.M, $AX0.H
070f 1f40 mrr $AX0.H, $AR0
0710 0200 04fc addi $AC0.M, #0x04fc
0712 1c1e mrr $AR0, $AC0.M
0713 00de ffff lr $AC0.M, @CMBL
0715 1a1e srr @$AR0, $AC0.M
0716 1c1a mrr $AR0, $AX0.H
0717 00de 03fe lr $AC0.M, @0x03fe
0719 00dc 03ff lr $AC0.L, @0x03ff
071b 00d0 03fd lr $AC0.H, @0x03fd
071d 00da 03fa lr $AX0.H, @0x03fa
071f 1305 sbset #0x05
0720 02ff rti
// DoYield()
0721 009a 0002 lri $AX0.H, #0x0002
0723 00fa 03a3 sr @0x03a3, $AX0.H
0725 00e0 03f9 sr @0x03f9, $AR0
0727 02bf 07ad call 0x07ad
0729 16fc dcd1 si @DMBH, #0xdcd1
072b 16fd 0002 si @DMBL, #0x0002
072d 16fb 0001 si @DIRQ, #0x0001
072f 0021 halt
// Function jump table
0730 0748 cmpis $ACC1, #0x48 // Function 0: halt
0731 0749 cmpis $ACC1, #0x49 // Function 1: dump memory? and halt
0732 0789 cmpis $ACC1, #0x89 // Function 2: jump to 0x8000 and halt
0733 078c cmpis $ACC1, #0x8c // Function 3: return to MessageLoop()
// Execute function according to mail received (0xCDD1000X)
// Warning: any function number above 3 will likely crash
// as no range check is performed.
// AR0 = 0x002B
0734 00e0 03f9 sr @0x03f9, $AR0
0736 009e 0005 lri $AC0.M, #0x0005
0738 02bf 079b call 0x079b // SendMail_DCD1(0x0005)
073a 8e00 set16
073b 8100 clr $ACC0
073c 8900 clr $ACC1
073d 02bf 078f call 0x078f // WaitUntilCPUMailboxIsFull_AC0()
073f 27ff lrs $AC1.M, @CMBL
0740 009e 0730 lri $AC0.M, #0x0730
0742 4c00 add $ACC0, $AC1.L
0743 1c7e mrr $AR3, $AC0.M
0744 0313 ilrr $AC1.M, @$AR3
0745 1c7f mrr $AR3, $AC1.M
0746 176f jmpr $AR3
0747 0021 halt
// Function 0
0748 0021 halt
// Function 1
0749 009a 0002 lri $AX0.H, #0x0002
074b 00fa 03a3 sr @0x03a3, $AX0.H
074d 8100 clr $ACC0
074e 8900 clr $ACC1
074f 02bf 078f call 0x078f // WaitUntilCPUMailboxIsFull_AC0()
0751 24ff lrs $AC0.L, @CMBL
0752 02bf 0795 call 0x0795 // WaitUntilCPUMailboxIsFull_AC1()
0754 25ff lrs $AC1.L, @CMBL
0755 02bf 0795 call 0x0795 // WaitUntilCPUMailboxIsFull_AC1()
0757 27ff lrs $AC1.M, @CMBL
0758 2ece srs @DSMAH, $AC0.M
0759 2ccf srs @DSMAL, $AC0.L
075a 16c9 0001 si @DSCR, #0x0001
075c 2fcd srs @DSPA, $AC1.M
075d 2dcb srs @DSBL, $AC1.L
075e 8100 clr $ACC0
075f 8900 clr $ACC1
0760 02bf 078f call 0x078f // WaitUntilCPUMailboxIsFull_AC0()
0762 24ff lrs $AC0.L, @CMBL
0763 1c9e mrr $IX0, $AC0.M
0764 1cbc mrr $IX1, $AC0.L
0765 02bf 0795 call 0x0795 // WaitUntilCPUMailboxIsFull_AC1()
0767 25ff lrs $AC1.L, @CMBL
0768 02bf 0795 call 0x0795 // WaitUntilCPUMailboxIsFull_AC1()
076a 27ff lrs $AC1.M, @CMBL
076b 1cdf mrr $IX2, $AC1.M
076c 1cfd mrr $IX3, $AC1.L
076d 8100 clr $ACC0
076e 02bf 078f call 0x078f // WaitUntilCPUMailboxIsFull_AC0()
0770 26ff lrs $AC0.M, @CMBL
0771 1c1e mrr $AR0, $AC0.M
0772 8900 clr $ACC1
0773 02bf 0795 call 0x0795 // WaitUntilCPUMailboxIsFull_AC1()
0775 20ff lrs $AX0.L, @CMBL
0776 1f5f mrr $AX0.H, $AC1.M
0777 02bf 078f call 0x078f // WaitUntilCPUMailboxIsFull_AC0()
0779 21ff lrs $AX1.L, @CMBL
077a 02bf 078f call 0x078f // WaitUntilCPUMailboxIsFull_AC0()
077c 23ff lrs $AX1.H, @CMBL
077d 26c9 lrs $AC0.M, @DSCR
077e 02a0 0004 andf $AC0.M, #0x0004
0780 029c 077d jlnz 0x077d
0782 1206 sbclr #0x06
0783 1203 sbclr #0x03
0784 1204 sbclr #0x04
0785 1205 sbclr #0x05
0786 029f 80b5 jmp 0x80b5
0788 0021 halt
// Function 2
0789 029f 8000 jmp 0x8000
078b 0021 halt
// Function 3
078c 00c0 03f9 lr $AR0, @0x03f9
078e 170f jmpr $AR0
// WaitUntilCPUMailboxIsFull_AC0()
078f 26fe lrs $AC0.M, @CMBH
0790 02c0 8000 andcf $AC0.M, #0x8000
0792 029c 078f jlnz 0x078f
0794 02df ret
// WaitUntilCPUMailboxIsFull_AC1()
0795 27fe lrs $AC1.M, @CMBH
0796 03c0 8000 andcf $AC1.M, #0x8000
0798 029c 0795 jlnz 0x0795
079a 02df ret
// SendMail_DCD1() // seems to additionally trigger an IRQ
079b 02bf 07b3 call 0x07b3
079d 16fc dcd1 si @DMBH, #0xdcd1
079f 2efd srs @DMBL, $AC0.M
07a0 16fb 0001 si @DIRQ, #0x0001
07a2 02bf 07b3 call 0x07b3
07a4 02df ret
// SendMail_F355()
07a5 02bf 07b3 call 0x07b3
07a7 16fc f355 si @DMBH, #0xf355
07a9 2efd srs @DMBL, $AC0.M
07aa 02bf 07b3 call 0x07b3
07ac 02df ret
// WaitUntilMailboxIsReady_AC0()
07ad 26fc lrs $AC0.M, @DMBH
07ae 02c0 8000 andcf $AC0.M, #0x8000
07b0 029d 07ad jlz 0x07ad
07b2 02df ret
// WaitUntilMailboxIsReady_AC1()
07b3 27fc lrs $AC1.M, @DMBH
07b4 03c0 8000 andcf $AC1.M, #0x8000
07b6 029d 07b3 jlz 0x07b3
07b8 02df ret
// InitGlobalVars()
07b9 009a 0280 lri $AX0.H, #0x0280
07bb 00fa 0350 sr @0x0350, $AX0.H
07bd 00fa 0351 sr @0x0351, $AX0.H
07bf 0a00 lris $AX0.H, #0x00
07c0 00fa 0352 sr @0x0352, $AX0.H
07c2 02df ret
// WaitForNextMails()
// AX0.H: low part of current mail (num of mails to wait for)
07c3 00e0 03fb sr @0x03fb, $AR0
07c5 00e8 03fc sr @0x03fc, $WR0
07c7 00c0 0350 lr $AR0, @0x0350
07c9 0088 002f lri $WR0, #0x002f
07cb 1b1a srri @$AR0, $AX0.H
07cc 00de fffe lr $AC0.M, @CMBH
07ce 02c0 8000 andcf $AC0.M, #0x8000
07d0 029c 07cc jlnz 0x07cc
07d2 00dc ffff lr $AC0.L, @CMBL
07d4 1b1e srri @$AR0, $AC0.M
07d5 1b1c srri @$AR0, $AC0.L
07d6 1fda mrr $AC0.M, $AX0.H
07d7 7800 decm $AC0.M
07d8 1f5e mrr $AX0.H, $AC0.M
07d9 8600 tstaxh $AX0.H
07da 0294 07cc jnz 0x07cc
07dc 8100 clr $ACC0
07dd 00de 0352 lr $AC0.M, @0x0352
07df 7400 incm $AC0.M
07e0 00fe 0352 sr @0x0352, $AC0.M
07e2 00e0 0350 sr @0x0350, $AR0
07e4 00c0 03fb lr $AR0, @0x03fb
07e6 00c8 03fc lr $WR0, @0x03fc
07e8 029f 0717 jmp 0x0717
// noMail()
07ea 00e0 03fb sr @0x03fb, $AR0
07ec 00e8 03fc sr @0x03fc, $WR0
07ee 00c0 0350 lr $AR0, @0x0350
07f0 0088 002f lri $WR0, #0x002f
07f2 0a00 lris $AX0.H, #0x00
07f3 1b1a srri @$AR0, $AX0.H
07f4 029f 07dc jmp 0x07dc
// MessageLoop()
07f6 00c0 0351 lr $AR0, @0x0351
07f8 0088 002f lri $WR0, #0x002f
07fa 00da 0352 lr $AX0.H, @0x0352
07fc 8600 tstaxh $AX0.H
07fd 0295 081e jz 0x081e // jump back to MessageLoop
07ff 1205 sbclr #0x05
0800 00da 0352 lr $AX0.H, @0x0352
0802 1fda mrr $AC0.M, $AX0.H
0803 7800 decm $AC0.M
0804 00fe 0352 sr @0x0352, $AC0.M
0806 1305 sbset #0x05
0807 0081 0356 lri $AR1, #0x0356
0809 191e lrri $AC0.M, @$AR0
080a 02c0 8000 andcf $AC0.M, #0x8000
080c 029d 0822 jlz 0x0822 // ???
080e 1f5e mrr $AX0.H, $AC0.M
080f 8600 tstaxh $AX0.H
0810 0295 0826 jz 0x0826 // Yield()
0812 007a 0817 bloop $AX0.H, 0x0817
0814 191e lrri $AC0.M, @$AR0
0815 1b3e srri @$AR1, $AC0.M
0816 191e lrri $AC0.M, @$AR0
0817 1b3e srri @$AR1, $AC0.M
0818 00e0 0351 sr @0x0351, $AR0
081a 0088 ffff lri $WR0, #0xffff
081c 029f 002d jmp 0x002d // jump to OpcodeHandler()
081e 0088 ffff lri $WR0, #0xffff
0820 029f 002b jmp 0x002b // jump back to MessageLoop()
//
0822 00e0 0351 sr @0x0351, $AR0
0824 029f 07fa jmp 0x07fa
// Yield()
0826 0080 07f6 lri $AR0, #0x07f6
0828 029f 0721 jmp 0x0721 // DoYield() (halts)
// interesting - writes value(s) to output
082a 8100 clr $ACC0
082b 0e10 lris $AC0.M, #0x10
082c 2232 lrs $AX0.H, @0x0032
082d 8600 tstaxh $AX0.H
082e 02d5 retz
082f 5400 subr $ACC0, $AX0.H
0830 0200 0458 addi $AC0.M, #0x0458 // source addr = (0x10 - Mem[0x0032]) + 0x0458
0832 1c1e mrr $AR0, $AC0.M
0833 1fda mrr $AC0.M, $AX0.H
0834 04fe addis $ACC0, #0xfe
0835 1f1e mrr $AX0.L, $AC0.M // AX0.L = Mem[0x0032] - 2;
0836 191e lrri $AC0.M, @$AR0
0837 0291 083d js 0x083d
0839 191a lrri $AX0.H, @$AR0
083a 0058 loop $AX0.L
083b 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
083c 6433 movr's $ACC0, $AX0.H : @$AR3, $AC0.M
083d 1b7e srri @$AR3, $AC0.M // store value to output
083e 02df ret
//
083f 02bf 082a call 0x082a
0841 8100 clr $ACC0
0842 2632 lrs $AC0.M, @0x0032
0843 5c00 sub $ACC0, $AC1.L
0844 2e32 srs @0x0032, $AC0.M
0845 0092 00ff lri $CR, #0x00ff
0847 02df ret
// increment one value, then zero out other values
0848 00de 04fb lr $AC0.M, @0x04fb
084a 7400 incm $AC0.M
084b 00fe 04fb sr @0x04fb, $AC0.M
084d 8100 clr $ACC0
084e 2e32 srs @0x0032, $AC0.M
084f 2e66 srs @0x0066, $AC0.M
0850 2e67 srs @0x0067, $AC0.M
0851 268a lrs $AC0.M, @0xff8a
0852 248b lrs $AC0.L, @0xff8b
0853 2e3a srs @0x003a, $AC0.M
0854 2c3b srs @0x003b, $AC0.L
0855 268c lrs $AC0.M, @0xff8c
0856 248d lrs $AC0.L, @0xff8d
0857 2e38 srs @0x0038, $AC0.M
0858 2c39 srs @0x0039, $AC0.L
0859 02df ret
//
085a 8100 clr $ACC0
085b 2689 lrs $AC0.M, @0xff89
085c 0240 000f andi $AC0.M, #0x000f
085e 1f5e mrr $AX0.H, $AC0.M
085f 8100 clr $ACC0
0860 0e10 lris $AC0.M, #0x10
0861 5400 subr $ACC0, $AX0.H
0862 2e32 srs @0x0032, $AC0.M
0863 268a lrs $AC0.M, @0xff8a
0864 248b lrs $AC0.L, @0xff8b
0865 2288 lrs $AX0.H, @0xff88
0866 2089 lrs $AX0.L, @0xff89
0867 5800 subax $ACC0, $AX0.L
0868 0a00 lris $AX0.H, #0x00
0869 2032 lrs $AX0.L, @0x0032
086a 5800 subax $ACC0, $AX0.L
086b 2e3a srs @0x003a, $AC0.M
086c 2c3b srs @0x003b, $AC0.L
086d 02df ret
// mixer for sound types 5 and 9
// AR3 = 0x0580 (out address)
// AC1.M = 0x0043, AC1.L = 0x0000
086e 0092 0004 lri $CR, #0x0004
0870 8100 clr $ACC0
0871 2604 lrs $AC0.M, @0x0004
0872 b100 tst $ACC0
0873 02b4 0848 callne 0x0848 // nothing much interesting
0875 8100 clr $ACC0
0876 2601 lrs $AC0.M, @0x0001
0877 b100 tst $ACC0
0878 0294 0916 jnz 0x0916 // end
087a 2232 lrs $AX0.H, @0x0032
087b c900 cmpar $ACC0, $AX1.H
087c 0293 083f jle 0x083f // direct return (calls 0x082A though)
087e 5500 subr $ACC1, $AX0.H
087f 02bf 082a call 0x082a // interesting: stores value(s) to Mem[AR3] (output)
0881 223a lrs $AX0.H, @0x003a
0882 8600 tstaxh $AX0.H
0883 0294 088a jnz 0x088a
0885 8100 clr $ACC0
0886 263b lrs $AC0.M, @0x003b
0887 8200 cmp
0888 0291 08dc js 0x08dc
088a 8100 clr $ACC0
088b 1fdf mrr $AC0.M, $AC1.M
088c 040f addis $ACC0, #0x0f
088d 147c lsr $ACC0, #-4
088e 1f7e mrr $AX1.H, $AC0.M
088f 0c00 lris $AC0.L, #0x00
0890 1404 lsl $ACC0, #4
0891 1f1e mrr $AX0.L, $AC0.M
0892 0a00 lris $AX0.H, #0x00
0893 8100 clr $ACC0
0894 263a lrs $AC0.M, @0x003a
0895 243b lrs $AC0.L, @0x003b
0896 5800 subax $ACC0, $AX0.L
0897 0290 08a2 jns 0x08a2
0899 8100 clr $ACC0
089a 263b lrs $AC0.M, @0x003b
089b 5c00 sub $ACC0, $AC1.L
089c 2e32 srs @0x0032, $AC0.M
089d 8100 clr $ACC0
089e 2e3a srs @0x003a, $AC0.M
089f 2e3b srs @0x003b, $AC0.M
08a0 029f 08a8 jmp 0x08a8
08a2 2e3a srs @0x003a, $AC0.M
08a3 2c3b srs @0x003b, $AC0.L
08a4 0c00 lris $AC0.L, #0x00
08a5 1fd8 mrr $AC0.M, $AX0.L
08a6 5c00 sub $ACC0, $AC1.L
08a7 2e32 srs @0x0032, $AC0.M
08a8 8100 clr $ACC0
08a9 1fdb mrr $AC0.M, $AX1.H
08aa 02bf 091c call 0x091c // afc decoder
08ac 2232 lrs $AX0.H, @0x0032
08ad 8600 tstaxh $AX0.H
08ae 0295 08d9 jz 0x08d9 // end
08b0 0a10 lris $AX0.H, #0x10
08b1 8100 clr $ACC0
08b2 1fc3 mrr $AC0.M, $AR3
08b3 5400 subr $ACC0, $AX0.H
08b4 1c7e mrr $AR3, $AC0.M
08b5 0080 0458 lri $AR0, #0x0458
08b7 197e lrri $AC0.M, @$AR3
08b8 197a lrri $AX0.H, @$AR3
08b9 100e loopi #0x0e
08ba 64a2 movr'sl $ACC0, $AX0.H : $AC0.M, $AX0.H
08bb 1b1e srri @$AR0, $AC0.M
08bc 1b1a srri @$AR0, $AX0.H
08bd 8100 clr $ACC0
08be 263a lrs $AC0.M, @0x003a
08bf 243b lrs $AC0.L, @0x003b
08c0 b100 tst $ACC0
08c1 0294 08d9 jnz 0x08d9 // end
08c3 2232 lrs $AX0.H, @0x0032
08c4 8600 tstaxh $AX0.H
08c5 0295 08d9 jz 0x08d9 // end
08c7 0080 0467 lri $AR0, #0x0467
08c9 8100 clr $ACC0
08ca 268b lrs $AC0.M, @0xff8b
08cb b100 tst $ACC0
08cc 0295 08d9 jz 0x08d9 // end
08ce 0200 000f addi $AC0.M, #0x000f
08d0 0240 000f andi $AC0.M, #0x000f
08d2 0200 0458 addi $AC0.M, #0x0458
08d4 1c7e mrr $AR3, $AC0.M
08d5 007a 08d8 bloop $AX0.H, 0x08d8
08d7 18fe lrrd $AC0.M, @$AR3
08d8 1a9e srrd @$AR0, $AC0.M
08d9 0092 00ff lri $CR, #0x00ff
08db 02df ret
//
08dc b100 tst $ACC0
08dd 0295 08ec jz 0x08ec
08df 5d00 sub $ACC1, $AC0.L
08e0 040f addis $ACC0, #0x0f
08e1 147c lsr $ACC0, #-4
08e2 0c00 lris $AC0.L, #0x00
08e3 00e3 0363 sr @0x0363, $AR3
08e5 02bf 091c call 0x091c
08e7 00de 0363 lr $AC0.M, @0x0363
08e9 223b lrs $AX0.H, @0x003b
08ea 4400 addr $ACC0, $AX0.H
08eb 1c7e mrr $AR3, $AC0.M
08ec 8100 clr $ACC0
08ed 2681 lrs $AC0.M, @0xff81
08ee b100 tst $ACC0
08ef 0295 0914 jz 0x0914
08f1 2380 lrs $AX1.H, @0xff80
08f2 2688 lrs $AC0.M, @0xff88
08f3 2489 lrs $AC0.L, @0xff89
08f4 1408 lsl $ACC0, #8
08f5 14f4 asr $ACC0, #-12
08f6 2380 lrs $AX1.H, @0xff80
08f7 8d00 set15
08f8 c810 mulc'mv $AC0.M, $AX1.H : $AX0.L, $AC0.L
08f9 ae00 mulxmv $AX0.L, $AX1.H, $ACC0
08fa 8c00 clr15
08fb f000 lsl16 $ACC0
08fc 4e00 addp $ACC0
08fd 238c lrs $AX1.H, @0xff8c
08fe 218d lrs $AX1.L, @0xff8d
08ff 4a00 addax $ACC0, $AX1.L
0900 2e38 srs @0x0038, $AC0.M
0901 2c39 srs @0x0039, $AC0.L
0902 2682 lrs $AC0.M, @0xff82
0903 2e67 srs @0x0067, $AC0.M
0904 2683 lrs $AC0.M, @0xff83
0905 2e66 srs @0x0066, $AC0.M
0906 00e3 0363 sr @0x0363, $AR3
0908 0083 0458 lri $AR3, #0x0458
090a 8100 clr $ACC0
090b 0e01 lris $AC0.M, #0x01
090c 02bf 091c call 0x091c
090e 00c3 0363 lr $AR3, @0x0363
0910 02bf 085a call 0x085a
0912 029f 087a jmp 0x087a
0914 0e01 lris $AC0.M, #0x01
0915 2e01 srs @0x0001, $AC0.M
0916 8100 clr $ACC0
0917 005f loop $AC1.M
0918 1b7e srri @$AR3, $AC0.M
0919 0092 00ff lri $CR, #0x00ff
091b 02df ret
// afc decoder (for sound formats 5 and 9)
// AC0.M = num of blocks to do? (0x4)
// AC1.M =
091c 00ff 0360 sr @0x0360, $AC1.M
091e 00fe 0361 sr @0x0361, $AC0.M
0920 8100 clr $ACC0
0921 00de 0361 lr $AC0.M, @0x0361
0923 007e 099c bloop $AC0.M, 0x099c
0925 2638 lrs $AC0.M, @0x0038
0926 2439 lrs $AC0.L, @0x0039
0927 0092 00ff lri $CR, #0x00ff
0929 029f 063a jmp 0x063a // ReadSoundData(Dword[0x0038])
092b 0092 0004 lri $CR, #0x0004
092d 2638 lrs $AC0.M, @0x0038
092e 2439 lrs $AC0.L, @0x0039
092f 8900 clr $ACC1
0930 2580 lrs $AC1.L, @0xff80
0931 4c00 add $ACC0, $AC1.L
0932 2e38 srs @0x0038, $AC0.M
0933 2c39 srs @0x0039, $AC0.L
0934 00de 037f lr $AC0.M, @0x037f
0936 0200 0b00 addi $AC0.M, #0x0b00 // buffer where read sound data is stored (128 bytes)
0938 1c1e mrr $AR0, $AC0.M // AR0 = AC0.M = 0x0B00 + Mem[0x037F]; (Mem[0x037F] seems to be the offset in buffer to the actual block...)
0939 0084 0001 lri $IX0, #0x0001 // IX0 = 0x0001;
093b 199e lrrn $AC0.M, @$AR0 // AC0.M = Mem[AR0]; AR0++; read first byte in buffer
093c 8900 clr $ACC1
093d 1ffe mrr $AC1.M, $AC0.M // AC1.M = AC0.M = first_byte;
093e 1401 lsl $ACC0, #1
093f 0240 001e andi $AC0.M, #0x001e
0941 0200 0300 addi $AC0.M, #0x0300
0943 1c3e mrr $AR1, $AC0.M // AR1 = ((first_byte << 1) & 0x1E) + 0x0300;
0944 157c lsr $ACC1, #-4
0945 0340 000f andi $AC1.M, #0x000f
0947 0a11 lris $AX0.H, #0x11
0948 5500 subr $ACC1, $AX0.H // AC1.M = ((first_byte >> 4) & 0xF) - 0x11;
0949 8100 clr $ACC0
094a 2680 lrs $AC0.M, @0xff80
094b 0605 cmpis $ACC0, #0x05
094c 0295 0965 jz 0x0965 // skip loop below (execute another loop) for sound format 5
094e 009a 00f0 lri $AX0.H, #0x00f0 // these masks... for adpcm sound surely
0950 0b0f lris $AX1.H, #0x0f
0951 0082 0364 lri $AR2, #0x0364 // AR2 = 0x0364;
0953 1998 lrrn $AX0.L, @$AR0 // AX0.L = Mem[AR0]; AR0++;
0954 6000 movr $ACC0, $AX0.L // AC0.HM = AX0; AC0.L = 0x0000;
// loop for sound format 9 (looks like adpcm)
// decompose sound data into nibbles and store it to 0x0364 (again a temp buffer!)
// for(i = 0; i < 7; i++)
0955 1107 095c bloopi #0x07, 0x095c
0957 3400 andr $AC0.M, $AX0.H // AC0.M &= 0x00F0;
0958 1408 lsl $ACC0, #8 // ACC0 <<= 8;
0959 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M // AC0.HM = AX0; AC0.L = 0; Mem[AR2] = AC0.M; AR2++;
095a 3644 andr'ln $AC0.M, $AX1.H : $AX0.L, @$AR0 // AC0.M &= 0x000F; AX0.L = Mem[AR0]; AR0++;
095b 140c lsl $ACC0, #12 // ACC0 <<= 12;
095c 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M // AC0.HM = AX0; AC0.L = 0; Mem[AR2] = AC0.M; AR2++;
095d 3400 andr $AC0.M, $AX0.H
095e 1408 lsl $ACC0, #8
095f 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M
0960 3600 andr $AC0.M, $AX1.H
0961 140c lsl $ACC0, #12
0962 1b5e srri @$AR2, $AC0.M
0963 029f 0985 jmp 0x0985
// below for sound format 5 only
0965 009a c000 lri $AX0.H, #0xc000
0967 0082 0364 lri $AR2, #0x0364
0969 1998 lrrn $AX0.L, @$AR0
096a 6000 movr $ACC0, $AX0.L
// loop for sound format 5
096b 1103 0978 bloopi #0x03, 0x0978
096d 1408 lsl $ACC0, #8
096e 3400 andr $AC0.M, $AX0.H
096f 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M
0970 140a lsl $ACC0, #10
0971 3400 andr $AC0.M, $AX0.H
0972 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M
0973 140c lsl $ACC0, #12
0974 3400 andr $AC0.M, $AX0.H
0975 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M
0976 140e lsl $ACC0, #14
0977 3444 andr'ln $AC0.M, $AX0.H : $AX0.L, @$AR0
0978 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M
0979 1408 lsl $ACC0, #8
097a 3400 andr $AC0.M, $AX0.H
097b 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M
097c 140a lsl $ACC0, #10
097d 3400 andr $AC0.M, $AX0.H
097e 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M
097f 140c lsl $ACC0, #12
0980 3400 andr $AC0.M, $AX0.H
0981 6032 movr's $ACC0, $AX0.L : @$AR2, $AC0.M
0982 140e lsl $ACC0, #14
0983 3400 andr $AC0.M, $AX0.H
0984 1b5e srri @$AR2, $AC0.M
0985 8f00 set40
0986 1f7f mrr $AX1.H, $AC1.M // AX1.H = AC1.M = ((first_byte >> 4) & 0xF) - 0x11;
0987 2066 lrs $AX0.L, @0x0066 // AX0.L = Mem[0x0066];
0988 2767 lrs $AC1.M, @0x0067 // AC1.M = Mem[0x0067];
0989 193a lrri $AX0.H, @$AR1 // AX0.H = Mem[AR1]; AR1++; load coefs from 0x0300+
098a 1939 lrri $AX1.L, @$AR1 // AX1.L = Mem[AR1]; AR1++;
098b 0080 0364 lri $AR0, #0x0364 // AR0 = 0x0364;
098d a000 mulx $AX0.L, $AX1.L // prod = AX0.L * AX1.L;
098e ea70 maddc'l $AC1.M, $AX1.L : $AC0.M, @$AR0 // prod += AC1.M * AX1.L; AC0.M = Mem[AR0]; AR0++;
098f 1108 0998 bloopi #0x08, 0x0998
0991 3a93 orr'sl $AC0.M, $AX1.H : $AC1.M, $AX1.L // AC0.M |= AX1.H; Mem[AR3] = AC1.M; AR3++; AX1.L = Mem[AR0]; AR0++;
0992 a478 mulxac'l $AX0.L, $AX1.L, $ACC0 : $AC1.M, @$AR0 // ACC0 += prod; prod = AX0.L * AX1.L; AC1.M = Mem[AR0]; AR0++;
0993 1485 asl $ACC0, #5 // ACC0 <<= 5;
0994 e833 maddc's $AC0.M, $AX1.L : @$AR3, $AC0.M // prod += AC0.M * AX1.L; Mem[AR3] = AC0.M; AR3++;
0995 3b92 orr'sl $AC1.M, $AX1.H : $AC0.M, $AX1.L // AC1.M |= AX1.H; Mem[AR3] = AC0.M; AR3++; AX1.L = Mem[AR0]; AR0++;
0996 a570 mulxac'l $AX0.L, $AX1.L, $ACC1 : $AC0.M, @$AR0 // ACC1 += prod; prod = AX0.L * AX1.L; AC1.M = Mem[AR0]; AR0++;
0997 1585 asl $ACC1, #5 // ACC1 <<= 5;
0998 ea3b maddc's $AC1.M, $AX1.L : @$AR3, $AC1.M // prod += AC1.M * AX1.L; Mem[AR3] = AC1.M; AR3++;
0999 2f67 srs @0x0067, $AC1.M
099a 8e00 set16
099b 1ff8 mrr $AC1.M, $AX0.L
099c 2f66 srs @0x0066, $AC1.M
// end of outer loop
099d 8900 clr $ACC1
099e 00df 0360 lr $AC1.M, @0x0360
09a0 02df ret
//
09a1 b100 tst $ACC0
09a2 02d5 retz
09a3 04fe addis $ACC0, #0xfe
09a4 1f1e mrr $AX0.L, $AC0.M
09a5 191e lrri $AC0.M, @$AR0
09a6 0291 09ac js 0x09ac
09a8 191a lrri $AX0.H, @$AR0
09a9 0058 loop $AX0.L
09aa 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
09ab 6433 movr's $ACC0, $AX0.H : @$AR3, $AC0.M
09ac 1b7e srri @$AR3, $AC0.M
09ad 02df ret
// decode audio?
09ae 8100 clr $ACC0
09af 1f5e mrr $AX0.H, $AC0.M
09b0 00d8 0402 lr $AX0.L, @0x0402
09b2 00dc 0430 lr $AC0.L, @0x0430
09b4 0080 0520 lri $AR0, #0x0520
09b6 00df 0480 lr $AC1.M, @0x0480 // sound format???
09b8 1501 lsl $ACC1, #1
09b9 0340 007e andi $AC1.M, #0x007e
09bb 0300 09c3 addi $AC1.M, #0x09c3
09bd 1c5f mrr $AR2, $AC1.M
09be 175f callr $AR2 // jump to one of the functions
09bf 00fc 0430 sr @0x0430, $AC0.L
09c1 029f 0336 jmp 0x0336 // return to SyncFrame func
// jump table
09c3 029f 09e4 jmp 0x09e4 // 0x0:
09c5 029f 0a1f jmp 0x0a1f // 0x1:
09c7 029f 0a07 jmp 0x0a07 // 0x2:
09c9 029f 09f4 jmp 0x09f4 // 0x3:
09cb 029f 0a2d jmp 0x0a2d // 0x4:
09cd 029f 09e3 jmp 0x09e3 // 0x5: dummy
09cf 029f 0a4b jmp 0x0a4b // 0x6:
09d1 029f 0a4e jmp 0x0a4e // 0x7:
09d3 029f 09e3 jmp 0x09e3 // 0x8: dummy
09d5 029f 09e3 jmp 0x09e3 // 0x9: dummy
09d7 029f 0a6c jmp 0x0a6c // 0xA:
09d9 029f 0a25 jmp 0x0a25 // 0xB:
09db 029f 0a29 jmp 0x0a29 // 0xC:
09dd 029f 09e3 jmp 0x09e3 // 0xD: dummy
09df 029f 09e3 jmp 0x09e3 // 0xE: dummy
09e1 029f 09e3 jmp 0x09e3 // 0xF: dummy
09e3 02df ret // direct return for dummy funcs
// Func_00()
09e4 1401 lsl $ACC0, #1
09e5 009b c000 lri $AX1.H, #0xc000
09e7 0099 4000 lri $AX1.L, #0x4000
09e9 1150 09f1 bloopi #0x50, 0x09f1
09eb 02c0 0001 andcf $AC0.M, #0x0001
09ed 027c iflnz
09ee 1b1b srri @$AR0, $AX1.H
09ef 027d iflz
09f0 1b19 srri @$AR0, $AX1.L
09f1 4800 addax $ACC0, $AX0.L
09f2 147f lsr $ACC0, #-1
09f3 02df ret
09f4 1402 lsl $ACC0, #2
09f5 8900 clr $ACC1
09f6 1fb8 mrr $AC1.L, $AX0.L
09f7 1501 lsl $ACC1, #1
09f8 009b c000 lri $AX1.H, #0xc000
09fa 0099 4000 lri $AX1.L, #0x4000
09fc 1150 0a04 bloopi #0x50, 0x0a04
09fe 02c0 0003 andcf $AC0.M, #0x0003
0a00 027c iflnz
0a01 1b1b srri @$AR0, $AX1.H
0a02 027d iflz
0a03 1b19 srri @$AR0, $AX1.L
0a04 4c00 add $ACC0, $AC1.L
0a05 147e lsr $ACC0, #-2
0a06 02df ret
0a07 1401 lsl $ACC0, #1
0a08 0081 0ca0 lri $AR1, #0x0ca0
0a0a 009b c000 lri $AX1.H, #0xc000
0a0c 0099 4000 lri $AX1.L, #0x4000
0a0e 8900 clr $ACC1
0a0f 0082 0000 lri $AR2, #0x0000
0a11 1150 0a1c bloopi #0x50, 0x0a1c
0a13 02c0 0001 andcf $AC0.M, #0x0001
0a15 027c iflnz
0a16 1b1b srri @$AR0, $AX1.H
0a17 027d iflz
0a18 1b19 srri @$AR0, $AX1.L
0a19 183d lrr $AC1.L, @$AR1
0a1a 4900 addax $ACC1, $AX0.L
0a1b 1fe2 mrr $AC1.M, $AR2
0a1c 4c39 add's $ACC0, $AC1.L : @$AR1, $AC1.M
0a1d 147f lsr $ACC0, #-1
0a1e 02df ret
0a1f 8900 clr $ACC1
0a20 1fb8 mrr $AC1.L, $AX0.L
0a21 157f lsr $ACC1, #-1
0a22 1050 loopi #0x50
0a23 4c20 add's $ACC0, $AC1.L : @$AR0, $AC0.L
0a24 02df ret
0a25 0082 0180 lri $AR2, #0x0180
0a27 029f 0a2f jmp 0x0a2f
0a29 0082 01c0 lri $AR2, #0x01c0
0a2b 029f 0a2f jmp 0x0a2f
0a2d 0082 0140 lri $AR2, #0x0140
0a2f 008a 003f lri $WR2, #0x003f
0a31 0086 0000 lri $IX2, #0x0000
0a33 1406 lsl $ACC0, #6
0a34 8900 clr $ACC1
0a35 1fb8 mrr $AC1.L, $AX0.L
0a36 1505 lsl $ACC1, #5
0a37 009b 003f lri $AX1.H, #0x003f
0a39 009a 0000 lri $AX0.H, #0x0000
0a3b 3600 andr $AC0.M, $AX1.H
0a3c 1cde mrr $IX2, $AC0.M
0a3d 001a addarn $AR2, $IX2
0a3e 3400 andr $AC0.M, $AX0.H
0a3f 1150 0a45 bloopi #0x50, 0x0a45
0a41 4c4a add'l $ACC0, $AC1.L : $AX1.L, @$AR2
0a42 3606 andr'dr $AC0.M, $AX1.H : $AR2
0a43 1cde mrr $IX2, $AC0.M
0a44 340e andr'nr $AC0.M, $AX0.H : $AR2
0a45 1b19 srri @$AR0, $AX1.L
0a46 1fc2 mrr $AC0.M, $AR2
0a47 147a lsr $ACC0, #-6
0a48 008a ffff lri $WR2, #0xffff
0a4a 02df ret
0a4b 1050 loopi #0x50
0a4c 1b18 srri @$AR0, $AX0.L
0a4d 02df ret
0a4e 0082 0100 lri $AR2, #0x0100
0a50 008a 003f lri $WR2, #0x003f
0a52 0086 0000 lri $IX2, #0x0000
0a54 1406 lsl $ACC0, #6
0a55 8900 clr $ACC1
0a56 1fb8 mrr $AC1.L, $AX0.L
0a57 1505 lsl $ACC1, #5
0a58 009b 003f lri $AX1.H, #0x003f
0a5a 009a 0000 lri $AX0.H, #0x0000
0a5c 3600 andr $AC0.M, $AX1.H
0a5d 1cde mrr $IX2, $AC0.M
0a5e 001a addarn $AR2, $IX2
0a5f 3400 andr $AC0.M, $AX0.H
0a60 1150 0a66 bloopi #0x50, 0x0a66
0a62 4c4a add'l $ACC0, $AC1.L : $AX1.L, @$AR2
0a63 3606 andr'dr $AC0.M, $AX1.H : $AR2
0a64 1cde mrr $IX2, $AC0.M
0a65 340e andr'nr $AC0.M, $AX0.H : $AR2
0a66 1b19 srri @$AR0, $AX1.L
0a67 1fc2 mrr $AC0.M, $AR2
0a68 147a lsr $ACC0, #-6
0a69 008a ffff lri $WR2, #0xffff
0a6b 02df ret
//
0a6c 0082 0100 lri $AR2, #0x0100
0a6e 008a 003f lri $WR2, #0x003f
0a70 0086 0000 lri $IX2, #0x0000
0a72 0081 0ca0 lri $AR1, #0x0ca0
0a74 1406 lsl $ACC0, #6
0a75 8900 clr $ACC1
0a76 1fb8 mrr $AC1.L, $AX0.L
0a77 1505 lsl $ACC1, #5
0a78 009b 003f lri $AX1.H, #0x003f
0a7a 009a 0000 lri $AX0.H, #0x0000
0a7c 3600 andr $AC0.M, $AX1.H
0a7d 1cde mrr $IX2, $AC0.M
0a7e 001a addarn $AR2, $IX2
0a7f 3400 andr $AC0.M, $AX0.H
0a80 1150 0a8b bloopi #0x50, 0x0a8b
0a82 1939 lrri $AX1.L, @$AR1
0a83 a000 mulx $AX0.L, $AX1.L
0a84 140a lsl $ACC0, #10
0a85 4e00 addp $ACC0
0a86 1476 lsr $ACC0, #-10
0a87 4c4a add'l $ACC0, $AC1.L : $AX1.L, @$AR2
0a88 3606 andr'dr $AC0.M, $AX1.H : $AR2
0a89 1cde mrr $IX2, $AC0.M
0a8a 340e andr'nr $AC0.M, $AX0.H : $AR2
0a8b 1b19 srri @$AR0, $AX1.L
0a8c 1fc2 mrr $AC0.M, $AR2
0a8d 147a lsr $ACC0, #-6
0a8e 008a ffff lri $WR2, #0xffff
0a90 02df ret
//
0a91 0080 01be lri $AR0, #0x01be
0a93 1918 lrri $AX0.L, @$AR0
0a94 191a lrri $AX0.H, @$AR0
0a95 0080 0180 lri $AR0, #0x0180
0a97 0083 0180 lri $AR3, #0x0180
0a99 9070 mul'l $AX0.L, $AX0.H : $AC0.M, @$AR0
0a9a 1ffe mrr $AC1.M, $AC0.M
0a9b 1120 0aa2 bloopi #0x20, 0x0aa2
0a9d 7c00 neg $ACC0
0a9e d450 mulcac'l $AC1.M, $AX0.H, $ACC0 : $AX0.H, @$AR0
0a9f 6533 movr's $ACC1, $AX0.H : @$AR3, $AC0.M
0aa0 c550 mulcac'l $AC0.M, $AX0.H, $ACC1 : $AX0.H, @$AR0
0aa1 1501 lsl $ACC1, #1
0aa2 643b movr's $ACC0, $AX0.H : @$AR3, $AC1.M
0aa3 0080 01fe lri $AR0, #0x01fe
0aa5 191a lrri $AX0.H, @$AR0
0aa6 1918 lrri $AX0.L, @$AR0
0aa7 0080 01c0 lri $AR0, #0x01c0
0aa9 0083 01c0 lri $AR3, #0x01c0
0aab 1ff8 mrr $AC1.M, $AX0.L
0aac 9070 mul'l $AX0.L, $AX0.H : $AC0.M, @$AR0
0aad f800 addpaxz $ACC0, $AX0.H
0aae 0240 01ff andi $AC0.M, #0x01ff
0ab0 0260 2000 ori $AC0.M, #0x2000
0ab2 02bf 0ab5 call 0x0ab5
0ab4 02df ret
0ab5 b900 tst $ACC1
0ab6 0272 ifg
0ab7 7c00 neg $ACC0
0ab8 1f7e mrr $AX1.H, $AC0.M
0ab9 4700 addr $ACC1, $AX1.H
0aba 1110 0abf bloopi #0x10, 0x0abf
0abc 473b addr's $ACC1, $AX1.H : @$AR3, $AC1.M
0abd 473b addr's $ACC1, $AX1.H : @$AR3, $AC1.M
0abe 473b addr's $ACC1, $AX1.H : @$AR3, $AC1.M
0abf 473b addr's $ACC1, $AX1.H : @$AR3, $AC1.M
0ac0 02df ret
//
0ac1 02bf 0b2e call 0x0b2e
0ac3 2201 lrs $AX0.H, @0x0001
0ac4 8600 tstaxh $AX0.H
0ac5 0294 0ad6 jnz 0x0ad6
0ac7 2204 lrs $AX0.H, @0x0004
0ac8 8600 tstaxh $AX0.H
0ac9 02b4 0b1d callne 0x0b1d
0acb 8100 clr $ACC0
0acc 2605 lrs $AC0.M, @0x0005
0acd b100 tst $ACC0
0ace 0295 0ae3 jz 0x0ae3
0ad0 8100 clr $ACC0
0ad1 2e05 srs @0x0005, $AC0.M
0ad2 2281 lrs $AX0.H, @0xff81
0ad3 8600 tstaxh $AX0.H
0ad4 0294 0add jnz 0x0add
0ad6 8100 clr $ACC0
0ad7 005f loop $AC1.M
0ad8 1b7e srri @$AR3, $AC0.M
0ad9 7400 incm $AC0.M
0ada 2e01 srs @0x0001, $AC0.M
0adb 029f 0b16 jmp 0x0b16
0add 2688 lrs $AC0.M, @0xff88
0ade 2489 lrs $AC0.L, @0xff89
0adf 2e34 srs @0x0034, $AC0.M
0ae0 2c35 srs @0x0035, $AC0.L
0ae1 02bf 0b1d call 0x0b1d
0ae3 00ff 0360 sr @0x0360, $AC1.M
0ae5 2638 lrs $AC0.M, @0x0038
0ae6 2439 lrs $AC0.L, @0x0039
0ae7 02bf 068d call 0x068d
0ae9 00df 0360 lr $AC1.M, @0x0360
0aeb 8100 clr $ACC0
0aec 263a lrs $AC0.M, @0x003a
0aed b100 tst $ACC0
0aee 0294 0afd jnz 0x0afd
0af0 263b lrs $AC0.M, @0x003b
0af1 5c00 sub $ACC0, $AC1.L
0af2 0290 0afd jns 0x0afd
0af4 223b lrs $AX0.H, @0x003b
0af5 02bf 06aa call 0x06aa
0af7 5500 subr $ACC1, $AX0.H
0af8 0a01 lris $AX0.H, #0x01
0af9 00fa 0405 sr @0x0405, $AX0.H
0afb 029f 0ad0 jmp 0x0ad0
0afd 1f5f mrr $AX0.H, $AC1.M
0afe 02bf 06aa call 0x06aa
0b00 00fa 0362 sr @0x0362, $AX0.H
0b02 8100 clr $ACC0
0b03 263a lrs $AC0.M, @0x003a
0b04 243b lrs $AC0.L, @0x003b
0b05 1570 lsr $ACC1, #-16
0b06 0a01 lris $AX0.H, #0x01
0b07 0081 0405 lri $AR1, #0x0405
0b09 5c00 sub $ACC0, $AC1.L
0b0a b100 tst $ACC0
0b0b 0275 ifz
0b0c 1a3a srr @$AR1, $AX0.H
0b0d 2e3a srs @0x003a, $AC0.M
0b0e 2c3b srs @0x003b, $AC0.L
0b0f 2638 lrs $AC0.M, @0x0038
0b10 2439 lrs $AC0.L, @0x0039
0b11 00d8 0362 lr $AX0.L, @0x0362
0b13 7000 addaxl $ACC0, $AX0.L
0b14 2c39 srs @0x0039, $AC0.L
0b15 2e38 srs @0x0038, $AC0.M
0b16 0092 00ff lri $CR, #0x00ff
0b18 029f 032e jmp 0x032e
0b1a 8100 clr $ACC0
0b1b 2e34 srs @0x0034, $AC0.M
0b1c 2e35 srs @0x0035, $AC0.M
0b1d 2334 lrs $AX1.H, @0x0034
0b1e 2135 lrs $AX1.L, @0x0035
0b1f 268a lrs $AC0.M, @0xff8a
0b20 248b lrs $AC0.L, @0xff8b
0b21 5a00 subax $ACC0, $AX1.L
0b22 2e3a srs @0x003a, $AC0.M
0b23 2c3b srs @0x003b, $AC0.L
0b24 2634 lrs $AC0.M, @0x0034
0b25 2435 lrs $AC0.L, @0x0035
0b26 238c lrs $AX1.H, @0xff8c
0b27 218d lrs $AX1.L, @0xff8d
0b28 4a00 addax $ACC0, $AX1.L
0b29 2e38 srs @0x0038, $AC0.M
0b2a 2c39 srs @0x0039, $AC0.L
0b2b 8100 clr $ACC0
0b2c 2e05 srs @0x0005, $AC0.M
0b2d 02df ret
//
0b2e 0092 0004 lri $CR, #0x0004
0b30 2002 lrs $AX0.L, @0x0002
0b31 8100 clr $ACC0
0b32 8900 clr $ACC1
0b33 2430 lrs $AC0.L, @0x0030
0b34 8d00 set15
0b35 0950 lris $AX1.L, #0x50
0b36 a000 mulx $AX0.L, $AX1.L
0b37 a400 mulxac $AX0.L, $AX1.L, $ACC0
0b38 1404 lsl $ACC0, #4 // ACC0 = (Mem[0x0002] * 80) << 4;
0b39 8c00 clr15
0b3a 1ffe mrr $AC1.M, $AC0.M // AC1.M = AC0.M;
0b3b 0083 0580 lri $AR3, #0x0580
0b3d 02df ret
// process sound format 0x10 (smg)
// read data stored at 0x0000 by DsetupTable
// stores the output to 0x0580
0b3e 02bf 0b2e call 0x0b2e // prepare regs
0b40 2201 lrs $AX0.H, @0x0001
0b41 8600 tstaxh $AX0.H
0b42 0294 0b53 jnz 0x0b53
0b44 2204 lrs $AX0.H, @0x0004
0b45 8600 tstaxh $AX0.H
0b46 02b4 0b9d callne 0x0b9d
0b48 8100 clr $ACC0
0b49 2605 lrs $AC0.M, @0x0005
0b4a b100 tst $ACC0
0b4b 0295 0b60 jz 0x0b60
0b4d 8100 clr $ACC0
0b4e 2e05 srs @0x0005, $AC0.M
0b4f 2281 lrs $AX0.H, @0xff81
0b50 8600 tstaxh $AX0.H
0b51 0294 0b5a jnz 0x0b5a
0b53 8100 clr $ACC0
0b54 005f loop $AC1.M
0b55 1b7e srri @$AR3, $AC0.M // store zero to output
0b56 7400 incm $AC0.M
0b57 2e01 srs @0x0001, $AC0.M
0b58 029f 0b96 jmp 0x0b96
0b5a 2688 lrs $AC0.M, @0xff88
0b5b 2489 lrs $AC0.L, @0xff89
0b5c 2e34 srs @0x0034, $AC0.M
0b5d 2c35 srs @0x0035, $AC0.L
0b5e 02bf 0b9d call 0x0b9d
0b60 00ff 0360 sr @0x0360, $AC1.M
0b62 2638 lrs $AC0.M, @0x0038
0b63 2439 lrs $AC0.L, @0x0039
// DMA transfer from main memory address Dword[0x0038] to 0x0580
// Dword[0x0038] = Dword[0xFF8C]
0b64 02bf 068d call 0x068d
0b66 02bf 06a4 call 0x06a4
0b68 00df 0360 lr $AC1.M, @0x0360
0b6a 8100 clr $ACC0
0b6b 263a lrs $AC0.M, @0x003a
0b6c b100 tst $ACC0
0b6d 0294 0b7c jnz 0x0b7c
0b6f 263b lrs $AC0.M, @0x003b
0b70 5c00 sub $ACC0, $AC1.L
0b71 0290 0b7c jns 0x0b7c
0b73 223b lrs $AX0.H, @0x003b
0b74 02bf 066f call 0x066f // dma?
0b76 5500 subr $ACC1, $AX0.H
0b77 0a01 lris $AX0.H, #0x01
0b78 00fa 0405 sr @0x0405, $AX0.H
0b7a 029f 0b4d jmp 0x0b4d
0b7c 1f5f mrr $AX0.H, $AC1.M
0b7d 02bf 066f call 0x066f // dma?
0b7f 00fa 0362 sr @0x0362, $AX0.H
0b81 8100 clr $ACC0
0b82 263a lrs $AC0.M, @0x003a
0b83 243b lrs $AC0.L, @0x003b
0b84 1570 lsr $ACC1, #-16
0b85 0a01 lris $AX0.H, #0x01
0b86 0081 0405 lri $AR1, #0x0405
0b88 5c00 sub $ACC0, $AC1.L
0b89 b100 tst $ACC0
0b8a 0275 ifz
0b8b 1a3a srr @$AR1, $AX0.H
0b8c 2e3a srs @0x003a, $AC0.M
0b8d 2c3b srs @0x003b, $AC0.L
0b8e 2638 lrs $AC0.M, @0x0038
0b8f 2439 lrs $AC0.L, @0x0039
0b90 00d8 0362 lr $AX0.L, @0x0362
0b92 7000 addaxl $ACC0, $AX0.L
0b93 7000 addaxl $ACC0, $AX0.L
0b94 2c39 srs @0x0039, $AC0.L
0b95 2e38 srs @0x0038, $AC0.M
0b96 0092 00ff lri $CR, #0x00ff
0b98 029f 032e jmp 0x032e
//
0b9a 8100 clr $ACC0
0b9b 2e34 srs @0x0034, $AC0.M
0b9c 2e35 srs @0x0035, $AC0.M
0b9d 2334 lrs $AX1.H, @0x0034
0b9e 2135 lrs $AX1.L, @0x0035
0b9f 268a lrs $AC0.M, @0xff8a
0ba0 248b lrs $AC0.L, @0xff8b
0ba1 5a00 subax $ACC0, $AX1.L
0ba2 2e3a srs @0x003a, $AC0.M
0ba3 2c3b srs @0x003b, $AC0.L
0ba4 2634 lrs $AC0.M, @0x0034
0ba5 2435 lrs $AC0.L, @0x0035
0ba6 1401 lsl $ACC0, #1
0ba7 238c lrs $AX1.H, @0xff8c
0ba8 218d lrs $AX1.L, @0xff8d
0ba9 4a00 addax $ACC0, $AX1.L
0baa 2e38 srs @0x0038, $AC0.M
0bab 2c39 srs @0x0039, $AC0.L
0bac 8100 clr $ACC0
0bad 2e05 srs @0x0005, $AC0.M
0bae 02df ret
//
0baf 8900 clr $ACC1
0bb0 0f50 lris $AC1.M, #0x50
0bb1 0083 0520 lri $AR3, #0x0520
0bb3 02bf 0bc8 call 0x0bc8
0bb5 029f 0336 jmp 0x0336
0bb7 00d8 0402 lr $AX0.L, @0x0402
0bb9 8100 clr $ACC0
0bba 8900 clr $ACC1
0bbb 00dc 0430 lr $AC0.L, @0x0430
0bbd 0a50 lris $AX0.H, #0x50
0bbe 9000 mul $AX0.L, $AX0.H
0bbf 9400 mulac $AX0.L, $AX0.H, $ACC0
0bc0 1404 lsl $ACC0, #4
0bc1 1ffe mrr $AC1.M, $AC0.M
0bc2 0083 0580 lri $AR3, #0x0580
0bc4 02bf 0bc8 call 0x0bc8
0bc6 029f 032e jmp 0x032e
//
0bc8 0092 0004 lri $CR, #0x0004
0bca 8100 clr $ACC0
0bcb 263a lrs $AC0.M, @0x003a
0bcc 243b lrs $AC0.L, @0x003b
0bcd 1f1f mrr $AX0.L, $AC1.M
0bce 0a00 lris $AX0.H, #0x00
0bcf 5800 subax $ACC0, $AX0.L
0bd0 0292 0be6 jg 0x0be6
0bd2 8900 clr $ACC1
0bd3 00c0 043b lr $AR0, @0x043b
0bd5 02bf 0c0b call 0x0c0b
0bd7 8100 clr $ACC0
0bd8 1fd8 mrr $AC0.M, $AX0.L
0bd9 223b lrs $AX0.H, @0x003b
0bda 5400 subr $ACC0, $AX0.H
0bdb 0007 dar $AR3
0bdc 1979 lrri $AX1.L, @$AR3
0bdd 005e loop $AC0.M
0bde 1b79 srri @$AR3, $AX1.L
0bdf 0f01 lris $AC1.M, #0x01
0be0 2f01 srs @0x0001, $AC1.M
0be1 8900 clr $ACC1
0be2 2f3b srs @0x003b, $AC1.M
0be3 0092 00ff lri $CR, #0x00ff
0be5 02df ret
//
0be6 2e3a srs @0x003a, $AC0.M
0be7 2c3b srs @0x003b, $AC0.L
0be8 8100 clr $ACC0
0be9 8900 clr $ACC1
0bea 268a lrs $AC0.M, @0xff8a
0beb 2734 lrs $AC1.M, @0x0034
0bec 5c00 sub $ACC0, $AC1.L
0bed 2e36 srs @0x0036, $AC0.M
0bee 5000 subr $ACC0, $AX0.L
0bef 0290 0c05 jns 0x0c05
0bf1 00c0 0436 lr $AR0, @0x0436
0bf3 02bf 0c0b call 0x0c0b
0bf5 8100 clr $ACC0
0bf6 1fd8 mrr $AC0.M, $AX0.L
0bf7 2236 lrs $AX0.H, @0x0036
0bf8 5400 subr $ACC0, $AX0.H
0bf9 1c1e mrr $AR0, $AC0.M
0bfa 8100 clr $ACC0
0bfb 2e34 srs @0x0034, $AC0.M
0bfc 2688 lrs $AC0.M, @0xff88
0bfd 2489 lrs $AC0.L, @0xff89
0bfe 2e8c srs @0xff8c, $AC0.M
0bff 2c8d srs @0xff8d, $AC0.L
0c00 02bf 0c0b call 0x0c0b
0c02 0092 00ff lri $CR, #0x00ff
0c04 02df ret
//
0c05 1c18 mrr $AR0, $AX0.L
0c06 02bf 0c0b call 0x0c0b
0c08 0092 00ff lri $CR, #0x00ff
0c0a 02df ret
//
0c0b 8100 clr $ACC0
0c0c 1fc0 mrr $AC0.M, $AR0
0c0d b100 tst $ACC0
0c0e 02d5 retz
0c0f 8900 clr $ACC1
0c10 2734 lrs $AC1.M, @0x0034
0c11 0340 0001 andi $AC1.M, #0x0001
0c13 0b00 lris $AX1.H, #0x00
0c14 1f3f mrr $AX1.L, $AC1.M
0c15 268c lrs $AC0.M, @0xff8c
0c16 248d lrs $AC0.L, @0xff8d
0c17 8900 clr $ACC1
0c18 2534 lrs $AC1.L, @0x0034
0c19 1501 lsl $ACC1, #1
0c1a 4c00 add $ACC0, $AC1.L
0c1b 5a00 subax $ACC0, $AX1.L
0c1c 5a00 subax $ACC0, $AX1.L
0c1d 1c20 mrr $AR1, $AR0
0c1e 1fe0 mrr $AC1.M, $AR0
0c1f 0502 addis $ACC1, #0x02
0c20 1c1f mrr $AR0, $AC1.M
0c21 009f 0b00 lri $AC1.M, #0x0b00
0c23 0092 00ff lri $CR, #0x00ff
0c25 02bf 05e8 call 0x05e8
0c27 0092 0004 lri $CR, #0x0004
0c29 2734 lrs $AC1.M, @0x0034
0c2a 1f61 mrr $AX1.H, $AR1
0c2b 4700 addr $ACC1, $AX1.H
0c2c 2f34 srs @0x0034, $AC1.M
0c2d 0080 0b00 lri $AR0, #0x0b00
0c2f 8900 clr $ACC1
0c30 1ff9 mrr $AC1.M, $AX1.L
0c31 b900 tst $ACC1
0c32 0274 ifnz
0c33 0008 iar $AR0
0c34 8900 clr $ACC1
0c35 1fe1 mrr $AC1.M, $AR1
0c36 191e lrri $AC0.M, @$AR0
0c37 0701 cmpis $ACC1, #0x01
0c38 0293 0c41 jle 0x0c41
0c3a 191a lrri $AX0.H, @$AR0
0c3b 05fe addis $ACC1, #0xfe
0c3c 005f loop $AC1.M
0c3d 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
0c3e 1b7e srri @$AR3, $AC0.M
0c3f 1b7a srri @$AR3, $AX0.H
0c40 02df ret
// uh?
0c41 1b7e srri @$AR3, $AC0.M
0c42 02df ret
// ???
// AR0 = some count??? address???
// AC0.M =
// AR1 =
0c43 0083 03e8 lri $AR3, #0x03e8
0c45 191e lrri $AC0.M, @$AR0
0c46 191a lrri $AX0.H, @$AR0
0c47 1006 loopi #0x06
0c48 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
0c49 1b7e srri @$AR3, $AC0.M
0c4a 1b7a srri @$AR3, $AX0.H
0c4b 0080 03e8 lri $AR0, #0x03e8
0c4d 8a00 m2
0c4e 0088 0007 lri $WR0, #0x0007
0c50 1150 0c5d bloopi #0x50, 0x0c5d
0c52 1c61 mrr $AR3, $AR1
0c53 84c3 clrp'ld : $AX0.L, $AX1.L, @$AR3
0c54 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0c55 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0c56 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0c57 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0c58 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0c59 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0c5a f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0c5b f200 madd $AX0.L, $AX0.H
0c5c fe00 movpz $ACC0
0c5d 1b3e srri @$AR1, $AC0.M
0c5e 0088 ffff lri $WR0, #0xffff
0c60 8b00 m0
0c61 02df ret
//
0c62 8a00 m2
0c63 05fe addis $ACC1, #0xfe
0c64 0083 03e8 lri $AR3, #0x03e8
0c66 191e lrri $AC0.M, @$AR0
0c67 191a lrri $AX0.H, @$AR0
0c68 005f loop $AC1.M
0c69 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
0c6a 1b7e srri @$AR3, $AC0.M
0c6b 1b7a srri @$AR3, $AX0.H
0c6c 0080 03e8 lri $AR0, #0x03e8
0c6e 0501 addis $ACC1, #0x01
0c6f 1d1f mrr $WR0, $AC1.M
0c70 1150 0c78 bloopi #0x50, 0x0c78
0c72 1c61 mrr $AR3, $AR1
0c73 84c3 clrp'ld : $AX0.L, $AX1.L, @$AR3
0c74 005f loop $AC1.M
0c75 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0c76 f200 madd $AX0.L, $AX0.H
0c77 fe00 movpz $ACC0
0c78 1b3e srri @$AR1, $AC0.M
0c79 0088 ffff lri $WR0, #0xffff
0c7b 8b00 m0
0c7c 02df ret
0c7d 0083 03e8 lri $AR3, #0x03e8
0c7f 191e lrri $AC0.M, @$AR0
0c80 191a lrri $AX0.H, @$AR0
0c81 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
0c82 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
0c83 1b7e srri @$AR3, $AC0.M
0c84 1b7a srri @$AR3, $AX0.H
0c85 0080 03e8 lri $AR0, #0x03e8
0c87 0088 0003 lri $WR0, #0x0003
0c89 0085 0000 lri $IX1, #0x0000
0c8b 0087 0000 lri $IX3, #0x0000
0c8d 1fc2 mrr $AC0.M, $AR2
0c8e 195b lrri $AX1.H, @$AR2
0c8f 1959 lrri $AX1.L, @$AR2
0c90 195f lrri $AC1.M, @$AR2
0c91 195a lrri $AX0.H, @$AR2
0c92 1c5e mrr $AR2, $AC0.M
0c93 1fda mrr $AC0.M, $AX0.H
0c94 1c61 mrr $AR3, $AR1
0c95 8a00 m2
0c96 8f00 set40
0c97 191a lrri $AX0.H, @$AR0
0c98 b850 mulx'l $AX0.H, $AX1.H : $AX0.H, @$AR0
0c99 e250 maddx'l $AX0.H, $AX1.L : $AX0.H, @$AR0
0c9a ea50 maddc'l $AC1.M, $AX1.L : $AX0.H, @$AR0
0c9b e8e8 maddc'ldm $AC0.M, $AX1.L : $AX0.H, $AX1.L, @$AR0
0c9c b650 mulxmv'l $AX0.H, $AX1.L, $ACC0 : $AX0.H, @$AR0
0c9d 1127 0ca8 bloopi #0x27, 0x0ca8
0c9f e3a8 maddx'lsm $AX0.H, $AX1.H : $AX0.H, $AC0.M
0ca0 197e lrri $AC0.M, @$AR3
0ca1 e850 maddc'l $AC0.M, $AX1.L : $AX0.H, @$AR0
0ca2 eaf8 maddc'ldm $AC1.M, $AX1.L : $AX0.H, $AX1.H, @$AR0
0ca3 bf50 mulxmv'l $AX0.H, $AX1.H, $ACC1 : $AX0.H, @$AR0
0ca4 e2a9 maddx'lsm $AX0.H, $AX1.L : $AX0.H, $AC1.M
0ca5 197f lrri $AC1.M, @$AR3
0ca6 ea50 maddc'l $AC1.M, $AX1.L : $AX0.H, @$AR0
0ca7 e8e8 maddc'ldm $AC0.M, $AX1.L : $AX0.H, $AX1.L, @$AR0
0ca8 b650 mulxmv'l $AX0.H, $AX1.L, $ACC0 : $AX0.H, @$AR0
0ca9 e3a8 maddx'lsm $AX0.H, $AX1.H : $AX0.H, $AC0.M
0caa 197e lrri $AC0.M, @$AR3
0cab e850 maddc'l $AC0.M, $AX1.L : $AX0.H, @$AR0
0cac eaf8 maddc'ldm $AC1.M, $AX1.L : $AX0.H, $AX1.H, @$AR0
0cad bf00 mulxmv $AX0.H, $AX1.H, $ACC1
0cae 1bff srrn @$AR3, $AC1.M
0caf 197f lrri $AC1.M, @$AR3
0cb0 8e00 set16
0cb1 8b00 m0
0cb2 0088 ffff lri $WR0, #0xffff
0cb4 1b5b srri @$AR2, $AX1.H
0cb5 1b59 srri @$AR2, $AX1.L
0cb6 1b5f srri @$AR2, $AC1.M
0cb7 1b5e srri @$AR2, $AC0.M
0cb8 02df ret
0cb9 0083 03e8 lri $AR3, #0x03e8
0cbb 191e lrri $AC0.M, @$AR0
0cbc 191a lrri $AX0.H, @$AR0
0cbd 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
0cbe 64a0 movr'ls $ACC0, $AX0.H : $AX0.H, $AC0.M
0cbf 1b7e srri @$AR3, $AC0.M
0cc0 1b7a srri @$AR3, $AX0.H
0cc1 0080 03e8 lri $AR0, #0x03e8
0cc3 0088 0003 lri $WR0, #0x0003
0cc5 0085 0000 lri $IX1, #0x0000
0cc7 0087 0000 lri $IX3, #0x0000
0cc9 1fc2 mrr $AC0.M, $AR2
0cca 195b lrri $AX1.H, @$AR2
0ccb 1959 lrri $AX1.L, @$AR2
0ccc 195f lrri $AC1.M, @$AR2
0ccd 195a lrri $AX0.H, @$AR2
0cce 1c5e mrr $AR2, $AC0.M
0ccf 1fda mrr $AC0.M, $AX0.H
0cd0 1c61 mrr $AR3, $AR1
0cd1 8a00 m2
0cd2 8f00 set40
0cd3 191a lrri $AX0.H, @$AR0
0cd4 b800 mulx $AX0.H, $AX1.H
0cd5 e350 maddx'l $AX0.H, $AX1.H : $AX0.H, @$AR0
0cd6 e250 maddx'l $AX0.H, $AX1.L : $AX0.H, @$AR0
0cd7 ea00 maddc $AC1.M, $AX1.L
0cd8 ea50 maddc'l $AC1.M, $AX1.L : $AX0.H, @$AR0
0cd9 e877 maddc'ln $AC0.M, $AX1.L : $AC0.M, @$AR3
0cda ece8 msubc'ldm $AC0.M, $AX1.L : $AX0.H, $AX1.L, @$AR0
0cdb b200 mulxmvz $AX0.H, $AX1.L, $ACC0
0cdc 1127 0ced bloopi #0x27, 0x0ced
0cde e250 maddx'l $AX0.H, $AX1.L : $AX0.H, @$AR0
0cdf e3a8 maddx'lsm $AX0.H, $AX1.H : $AX0.H, $AC0.M
0ce0 197e lrri $AC0.M, @$AR3
0ce1 e800 maddc $AC0.M, $AX1.L
0ce2 e850 maddc'l $AC0.M, $AX1.L : $AX0.H, @$AR0
0ce3 ea7f maddc'ln $AC1.M, $AX1.L : $AC1.M, @$AR3
0ce4 eef8 msubc'ldm $AC1.M, $AX1.L : $AX0.H, $AX1.H, @$AR0
0ce5 bb00 mulxmvz $AX0.H, $AX1.H, $ACC1
0ce6 e350 maddx'l $AX0.H, $AX1.H : $AX0.H, @$AR0
0ce7 e2a9 maddx'lsm $AX0.H, $AX1.L : $AX0.H, $AC1.M
0ce8 197f lrri $AC1.M, @$AR3
0ce9 ea00 maddc $AC1.M, $AX1.L
0cea ea50 maddc'l $AC1.M, $AX1.L : $AX0.H, @$AR0
0ceb e877 maddc'ln $AC0.M, $AX1.L : $AC0.M, @$AR3
0cec ece8 msubc'ldm $AC0.M, $AX1.L : $AX0.H, $AX1.L, @$AR0
0ced b200 mulxmvz $AX0.H, $AX1.L, $ACC0
0cee e250 maddx'l $AX0.H, $AX1.L : $AX0.H, @$AR0
0cef e3a8 maddx'lsm $AX0.H, $AX1.H : $AX0.H, $AC0.M
0cf0 197e lrri $AC0.M, @$AR3
0cf1 e800 maddc $AC0.M, $AX1.L
0cf2 e850 maddc'l $AC0.M, $AX1.L : $AX0.H, @$AR0
0cf3 ea7f maddc'ln $AC1.M, $AX1.L : $AC1.M, @$AR3
0cf4 eef8 msubc'ldm $AC1.M, $AX1.L : $AX0.H, $AX1.H, @$AR0
0cf5 bb00 mulxmvz $AX0.H, $AX1.H, $ACC1
0cf6 1bff srrn @$AR3, $AC1.M
0cf7 197f lrri $AC1.M, @$AR3
0cf8 8e00 set16
0cf9 8b00 m0
0cfa 0088 ffff lri $WR0, #0xffff
0cfc 1b5b srri @$AR2, $AX1.H
0cfd 1b59 srri @$AR2, $AX1.L
0cfe 1b5f srri @$AR2, $AC1.M
0cff 1b5e srri @$AR2, $AC0.M
0d00 02df ret
// stores an offset table??? called by DsetupTable
// Mem[0x03F0] = 0x0000;
// Mem[0x03F1] = 0x0096;
// Mem[0x03F2] = 0x00FF;
// Mem[0x03F3] = 0x0030;
// Mem[0x03F4] = 0x0010;
// Mem[0x03F5] = 0x7F00;
// Mem[0x03F6] = 0x0000;
// Mem[0x03F7] = 0x0100;
0d01 0eff lris $AC0.M, #0xff
0d02 00fe 03f2 sr @0x03f2, $AC0.M
0d04 8100 clr $ACC0
0d05 00fe 03f0 sr @0x03f0, $AC0.M
0d07 00fe 03f6 sr @0x03f6, $AC0.M
0d09 009e 0100 lri $AC0.M, #0x0100
0d0b 00fe 03f7 sr @0x03f7, $AC0.M
0d0d 00da 03f7 lr $AX0.H, @0x03f7
0d0f 009e 8000 lri $AC0.M, #0x8000
0d11 5400 subr $ACC0, $AX0.H
0d12 00fe 03f5 sr @0x03f5, $AC0.M
0d14 0e30 lris $AC0.M, #0x30
0d15 00fe 03f3 sr @0x03f3, $AC0.M
0d17 0e10 lris $AC0.M, #0x10
0d18 00fe 03f4 sr @0x03f4, $AC0.M
0d1a 009e 0096 lri $AC0.M, #0x0096
0d1c 00fe 03f1 sr @0x03f1, $AC0.M
0d1e 02df ret
//
0d1f 0080 0a00 lri $AR0, #0x0a00
0d21 8100 clr $ACC0
0d22 00de 03f0 lr $AC0.M, @0x03f0
0d24 8900 clr $ACC1
0d25 b100 tst $ACC0
0d26 0275 ifz
0d27 0550 addis $ACC1, #0x50
0d28 00ff 03f0 sr @0x03f0, $AC1.M
0d2a 0200 0a60 addi $AC0.M, #0x0a60
0d2c 1c7e mrr $AR3, $AC0.M
0d2d 0f4e lris $AC1.M, #0x4e
0d2e 02bf 00e5 call 0x00e5
0d30 02df ret
//
0d31 00de 03f1 lr $AC0.M, @0x03f1
0d33 0200 0a60 addi $AC0.M, #0x0a60
0d35 1c7e mrr $AR3, $AC0.M
0d36 8100 clr $ACC0
0d37 8900 clr $ACC1
0d38 009f 00a0 lri $AC1.M, #0x00a0
0d3a 00de 03f1 lr $AC0.M, @0x03f1
0d3c 5d00 sub $ACC1, $AC0.L
0d3d 0e50 lris $AC0.M, #0x50
0d3e 0750 cmpis $ACC1, #0x50
0d3f 0270 ifns
0d40 5d00 sub $ACC1, $AC0.L
0d41 00da 03f2 lr $AX0.H, @0x03f2
0d43 8600 tstaxh $AX0.H
0d44 0290 0d62 jns 0x0d62
0d46 00de 03f3 lr $AC0.M, @0x03f3
0d48 5c00 sub $ACC0, $AC1.L
0d49 0293 0d4d jle 0x0d4d
0d4b 029f 0d67 jmp 0x0d67
0d4d 00db 03f7 lr $AX1.H, @0x03f7
0d4f 009e 8000 lri $AC0.M, #0x8000
0d51 4600 addr $ACC0, $AX1.H
0d52 029f 0d59 jmp 0x0d59
0d54 00db 03f7 lr $AX1.H, @0x03f7
0d56 009e 8000 lri $AC0.M, #0x8000
0d58 5600 subr $ACC0, $AX1.H
0d59 00fe 03f5 sr @0x03f5, $AC0.M
0d5b 1fda mrr $AC0.M, $AX0.H
0d5c 7c00 neg $ACC0
0d5d 1f5e mrr $AX0.H, $AC0.M
0d5e 00fe 03f2 sr @0x03f2, $AC0.M
0d60 029f 0d67 jmp 0x0d67
0d62 00de 03f4 lr $AC0.M, @0x03f4
0d64 5d00 sub $ACC1, $AC0.L
0d65 0293 0d54 jle 0x0d54
0d67 8900 clr $ACC1
0d68 00dd 03f5 lr $AC1.L, @0x03f5
0d6a 1501 lsl $ACC1, #1
0d6b 8100 clr $ACC0
0d6c 00dc 03f6 lr $AC0.L, @0x03f6
0d6e 008b 009f lri $WR3, #0x009f
0d70 0080 0a00 lri $AR0, #0x0a00
0d72 0900 lris $AX1.L, #0x00
// fill buffer at 0x0A00 with buffer at (0x0A60 + Mem[0x03F1])
0d73 1150 0d7a bloopi #0x50, 0x0d7a
0d75 1878 lrr $AX0.L, @$AR3
0d76 4c00 add $ACC0, $AC1.L
0d77 1cfe mrr $IX3, $AC0.M
0d78 001f addarn $AR3, $IX3
0d79 1fd9 mrr $AC0.M, $AX1.L
0d7a 1b18 srri @$AR0, $AX0.L
0d7b 009f 0a60 lri $AC1.M, #0x0a60
0d7d 1fc3 mrr $AC0.M, $AR3
0d7e 5c00 sub $ACC0, $AC1.L
0d7f 00fe 03f1 sr @0x03f1, $AC0.M
0d81 00fc 03f6 sr @0x03f6, $AC0.L
0d83 008b ffff lri $WR3, #0xffff
0d85 02df ret
// copy buffer at 0x0A00 to right & left buffers
0d86 0f50 lris $AC1.M, #0x50
0d87 0080 0a00 lri $AR0, #0x0a00
0d89 0083 0d60 lri $AR3, #0x0d60
0d8b 0098 3fff lri $AX0.L, #0x3fff
0d8d 02bf 00ff call 0x00ff
0d8f 0f50 lris $AC1.M, #0x50
0d90 0080 0a00 lri $AR0, #0x0a00
0d92 0083 0d00 lri $AR3, #0x0d00
0d94 0098 3fff lri $AX0.L, #0x3fff
0d96 02bf 00ff call 0x00ff
0d98 02df ret
// ???
// ACC1: ???
0d99 b900 tst $ACC1
0d9a 0294 0d9f jnz 0x0d9f
0d9c 6800 movax $ACC0, $AX0.L
0d9d b100 tst $ACC0
0d9e 02d5 retz
0d9f 1c23 mrr $AR1, $AR3
0da0 197e lrri $AC0.M, @$AR3
0da1 191b lrri $AX1.H, @$AR0
0da2 d858 mulc'l $AC1.M, $AX1.H : $AX1.H, @$AR0
0da3 1120 0da9 bloopi #0x20, 0x0da9
0da5 dcd3 mulcac'ld $AC1.M, $AX1.H, $ACC0 : $AX0.L, $AX1.H, @$AR3
0da6 6231 movr's $ACC0, $AX1.L : @$AR1, $AC0.M
0da7 dcd3 mulcac'ld $AC1.M, $AX1.H, $ACC0 : $AX0.L, $AX1.H, @$AR3
0da8 6231 movr's $ACC0, $AX1.L : @$AR1, $AC0.M
0da9 4900 addax $ACC1, $AX0.L
0daa 1108 0daf bloopi #0x08, 0x0daf
0dac dcd3 mulcac'ld $AC1.M, $AX1.H, $ACC0 : $AX0.L, $AX1.H, @$AR3
0dad 6231 movr's $ACC0, $AX1.L : @$AR1, $AC0.M
0dae dcd3 mulcac'ld $AC1.M, $AX1.H, $ACC0 : $AX0.L, $AX1.H, @$AR3
0daf 6231 movr's $ACC0, $AX1.L : @$AR1, $AC0.M
0db0 02df ret
// interleave two buffers
0db1 8f00 set40
0db2 8d00 set15
0db3 1c03 mrr $AR0, $AR3
0db4 00d9 038e lr $AX1.L, @0x038e // (0x0040) set by DsetupTable
0db6 0b04 lris $AX1.H, #0x04
0db7 197a lrri $AX0.H, @$AR3
0db8 b053 mulx'l $AX0.H, $AX1.L : $AX0.H, @$AR3
0db9 b600 mulxmv $AX0.H, $AX1.L, $ACC0
0dba 1128 0dbf bloopi #0x28, 0x0dbf
0dbc 3ad3 orr'ld $AC0.M, $AX1.H : $AX0.L, $AX1.H, @$AR3
0dbd b630 mulxmv's $AX0.H, $AX1.L, $ACC0 : @$AR0, $AC0.M
0dbe 3ad3 orr'ld $AC0.M, $AX1.H : $AX0.L, $AX1.H, @$AR3
0dbf b630 mulxmv's $AX0.H, $AX1.L, $ACC0 : @$AR0, $AC0.M
0dc0 8c00 clr15
0dc1 8e00 set16
0dc2 02df ret
// ???
0dc3 00da 0485 lr $AX0.H, @0x0485
0dc5 8600 tstaxh $AX0.H
0dc6 0295 0dd4 jz 0x0dd4
0dc8 8100 clr $ACC0
0dc9 00de 042a lr $AC0.M, @0x042a
0dcb 147f lsr $ACC0, #-1
0dcc 00fe 042b sr @0x042b, $AC0.M
0dce b100 tst $ACC0
0dcf 0294 0dd4 jnz 0x0dd4
0dd1 0a01 lris $AX0.H, #0x01
0dd2 00fa 0401 sr @0x0401, $AX0.H
0dd4 8f00 set40
0dd5 8100 clr $ACC0
0dd6 00de 0428 lr $AC0.M, @0x0428
0dd8 1478 lsr $ACC0, #-8
0dd9 00df 0428 lr $AC1.M, @0x0428
0ddb 0340 007f andi $AC1.M, #0x007f
0ddd 1f1e mrr $AX0.L, $AC0.M
0dde 1f5f mrr $AX0.H, $AC1.M
0ddf 0220 007f xori $ACC0, #0x007f
0de1 1f3e mrr $AX1.L, $AC0.M
0de2 0320 007f xori $ACC1, #0x007f
0de4 1f7f mrr $AX1.H, $AC1.M
0de5 8100 clr $ACC0
0de6 8900 clr $ACC1
0de7 009f 0200 lri $AC1.M, #0x0200
0de9 1fd8 mrr $AC0.M, $AX0.L
0dea 4c00 add $ACC0, $AC1.L
0deb 1c1e mrr $AR0, $AC0.M
0dec 1818 lrr $AX0.L, @$AR0
0ded 1fda mrr $AC0.M, $AX0.H
0dee 4c00 add $ACC0, $AC1.L
0def 1c1e mrr $AR0, $AC0.M
0df0 181a lrr $AX0.H, @$AR0
0df1 1fd9 mrr $AC0.M, $AX1.L
0df2 4c00 add $ACC0, $AC1.L
0df3 1c1e mrr $AR0, $AC0.M
0df4 1819 lrr $AX1.L, @$AR0
0df5 1fdb mrr $AC0.M, $AX1.H
0df6 4c00 add $ACC0, $AC1.L
0df7 1c1e mrr $AR0, $AC0.M
0df8 181b lrr $AX1.H, @$AR0
0df9 8a00 m2
0dfa 0080 0b00 lri $AR0, #0x0b00
0dfc 9800 mul $AX1.L, $AX1.H
0dfd ae00 mulxmv $AX0.L, $AX1.H, $ACC0
0dfe b630 mulxmv's $AX0.H, $AX1.L, $ACC0 : @$AR0, $AC0.M
0dff 9630 mulmv's $AX0.L, $AX0.H, $ACC0 : @$AR0, $AC0.M
0e00 6e30 movp's $ACC0 : @$AR0, $AC0.M
0e01 1b1e srri @$AR0, $AC0.M
0e02 8b00 m0
0e03 0080 0b00 lri $AR0, #0x0b00
0e05 0081 0b04 lri $AR1, #0x0b04
0e07 00da 042a lr $AX0.H, @0x042a
0e09 02bf 0e54 call 0x0e54
0e0b 0081 0b08 lri $AR1, #0x0b08
0e0d 0080 0b00 lri $AR0, #0x0b00
0e0f 00da 042a lr $AX0.H, @0x042a
0e11 00de 0429 lr $AC0.M, @0x0429
0e13 8a00 m2
0e14 c000 mulc $AC0.M, $AX0.H
0e15 8b00 m0
0e16 6e00 movp $ACC0
0e17 1f5e mrr $AX0.H, $AC0.M
0e18 02bf 0e54 call 0x0e54
0e1a 0080 0b00 lri $AR0, #0x0b00
0e1c 0081 0b0c lri $AR1, #0x0b0c
0e1e 8100 clr $ACC0
0e1f 8900 clr $ACC1
0e20 00de 042b lr $AC0.M, @0x042b
0e22 00df 042a lr $AC1.M, @0x042a
0e24 00fe 042a sr @0x042a, $AC0.M
0e26 5c00 sub $ACC0, $AC1.L
0e27 1f5e mrr $AX0.H, $AC0.M
0e28 02bf 0e5f call 0x0e5f
0e2a 0080 0b0c lri $AR0, #0x0b0c
0e2c 0081 0b10 lri $AR1, #0x0b10
0e2e 00da 0429 lr $AX0.H, @0x0429
0e30 02bf 0e54 call 0x0e54
0e32 0081 0b04 lri $AR1, #0x0b04
0e34 0082 0b0c lri $AR2, #0x0b0c
0e36 0083 0e6d lri $AR3, #0x0e6d
0e38 1108 0e51 bloopi #0x08, 0x0e51
0e3a 195f lrri $AC1.M, @$AR2
0e3b 15fb asr $ACC1, #-5
0e3c 1f1d mrr $AX0.L, $AC1.L
0e3d 1f5f mrr $AX0.H, $AC1.M
0e3e 193f lrri $AC1.M, @$AR1
0e3f 00e1 0b24 sr @0x0b24, $AR1
0e41 00e2 0b25 sr @0x0b25, $AR2
0e43 021b ilrri $AC0.M, @$AR3
0e44 00e3 0b26 sr @0x0b26, $AR3
0e46 1c7e mrr $AR3, $AC0.M
0e47 00c0 038f lr $AR0, @0x038f
0e49 02bf 0d99 call 0x0d99
0e4b 00c1 0b24 lr $AR1, @0x0b24
0e4d 00c2 0b25 lr $AR2, @0x0b25
0e4f 00c3 0b26 lr $AR3, @0x0b26
0e51 0000 nop
0e52 8e00 set16
0e53 02df ret
//
0e54 8a00 m2
0e55 191f lrri $AC1.M, @$AR0
0e56 d078 mulc'l $AC1.M, $AX0.H : $AC1.M, @$AR0
0e57 d678 mulcmv'l $AC1.M, $AX0.H, $ACC0 : $AC1.M, @$AR0
0e58 d631 mulcmv's $AC1.M, $AX0.H, $ACC0 : @$AR1, $AC0.M
0e59 191f lrri $AC1.M, @$AR0
0e5a d631 mulcmv's $AC1.M, $AX0.H, $ACC0 : @$AR1, $AC0.M
0e5b 6e31 movp's $ACC0 : @$AR1, $AC0.M
0e5c 1b3e srri @$AR1, $AC0.M
0e5d 8b00 m0
0e5e 02df ret
0e5f 8a00 m2
0e60 8d00 set15
0e61 1f7e mrr $AX1.H, $AC0.M
0e62 1918 lrri $AX0.L, @$AR0
0e63 a840 mulx'l $AX0.L, $AX1.H : $AX0.L, @$AR0
0e64 ae40 mulxmv'l $AX0.L, $AX1.H, $ACC0 : $AX0.L, @$AR0
0e65 ae31 mulxmv's $AX0.L, $AX1.H, $ACC0 : @$AR1, $AC0.M
0e66 1918 lrri $AX0.L, @$AR0
0e67 ae31 mulxmv's $AX0.L, $AX1.H, $ACC0 : @$AR1, $AC0.M
0e68 6e31 movp's $ACC0 : @$AR1, $AC0.M
0e69 1b3e srri @$AR1, $AC0.M
0e6a 8c00 clr15
0e6b 8b00 m0
0e6c 02df ret
0e6d 0d00 lris $AC1.L, #0x00
0e6e 0d60 lris $AC1.L, #0x60
0e6f 0f40 lris $AC1.M, #0x40
0e70 0ca0 lris $AC0.L, #0xa0
0e71 0e80 lris $AC0.M, #0x80
0e72 0ee0 lris $AC0.M, #0xe0
0e73 0be0 lris $AX1.H, #0xe0
0e74 0c40 lris $AC0.L, #0x40
// store ramp???
// AR0 = 0x0580 (left buffer?)
// AR1 = 0x0520 (right buffer?)
0e75 00f9 0361 sr @0x0361, $AX1.L
0e77 1fc0 mrr $AC0.M, $AR0
0e78 0200 fffc addi $AC0.M, #0xfffc // AC0.M = AR0 - 4;
0e7a 1c1e mrr $AR0, $AC0.M // AR0 = AC0.M = 0x057C;
0e7b 1c5e mrr $AR2, $AC0.M // AR2 = AC0.M = 0x057C;
0e7c 0083 043c lri $AR3, #0x043c // AR3 = 0x043C;
0e7e 197e lrri $AC0.M, @$AR3 // AC0.M = Mem[AR3]; AR3++;
0e7f 197f lrri $AC1.M, @$AR3 // AC1.M = Mem[AR3]; AR3++;
0e80 80a2 nx'sl : $AC0.M, $AX0.H // AX0.H = Mem[AR3]; AR3++; Mem[AR0] = AC0.M; AR0++;
0e81 64a3 movr'sl $ACC0, $AX0.H : $AC1.M, $AX0.H
0e82 6530 movr's $ACC1, $AX0.H : @$AR0, $AC0.M
0e83 1b1f srri @$AR0, $AC1.M
0e84 1c02 mrr $AR0, $AR2 // AR0 = AR2; (0x0580)
0e85 8100 clr $ACC0
0e86 00de 0402 lr $AC0.M, @0x0402 // AC0.M = Mem[0x0402]; (0x0FFC) (ACC0 = 0x0FFC0000)
0e88 00fe 0362 sr @0x0362, $AC0.M // Mem[0x0362] = AC0.M;
0e8a 1474 lsr $ACC0, #-12 // ACC0 >>= 12;
0e8b 1f7e mrr $AX1.H, $AC0.M // AX1.H = AC0.M; (0x0000)
0e8c 1f3c mrr $AX1.L, $AC0.L // AX1.L = AC0.L; (0xFFC0)
0e8d 8900 clr $ACC1
0e8e 00dd 0430 lr $AC1.L, @0x0430 // AC1.L = Mem[0x0430];
0e90 1504 lsl $ACC1, #4 // ACC1 <<= 4;
0e91 0604 cmpis $ACC0, #0x04
0e92 0290 0ee9 jns 0x0ee9
0e94 1fdd mrr $AC0.M, $AC1.L
0e95 0082 02b0 lri $AR2, #0x02b0 // AR2 = 0x02B0; temp buffer?
// store a ramp. for example, the ramp is 0xFFC0, 0xFF80, 0xFF40, 0xFF00, 0xFEC0 and so on... if start value (Mem[0x0402]) is 0x0FFC.
0e97 1050 loopi #0x50 // for(i = 0; i < 80; i++)
0e98 4b2a addax's $ACC1, $AX1.L : @$AR2, $AC1.L // ACC1 += AX1.L; Mem[AR2] = AC1.L; AR2++;
0e99 1fbe mrr $AC1.L, $AC0.M
0e9a 00fe 0360 sr @0x0360, $AC0.M
0e9c 8900 clr $ACC1
0e9d 1fbe mrr $AC1.L, $AC0.M
0e9e 0af8 lris $AX0.H, #0xf8 // AX0.H = 0x00F8;
0e9f 009b 00fc lri $AX1.H, #0x00fc // AX1.H = 0x00FC;
0ea1 00d8 0361 lr $AX0.L, @0x0361 // AX0.L = Mem[0x0361];
0ea3 0082 02b0 lri $AR2, #0x02b0 // AR2 = 0x02B0;
0ea5 0083 02b0 lri $AR3, #0x02b0 // AR3 = 0x02B0;
0ea7 195e lrri $AC0.M, @$AR2 // AC0.M = Mem[AR2];
0ea8 3480 andr'ls $AC0.M, $AX0.H : $AX0.L, $AC0.M // AC0.M &= 0x00F8; AX0.L = Mem[AR0]; AR0++; Mem[AR3] = AC0.M; AR3++;
// do some processing on the ramp we just made, and merge it to the buffer at 0x0580
0ea9 1128 0eae bloopi #0x28, 0x0eae //
0eab 367a andr'l $AC0.M, $AX1.H : $AC1.M, @$AR2 // AC0.M &= AX1.H; AC1.M = Mem[AR2]; AR2++;
0eac 35b3 andr'sl $AC1.M, $AX0.H : $AC1.M, $AX1.H // AC1.M &= 0x00F8; Mem[AR0] = AC1.M; AR0++; AX1.H = Mem[AR3]; AR3++;
0ead 3772 andr'l $AC1.M, $AX1.H : $AC0.M, @$AR2 // ...
0eae 34bb andr'slm $AC0.M, $AX0.H : $AC1.M, $AX1.H
0eaf 8a00 m2 // multiply by 2
0eb0 0082 02b0 lri $AR2, #0x02b0
0eb2 00dd 0430 lr $AC1.L, @0x0430
0eb4 1504 lsl $ACC1, #4
0eb5 1fe0 mrr $AC1.M, $AR0
0eb6 8100 clr $ACC0
0eb7 00de 0362 lr $AC0.M, @0x0362
0eb9 1474 lsr $ACC0, #-12
0eba 1f7e mrr $AX1.H, $AC0.M // AX1.H = 0x0000
0ebb 1f3c mrr $AX1.L, $AC0.L // AX1.L = 0xFFC0
0ebc 8f00 set40
0ebd 1943 lrri $AR3, @$AR2
0ebe 4bc3 addax'ld $ACC1, $AX1.L : $AX0.L, $AX1.L, @$AR3
0ebf 90c3 mul'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0ec0 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0ec1 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0ec2 f200 madd $AX0.L, $AX0.H
0ec3 fe00 movpz $ACC0
0ec4 1c1f mrr $AR0, $AC1.M
0ec5 1943 lrri $AR3, @$AR2
0ec6 4bc3 addax'ld $ACC1, $AX1.L : $AX0.L, $AX1.L, @$AR3
0ec7 90c3 mul'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0ec8 114e 0ed0 bloopi #0x4e, 0x0ed0 // uh? 0x4E? skip two samples?
0eca f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0ecb f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0ecc f231 madd's $AX0.L, $AX0.H : @$AR1, $AC0.M
0ecd 1c1f mrr $AR0, $AC1.M
0ece 1943 lrri $AR3, @$AR2
0ecf 4bc3 addax'ld $ACC1, $AX1.L : $AX0.L, $AX1.L, @$AR3
0ed0 92c3 mulmvz'ld $AX0.L, $AX0.H, $ACC0 : $AX0.L, $AX1.L, @$AR3
0ed1 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0ed2 f2c3 madd'ld $AX0.L, $AX0.H : $AX0.L, $AX1.L, @$AR3
0ed3 f231 madd's $AX0.L, $AX0.H : @$AR1, $AC0.M
0ed4 fe00 movpz $ACC0
0ed5 1b3e srri @$AR1, $AC0.M
0ed6 8b00 m0 // don't multiply by 2
0ed7 8e00 set16
0ed8 00fe 0433 sr @0x0433, $AC0.M
0eda 1c1f mrr $AR0, $AC1.M
0edb 150c lsl $ACC1, #12
0edc 0340 0fff andi $AC1.M, #0x0fff
0ede 00ff 0430 sr @0x0430, $AC1.M
0ee0 0083 043c lri $AR3, #0x043c
0ee2 191e lrri $AC0.M, @$AR0
0ee3 191f lrri $AC1.M, @$AR0
0ee4 80a0 nx'ls : $AX0.H, $AC0.M
0ee5 64a1 movr'ls $ACC0, $AX0.H : $AX0.H, $AC1.M
0ee6 6533 movr's $ACC1, $AX0.H : @$AR3, $AC0.M
0ee7 1b7f srri @$AR3, $AC1.M
0ee8 02df ret
//
0ee9 1fe0 mrr $AC1.M, $AR0
0eea 1c1f mrr $AR0, $AC1.M
// copy buffer at 0x0580 to buffer at 0x0520?
0eeb 1128 0ef2 bloopi #0x28, 0x0ef2
0eed 4b70 addax'l $ACC1, $AX1.L : $AC0.M, @$AR0
0eee 1b3e srri @$AR1, $AC0.M
0eef 1c1f mrr $AR0, $AC1.M
0ef0 4b70 addax'l $ACC1, $AX1.L : $AC0.M, @$AR0
0ef1 1b3e srri @$AR1, $AC0.M
0ef2 1c1f mrr $AR0, $AC1.M
0ef3 029f 0ed8 jmp 0x0ed8
//
0ef5 0083 0520 lri $AR3, #0x0520
0ef7 00de 0433 lr $AC0.M, @0x0433
0ef9 1050 loopi #0x50
0efa 1b7e srri @$AR3, $AC0.M
0efb 029f 0336 jmp 0x0336
//
0efd 1c20 mrr $AR1, $AR0
0efe 185f lrr $AC1.M, @$AR2
0eff 1f7f mrr $AX1.H, $AC1.M
0f00 193a lrri $AX0.H, @$AR1
0f01 6400 movr $ACC0, $AX0.H
0f02 0078 0f07 bloop $AX0.L, 0x0f07
0f04 5659 subr'l $ACC0, $AX1.H : $AX1.H, @$AR1
0f05 6730 movr's $ACC1, $AX1.H : @$AR0, $AC0.M
0f06 5551 subr'l $ACC1, $AX0.H : $AX0.H, @$AR1
0f07 6438 movr's $ACC0, $AX0.H : @$AR0, $AC1.M
0f08 1a5b srr @$AR2, $AX1.H
0f09 02df ret
// InitUnkTable()
0f0a 0098 8240 lri $AX0.L, #0x8240
0f0c 00f8 04e8 sr @0x04e8, $AX0.L
0f0e 0098 7fff lri $AX0.L, #0x7fff
0f10 00f8 04e9 sr @0x04e9, $AX0.L
0f12 0098 7dbf lri $AX0.L, #0x7dbf
0f14 00f8 04ea sr @0x04ea, $AX0.L
0f16 0098 843f lri $AX0.L, #0x843f
0f18 00f8 04eb sr @0x04eb, $AX0.L
0f1a 0098 b23b lri $AX0.L, #0xb23b
0f1c 00f8 04f0 sr @0x04f0, $AX0.L
0f1e 0098 7fff lri $AX0.L, #0x7fff
0f20 00f8 04f1 sr @0x04f1, $AX0.L
0f22 0098 4dc4 lri $AX0.L, #0x4dc4
0f24 00f8 04f2 sr @0x04f2, $AX0.L
0f26 0098 d808 lri $AX0.L, #0xd808
0f28 00f8 04f3 sr @0x04f3, $AX0.L
0f2a 0098 0000 lri $AX0.L, #0x0000
0f2c 0080 04ec lri $AR0, #0x04ec
0f2e 1004 loopi #0x04
0f2f 1b18 srri @$AR0, $AX0.L
0f30 0080 04f4 lri $AR0, #0x04f4
0f32 1004 loopi #0x04
0f33 1b18 srri @$AR0, $AX0.L
0f34 02df ret
// mixer?
0f35 0080 0f40 lri $AR0, #0x0f40
0f37 0083 0b00 lri $AR3, #0x0b00
0f39 8900 clr $ACC1
0f3a 0f50 lris $AC1.M, #0x50
0f3b 0098 6784 lri $AX0.L, #0x6784
0f3d 02bf 010e call 0x010e
0f3f 0080 04e8 lri $AR0, #0x04e8
0f41 0082 04ec lri $AR2, #0x04ec
0f43 0081 0b00 lri $AR1, #0x0b00
0f45 8900 clr $ACC1
0f46 0f50 lris $AC1.M, #0x50
0f47 0080 0b00 lri $AR0, #0x0b00
0f49 0083 0d00 lri $AR3, #0x0d00
0f4b 0098 7fff lri $AX0.L, #0x7fff
0f4d 02bf 00ff call 0x00ff
0f4f 8900 clr $ACC1
0f50 0f50 lris $AC1.M, #0x50
0f51 0080 0b00 lri $AR0, #0x0b00
0f53 0083 0d60 lri $AR3, #0x0d60
0f55 0098 b820 lri $AX0.L, #0xb820
0f57 02bf 00ff call 0x00ff
0f59 0080 0ca0 lri $AR0, #0x0ca0
0f5b 0083 0b00 lri $AR3, #0x0b00
0f5d 8900 clr $ACC1
0f5e 0f50 lris $AC1.M, #0x50
0f5f 0098 6784 lri $AX0.L, #0x6784
0f61 02bf 010e call 0x010e
0f63 0080 04e8 lri $AR0, #0x04e8
0f65 0082 04f4 lri $AR2, #0x04f4
0f67 0081 0b00 lri $AR1, #0x0b00
0f69 8900 clr $ACC1
0f6a 0f50 lris $AC1.M, #0x50
0f6b 0080 0b00 lri $AR0, #0x0b00
0f6d 0083 0d00 lri $AR3, #0x0d00
0f6f 0098 47e0 lri $AX0.L, #0x47e0
0f71 02bf 00ff call 0x00ff
0f73 8900 clr $ACC1
0f74 0f50 lris $AC1.M, #0x50
0f75 0080 0b00 lri $AR0, #0x0b00
0f77 0083 0d60 lri $AR3, #0x0d60
0f79 0098 8001 lri $AX0.L, #0x8001
0f7b 02bf 00ff call 0x00ff
0f7d 02df ret
0f7e 0000 nop
0f7f 0000 nop