From 7139fb4356cab9a25f8ccb99b8d80db6ee874d55 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Fri, 10 Oct 2008 11:26:13 +0000 Subject: [PATCH] Little bit of zelda ucode comments git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@824 8ced0084-cf51-0410-be5f-012b33b47a6e --- Docs/DSP/DSP_UC_Zelda.txt | 111 ++++++++++++++++++++++++++++++-------- Docs/DSP/dsp_rom.txt | 8 +-- 2 files changed, 93 insertions(+), 26 deletions(-) diff --git a/Docs/DSP/DSP_UC_Zelda.txt b/Docs/DSP/DSP_UC_Zelda.txt index 261af0f269..1292663c20 100644 --- a/Docs/DSP/DSP_UC_Zelda.txt +++ b/Docs/DSP/DSP_UC_Zelda.txt @@ -176,7 +176,7 @@ 00d7 02bf 0532 CALL 0x0532 // RAMtoDMEM(DMEM=$AC1.M, AC0=MEMADDR, R00=Len) 00d9 02df RET - +// Called a lot, don't know what it does. Memset? 00da 191e LRRI $AC0.M, @$R00 00db 191a LRRI $AX0.H, @$R00 00dc 005f LOOP $AC1.M @@ -185,7 +185,7 @@ 00df 1b7a SRRI @$R03, $AX0.H 00e0 02df RET - +// Noone seems to call this. Memswap? 00e1 191e LRRI $AC0.M, @$R00 00e2 191a LRRI $AX0.H, @$R00 00e3 007f 00e8 BLOOP $AC1.M, 0x00e8 @@ -196,7 +196,7 @@ 00e9 0000 NOP 00ea 02df RET - +// Multiply utility? Called a lot. Don't really know what it does. 00eb 8a00 M2 00ec 157f LSR $ACC1, #0x3f 00ed 1c20 MRR $R01, $R00 @@ -212,7 +212,7 @@ 00f8 8b00 M0 00f9 02df RET - +// Multiply utility 2? Called a lot. Don't really know what it does. 00fa 8a00 M2 00fb 191a LRRI $AX0.H, @$R00 00fc 9050 MUL.L $AX0.L, $AX0.H : $AX0.H, @$R00 @@ -222,6 +222,8 @@ 0100 8b00 M0 0101 02df RET + + // Clear some memory (called by op2) 0102 8100 CLR $AC0.M 0103 8900 CLR $AC1.M @@ -1609,6 +1611,9 @@ 086b 8900 CLR $AC1.M 086c 00df 0360 LR $AC1.M, @0x0360 086e 02df RET + + + 086f b100 TST $AC0.M 0870 02d5 RETEQ 0871 04fe ADDIS $ACC0, #0xfe @@ -1621,6 +1626,8 @@ 0879 6433 MOVR.S $AC0.M, $AX0.H : @$R03, $AC0.M 087a 1b7e SRRI @$R03, $AC0.M 087b 02df RET + + 087c 8100 CLR $AC0.M 087d 1f5e MRR $AX0.H, $AC0.M 087e 00d8 0402 LR $AX0.L, @0x0402 @@ -1633,24 +1640,27 @@ 088b 1c5f MRR $R02, $AC1.M 088c 175f CALLR $R02 088d 00fc 0430 SR @0x0430, $AC0.L -088f 029f 02d8 JMP 0x02d8 -0891 029f 08b2 JMP 0x08b2 -0893 029f 08ed JMP 0x08ed -0895 029f 08d5 JMP 0x08d5 -0897 029f 08c2 JMP 0x08c2 -0899 029f 08fb JMP 0x08fb -089b 029f 08b1 JMP 0x08b1 -089d 029f 0919 JMP 0x0919 -089f 029f 091c JMP 0x091c -08a1 029f 08b1 JMP 0x08b1 -08a3 029f 08b1 JMP 0x08b1 -08a5 029f 093a JMP 0x093a -08a7 029f 08f3 JMP 0x08f3 -08a9 029f 08f7 JMP 0x08f7 -08ab 029f 08b1 JMP 0x08b1 -08ad 029f 08b1 JMP 0x08b1 -08af 029f 08b1 JMP 0x08b1 +088f 029f 02d8 JMP 0x02d8 // 0 +0891 029f 08b2 JMP 0x08b2 // 1 +0893 029f 08ed JMP 0x08ed // 2 +0895 029f 08d5 JMP 0x08d5 // 3 +0897 029f 08c2 JMP 0x08c2 // 4 +0899 029f 08fb JMP 0x08fb // 5 +089b 029f 08b1 JMP 0x08b1 // 6, 9, 10, 14, 15, 16 +089d 029f 0919 JMP 0x0919 // 7 +089f 029f 091c JMP 0x091c // 8 +08a1 029f 08b1 JMP 0x08b1 // 9 +08a3 029f 08b1 JMP 0x08b1 // 10 +08a5 029f 093a JMP 0x093a // 11 +08a7 029f 08f3 JMP 0x08f3 // 12 +08a9 029f 08f7 JMP 0x08f7 // 13 +08ab 029f 08b1 JMP 0x08b1 // 14 +08ad 029f 08b1 JMP 0x08b1 // 15 +08af 029f 08b1 JMP 0x08b1 // 16 + +// Op2 - 6, 9, 10, 14, 15, 16 08b1 02df RET + 08b2 1401 LSL $ACC0, #0x01 08b3 009b c000 LRI $AX1.H, #0xc000 08b5 0099 4000 LRI $AX1.L, #0x4000 @@ -1663,6 +1673,8 @@ 08bf 4800 ADDAX $AC0.M, $AX0.L 08c0 147f LSR $ACC0, #0x3f 08c1 02df RET + +// Op2 - 4 08c2 1402 LSL $ACC0, #0x02 08c3 8900 CLR $AC1.M 08c4 1fb8 MRR $AC1.L, $AX0.L @@ -1678,6 +1690,8 @@ 08d2 4c00 ADD $AC0.M, $AC1.M 08d3 147e LSR $ACC0, #0x3e 08d4 02df RET + +// Op2 - 3 08d5 1401 LSL $ACC0, #0x01 08d6 0081 0ca0 LRI $R01, #0x0ca0 08d8 009b c000 LRI $AX1.H, #0xc000 @@ -1696,12 +1710,16 @@ 08ea 4c39 ADD.S $AC0.M, $AC1.M : @$R01, $AC1.M 08eb 147f LSR $ACC0, #0x3f 08ec 02df RET + +// Op2 - 2 08ed 8900 CLR $AC1.M 08ee 1fb8 MRR $AC1.L, $AX0.L 08ef 157f LSR $ACC1, #0x3f 08f0 1050 LOOPI #0x50 08f1 4c20 ADD.S $AC0.M, $AC1.M : @$R00, $AC0.L 08f2 02df RET + +// Op2 - 12 08f3 0082 0180 LRI $R02, #0x0180 08f5 029f 08fd JMP 0x08fd 08f7 0082 01c0 LRI $R02, #0x01c0 @@ -1729,9 +1747,13 @@ 0915 147a LSR $ACC0, #0x3a 0916 008a ffff LRI $R10, #0xffff 0918 02df RET + + 0919 1050 LOOPI #0x50 091a 1b18 SRRI @$R00, $AX0.L 091b 02df RET + + 091c 0082 0100 LRI $R02, #0x0100 091e 008a 003f LRI $R10, #0x003f 0920 0086 0000 LRI $R06, #0x0000 @@ -1755,6 +1777,9 @@ 0936 147a LSR $ACC0, #0x3a 0937 008a ffff LRI $R10, #0xffff 0939 02df RET + + + 093a 0082 0100 LRI $R02, #0x0100 093c 008a 003f LRI $R10, #0x003f 093e 0086 0000 LRI $R06, #0x0000 @@ -1784,6 +1809,9 @@ 095b 147a LSR $ACC0, #0x3a 095c 008a ffff LRI $R10, #0xffff 095e 02df RET + + + 095f 0080 01be LRI $R00, #0x01be 0961 1918 LRRI $AX0.L, @$R00 0962 191a LRRI $AX0.H, @$R00 @@ -1810,6 +1838,9 @@ 097e 0260 2000 ORI $ACC0, #0x2000 0980 02bf 0983 CALL 0x0983 0982 02df RET + + + 0983 b900 TST $AC1.M 0984 0272 IF_2 0985 7c00 NEG $AC0.M @@ -1821,6 +1852,9 @@ 098c 473b ADDR.S $AC1.M, $AX1.H : @$R03, $AC1.M 098d 473b ADDR.S $AC1.M, $AX1.H : @$R03, $AC1.M 098e 02df RET + + + 098f 0092 0004 LRI $CR, #0x0004 0991 2002 LRS $AX0.L, @0x0002 0992 8100 CLR $AC0.M @@ -2189,6 +2223,8 @@ 0b49 0088 ffff LRI $R08, #0xffff 0b4b 8b00 M0 0b4c 02df RET + + 0b4d 8a00 M2 0b4e 05fe ADDIS $ACC1, #0xfe 0b4f 0083 03e8 LRI $R03, #0x03e8 @@ -2212,6 +2248,9 @@ 0b64 0088 ffff LRI $R08, #0xffff 0b66 8b00 M0 0b67 02df RET + + + 0b68 0083 03e8 LRI $R03, #0x03e8 0b6a 191e LRRI $AC0.M, @$R00 0b6b 191a LRRI $AX0.H, @$R00 @@ -2265,6 +2304,8 @@ 0ba1 1b5f SRRI @$R02, $AC1.M 0ba2 1b5e SRRI @$R02, $AC0.M 0ba3 02df RET + + 0ba4 0083 03e8 LRI $R03, #0x03e8 0ba6 191e LRRI $AC0.M, @$R00 0ba7 191a LRRI $AX0.H, @$R00 @@ -2424,6 +2465,8 @@ 0c6c 00fc 03f6 SR @0x03f6, $AC0.L 0c6e 008b ffff LRI $R11, #0xffff 0c70 02df RET + + 0c71 0f50 LRIS $AC1.M, #0x50 0c72 0080 0a00 LRI $R00, #0x0a00 0c74 0083 0d60 LRI $R03, #0x0d60 @@ -2435,6 +2478,8 @@ 0c7f 0098 3fff LRI $AX0.L, #0x3fff 0c81 02bf 00eb CALL 0x00eb 0c83 02df RET + + 0c84 8a00 M2 0c85 8f00 S16 0c86 8100 CLR $AC0.M @@ -2462,11 +2507,13 @@ 0ca6 8b00 M0 0ca7 8e00 S40 0ca8 02df RET + + 0ca9 b900 TST $AC1.M 0caa 0294 0caf JNE 0x0caf 0cac 6800 MOVAX $AC0.M, $AX0.L 0cad b100 TST $AC0.M -0cae 02d5 RETEQ +0cae 02d5 RETEQ // Return if equal ? 0caf 1c23 MRR $R01, $R03 0cb0 197e LRRI $AC0.M, @$R03 0cb1 191b LRRI $AX1.H, @$R00 @@ -2483,6 +2530,9 @@ 0cbe dcd3 MULCAC.LD $AX1.H, $AC1.M, $AC0.M : $AX0.L, $AX1.H, @$R03 0cbf 6231 MOVR.S $AC0.M, $AX1.L : @$R01, $AC0.M 0cc0 02df RET + + + 0cc1 8f00 S16 0cc2 8d00 SET15 0cc3 1c03 MRR $R00, $R03 @@ -2499,6 +2549,9 @@ 0cd0 8c00 CLR15 0cd1 8e00 S40 0cd2 02df RET + + + 0cd3 00da 0485 LR $AX0.H, @0x0485 0cd5 8600 TSTAXH $AX0.H 0cd6 0295 0ce5 JEQ 0x0ce5 @@ -2597,6 +2650,8 @@ 0d5f 0000 NOP 0d60 8e00 S40 0d61 02df RET + + 0d62 191f LRRI $AC1.M, @$R00 0d63 d078 MULC.L $AX0.H, $AC1.M : $AC1.M, @$R00 0d64 d678 MULCMV.L $AX0.H, $AC1.M, $AC0.M : $AC1.M, @$R00 @@ -2606,6 +2661,9 @@ 0d68 6e31 MOVP.S $AC0.M : @$R01, $AC0.M 0d69 1b3e SRRI @$R01, $AC0.M 0d6a 02df RET + + + 0d6b 8d00 SET15 0d6c 1f7e MRR $AX1.H, $AC0.M 0d6d 1918 LRRI $AX0.L, @$R00 @@ -2618,6 +2676,8 @@ 0d74 1b3e SRRI @$R01, $AC0.M 0d75 8c00 CLR15 0d76 02df RET + + 0d77 0d00 LRIS $AC1.L, #0x00 0d78 0d60 LRIS $AC1.L, #0x60 0d79 0f40 LRIS $AC1.M, #0x40 @@ -2720,6 +2780,8 @@ 0df0 6533 MOVR.S $AC1.M, $AX0.H : @$R03, $AC0.M 0df1 1b7f SRRI @$R03, $AC1.M 0df2 02df RET + + 0df3 1fe0 MRR $AC1.M, $R00 0df4 1c1f MRR $R00, $AC1.M 0df5 1128 0dfc BLOOPI #0x28, 0x0dfc @@ -2748,6 +2810,8 @@ 0e12 1a5b SRR @$R02, $AX1.H 0e13 02df RET + + // called by init code { a_04e8[0]=0x8240; @@ -2833,6 +2897,9 @@ 0e87 0098 8001 LRI $AX0.L, #0x8001 0e89 02bf 00eb CALL 0x00eb 0e8b 02df RET + + + 0e8c 0000 NOP 0e8d 0000 NOP 0e8e 0000 NOP diff --git a/Docs/DSP/dsp_rom.txt b/Docs/DSP/dsp_rom.txt index 6718d93a83..26b3598b42 100644 --- a/Docs/DSP/dsp_rom.txt +++ b/Docs/DSP/dsp_rom.txt @@ -16,13 +16,13 @@ 8010 02bf 8078 CALL 0x8078 // wait for CPU mailbox & 0x8000 8012 009f 80f3 LRI $AC1.M, #0x80f3 8014 8200 CMP -8015 0295 801f JEQ 0x801f +8015 0295 801f JEQ 0x801f // skip below dsp mailbox write... 8017 27ff LRS $AC1.M, @CMBL -8018 16fc feee SI @DMBH, #0xfeee +8018 16fc feee SI @DMBH, #0xfeee // Write to dsp mailbox 801a 2efd SRS @DMBL, $AC0.M 801b 02bf 807e CALL 0x807e 801d 029f 800e JMP 0x800e -801f 26ff LRS $AC0.M, @CMBL +801f 26ff LRS $AC0.M, @CMBLa // ...and end up here (skip above) 8020 009f a001 LRI $AC1.M, #0xa001 // if equal to a001 ... @@ -2045,4 +2045,4 @@ 8ffe 06e2 CMPIS $ACC0, #0xe2 8fff 8845 CW 0x8845 ; *** UNKNOWN OPCODE *** -8AFFEX \ No newline at end of file +8AFFEX