mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Moved docs to main svn folder.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2436 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -1,304 +0,0 @@
|
||||
omments: 1
|
||||
|
||||
A Compendium of Gamecube Action Replay Code Types
|
||||
|
||||
Note: This is note a Complete code type list.
|
||||
|
||||
The purpose of this document is to catalogue and explain the effects of different AR code types in a clear, concise, and easy to read format. Please note that this document is not intended to explain EVERY code type, only those of interest to the amateur hacker.
|
||||
|
||||
It would not have been possible to write this document without Kenobi's "GCN AR CODES TYPES EXPLANATION", found at www.GSCentral.com, so a big thank-you goes to Kenobi and Parasyte for their contributions to the GCN hacking scene.
|
||||
|
||||
Kenobi's documentation is recommended reading as it is very complete, precise, and exact in it's explanations. However, that is also it's main flaw, it's TOO complex and technical for the casual or newbie hacker to understand. If "Address = ((0x0wXXXXXXX) AND 0x01FFFFFF) OR 0x80000000)" makes any sense to you, then I implore you to read Kenobi's guide instead. The intended audience for this document is people who'd rather have things explained in plain English.
|
||||
|
||||
It should be noted that every decrypted AR code has a basic two-part format that is universal to every code. The first half contains the code type and address to be written to. The second half contains the value to be written.
|
||||
|
||||
The Gamecube has a memory range of 80000000 - 817FFFFF (cached), or C0000000 - C17FFFFF (uncached). However for the sake of simplicity, the AR uses an offset number in the range of 00000000 - 017FFFFF. The code type identifier is an 8-bit value that is applied to the first two digits of the offset. For example, if your offset is 00012345, and you wish to perform a 32-bit write (04), you simply add (04000000) + (00012345) = 04012345.
|
||||
|
||||
In order to conserve space and simplicity, only the 8-bit code type identifier and particulars of the second half of the code will be explained below, as the method for procuring the first half has already been described above ;)
|
||||
|
||||
Terms:
|
||||
|
||||
8-bit - Byte - 0x12
|
||||
16-bit - Halfword - 0x1234
|
||||
32-bit - Word - 0x12345678
|
||||
|
||||
---Writes---
|
||||
|
||||
(00) - NNNNNNXX
|
||||
8-bit write. X is the value, N is the number of times to repeat.
|
||||
|
||||
(02) NNNNXXXX
|
||||
16-bit write. X is the value, N is the number of times to repeat.
|
||||
|
||||
(04) XXXXXXXX
|
||||
32-bit write. X is the value.
|
||||
|
||||
Examples:
|
||||
|
||||
00006500 00000312
|
||||
Will write byte 0x12 to 80006500, 80006501, 80006502, 800067503.
|
||||
|
||||
02006500 00011234
|
||||
Will write halfword 0x1234 to 80006500, 80006502.
|
||||
|
||||
05006500 12345678
|
||||
Will write word 0x12345678 to 81006500.
|
||||
|
||||
|
||||
---Addition---
|
||||
|
||||
(80) - 000000XX
|
||||
8-bit Addition. Load the byte at the address, add X to it, and save resulting byte.
|
||||
|
||||
(82) - 0000XXXX
|
||||
16-bit Addition. Load the halfword at the address, add X to it, and save resulting halfword.
|
||||
|
||||
(84) - XXXXXXXX
|
||||
32-bit Addition. Load the word at the address, add X to it, and save resulting word.
|
||||
|
||||
---Single Line Activators---
|
||||
|
||||
***Equal***
|
||||
(08) 000000XX
|
||||
8-bit Equal activator.
|
||||
|
||||
(0A) 0000XXXX
|
||||
16-bit Equal activator.
|
||||
|
||||
(0C) XXXXXXXX
|
||||
32-bit Equal activator.
|
||||
|
||||
X is the value the address must equal to activate the next line of code.
|
||||
|
||||
***NOT Equal***
|
||||
(10) 000000XX
|
||||
8-bit NOT Equal activator.
|
||||
|
||||
(12) 0000XXXX
|
||||
16-bit NOT Equal activator.
|
||||
|
||||
(14) XXXXXXXX
|
||||
32-bit NOT Equal activator.
|
||||
|
||||
If the value stored at the address is not equal to X, activate the next line of code.
|
||||
|
||||
***If Lower (signed)***
|
||||
(18) 000000XX
|
||||
8-bit If Lower (signed) activator.
|
||||
|
||||
(1A) 0000XXXX
|
||||
16-bit If Lower (signed) activator.
|
||||
|
||||
(1C) XXXXXXXX
|
||||
32-bit If Lower (signed) activator.
|
||||
|
||||
If the value stored at the address is lower than X, activate the next line of code.
|
||||
|
||||
***If Higher (signed)***
|
||||
(20) 000000XX
|
||||
8-bit If Higher (signed) activator.
|
||||
|
||||
(22) 0000XXXX
|
||||
16-bit If Higher (signed) activator.
|
||||
|
||||
(24) XXXXXXXX
|
||||
32-bit If Higher (signed) activator.
|
||||
|
||||
If the value stored at the address is higher than X, activate the next line of code.
|
||||
|
||||
***If Lower (unsigned)***
|
||||
(28) 000000XX
|
||||
8-bit If Lower (unsigned) activator.
|
||||
|
||||
(2A) 0000XXXX
|
||||
16-bit If Lower (unsigned) activator.
|
||||
|
||||
(2C) XXXXXXXX
|
||||
32-bit If Lower (unsigned) activator.
|
||||
|
||||
If the value stored at the address is lower than X, activate the next line of code.
|
||||
|
||||
***If Higher (unsigned)***
|
||||
(30) 000000XX
|
||||
8-bit If Higher (unsigned) activator.
|
||||
|
||||
(32) 0000XXXX
|
||||
16-bit If Higher (unsigned) activator.
|
||||
|
||||
(34) XXXXXXXX
|
||||
32-bit If Higher (unsigned) activator.
|
||||
|
||||
If the value stored at the address is higher than X, activate the next line of code.
|
||||
|
||||
---Double Line Activators---
|
||||
|
||||
***Equal***
|
||||
(48) 000000XX
|
||||
8-bit activator.
|
||||
|
||||
(4A) 0000XXXX
|
||||
16-bit activator.
|
||||
|
||||
(4C) XXXXXXXX
|
||||
32-bit activator.
|
||||
|
||||
X is the value the address must equal to activate the next two lines of code.
|
||||
|
||||
***NOT Equal***
|
||||
(50) 000000XX
|
||||
8-bit NOT Equal activator.
|
||||
|
||||
(52) 0000XXXX
|
||||
16-bit NOT Equal activator.
|
||||
|
||||
(54) XXXXXXXX
|
||||
32-bit NOT Equal activator.
|
||||
|
||||
If the value stored at the address is not equal to X, activate the next two lines of code.
|
||||
|
||||
***If Lower (signed)***
|
||||
(58) 000000XX
|
||||
8-bit If Lower (signed) activator.
|
||||
|
||||
(5A) 0000XXXX
|
||||
16-bit If Lower (signed) activator.
|
||||
|
||||
(5C) XXXXXXXX
|
||||
32-bit If Lower (signed) activator.
|
||||
|
||||
If the value stored at the address is lower than X, activate the next two lines of code.
|
||||
|
||||
***If Higher (signed)***
|
||||
(60) 000000XX
|
||||
8-bit If Higher (signed) activator.
|
||||
|
||||
(62) 0000XXXX
|
||||
16-bit If Higher (signed) activator.
|
||||
|
||||
(64) XXXXXXXX
|
||||
32-bit If Higher (signed) activator.
|
||||
|
||||
If the value stored at the address is higher than X, activate the next two lines of code.
|
||||
|
||||
***If Lower (unsigned)***
|
||||
(68) 000000XX
|
||||
8-bit If Lower (unsigned) activator.
|
||||
|
||||
(6A) 0000XXXX
|
||||
16-bit If Lower (unsigned) activator.
|
||||
|
||||
(6C) XXXXXXXX
|
||||
32-bit If Lower (unsigned) activator.
|
||||
|
||||
If the value stored at the address is lower than X, activate the next two lines of code.
|
||||
|
||||
***If Higher (unsigned)***
|
||||
(70) 000000XX
|
||||
8-bit If Higher (unsigned) activator.
|
||||
|
||||
(72) 0000XXXX
|
||||
16-bit If Higher (unsigned) activator.
|
||||
|
||||
(74) XXXXXXXX
|
||||
32-bit If Higher (unsigned) activator.
|
||||
|
||||
If the value stored at the address is higher than X, activate the next two lines of code.
|
||||
|
||||
---Multi-Line Activators---
|
||||
|
||||
Note that all multi-line codes must end with the line 00000000 40000000.
|
||||
|
||||
***Equal***
|
||||
(88) 000000XX
|
||||
8-bit activator.
|
||||
|
||||
(8A) 0000XXXX
|
||||
16-bit activator.
|
||||
|
||||
(8C) XXXXXXXX
|
||||
32-bit activator.
|
||||
|
||||
X is the value the address must equal to activate the next lines of code.
|
||||
|
||||
***NOT Equal***
|
||||
(90) 000000XX
|
||||
8-bit NOT Equal activator.
|
||||
|
||||
(92) 0000XXXX
|
||||
16-bit NOT Equal activator.
|
||||
|
||||
(94) XXXXXXXX
|
||||
32-bit NOT Equal activator.
|
||||
|
||||
If the value stored at the address is not equal to X, activate the next lines of code.
|
||||
|
||||
***If Lower (signed)***
|
||||
(98) 000000XX
|
||||
8-bit If Lower (signed) activator.
|
||||
|
||||
(9A) 0000XXXX
|
||||
16-bit If Lower (signed) activator.
|
||||
|
||||
(9C) XXXXXXXX
|
||||
32-bit If Lower (signed) activator.
|
||||
|
||||
If the value stored at the address is lower than X, activate the next lines of code.
|
||||
|
||||
***If Higher (signed)***
|
||||
(A0) 000000XX
|
||||
8-bit If Higher (signed) activator.
|
||||
|
||||
(A2) 0000XXXX
|
||||
16-bit If Higher (signed) activator.
|
||||
|
||||
(A4) XXXXXXXX
|
||||
32-bit If Higher (signed) activator.
|
||||
|
||||
If the value stored at the address is higher than X, activate the next lines of code.
|
||||
|
||||
***If Lower (unsigned)***
|
||||
(A8) 000000XX
|
||||
8-bit If Lower (unsigned) activator.
|
||||
|
||||
(AA) 0000XXXX
|
||||
16-bit If Lower (unsigned) activator.
|
||||
|
||||
(AC) XXXXXXXX
|
||||
32-bit If Lower (unsigned) activator.
|
||||
|
||||
If the value stored at the address is lower than X, activate the next lines of code.
|
||||
|
||||
***If Higher (unsigned)***
|
||||
(B0) 000000XX
|
||||
8-bit If Higher (unsigned) activator.
|
||||
|
||||
(B2) 0000XXXX
|
||||
16-bit If Higher (unsigned) activator.
|
||||
|
||||
(B4) XXXXXXXX
|
||||
32-bit If Higher (unsigned) activator.
|
||||
|
||||
If the value stored at the address is higher than X, activate the next lines of code.
|
||||
|
||||
---Alignment---
|
||||
|
||||
Codes must be properly aligned depending on the type of code.
|
||||
8-bit codes can be used on ANY address.
|
||||
16-bit codes must have an address that is a multiple of 2: 0,2,4,6,8,A,C,E.
|
||||
32-bit codes must have an address that is a multiple of 4:0,4,8,C.
|
||||
If codes aren't aligned, they may not work, or may cause your AR to spaz out and kill your cat (R.I.P. Snowball).
|
||||
|
||||
---Signed & Unsigned Numbers---
|
||||
|
||||
Unsigned means :
|
||||
For 8-bits : 0x00 -> 0xFF = 0 to 255.
|
||||
For 16-bits: 0x0000 -> 0xFFFF = 0 to 65535.
|
||||
For 32-bits: 0x00000000 -> 0xFFFFFFFF = 0 to 4294967295.
|
||||
|
||||
Signed means :
|
||||
For 8-bits : 0x00 -> 0x7F = 0 to 127.
|
||||
0x80 -> 0xFF = -127 to -1.
|
||||
For 16-bits: 0x0000 -> 0x7FFF = 0 to 32767.
|
||||
0x8000 -> 0xFFFF = -32768 to -1.
|
||||
For 32-bits: 0x00000000 -> 0x7FFFFFFF = 0 to 2147483647.
|
||||
0x80000000 -> 0xFFFFFFFF = -2147483648 to -1.
|
||||
File diff suppressed because it is too large
Load Diff
-213
@@ -1,213 +0,0 @@
|
||||
//
|
||||
// Pseudo C
|
||||
//
|
||||
|
||||
//
|
||||
// DSP:
|
||||
//
|
||||
|
||||
// Memory USAGE
|
||||
|
||||
|
||||
|
||||
0x0B80 to 0x0C40 CurrentPB
|
||||
|
||||
0x0B87
|
||||
|
||||
0x0E15 SrcSelectFunction // perhaps CMD0 setups some kind of jmp table at this addresses
|
||||
0x0E16 CoefFunction
|
||||
0x0E14 MixCtrlFunction
|
||||
|
||||
0x0e17 TmpBuffer exceptions
|
||||
0x0e18 TmpBuffer exceptions
|
||||
0x0e19 TmpBuffer exceptions
|
||||
|
||||
// instrcution memory
|
||||
0x0B31 to 0x0B33 some kind of JMP-Table to handle srcSelect ???
|
||||
0x0B34 to 0x0B36 some kind of JMP-Table to handle coefSelect ???
|
||||
0x0B11 to 0x0B1F some kind of JMP-Table to handle mixerCtrl ???
|
||||
|
||||
void CMD2()
|
||||
{
|
||||
// 0x1BC
|
||||
int_addrPB = (*r00 << 16) | *(r00+1)
|
||||
DMA_From_Memory(0x0B80, _addrPB, 0xC0); // read first PB to 0x0B80
|
||||
|
||||
// 0x1C7
|
||||
*0x0E08 = 0x0000
|
||||
*0x0E09 = 0x0140
|
||||
*0x0E0A = 0x0280
|
||||
*0x0E0B = 0x0400
|
||||
*0x0E0C = 0x0540
|
||||
*0x0E0D = 0x0680
|
||||
*0x0E0E = 0x07C0
|
||||
*0x0E0F = 0x0900
|
||||
*0x0E10 = 0x0A40
|
||||
|
||||
// 0x1E4
|
||||
WaitForDMATransfer()
|
||||
|
||||
// 0x1E6
|
||||
Addr = (*0x0BA7 << 16) | *0x0BA8
|
||||
DMA_From_Memory(0x03C0, Addr, 0x80); // Copy Update Data to 0x03C0 (AXPBUPDATE dataHi, dataLo)
|
||||
|
||||
// 0x1F4
|
||||
R03 = (*0x0B84) + 0x0B31 // AXPB->srcSelect + 0x0B31 ??? some kind of flag handling ??? SRCSEL can be 0x0 to 0x2
|
||||
AC0.M = *R03
|
||||
*0x0E15 = *AC0.M
|
||||
|
||||
// 0x1FD
|
||||
R03 = (*0x0B85) + 0x0B34 // AXPB->coefSelect + 0x0B34 ??? some kind of flag handling ??? COEF can be 0x0 to 0x2
|
||||
AC0.M = *R03
|
||||
*0x0E16 = *AC0.M
|
||||
|
||||
// 0x206
|
||||
R03 = (*0x0B86) + 0x0B11 // AXPB->mixerCtrl + 0x0B36 ??? some kind of flag handling ??? MIXCTRL can be 0x0 to 0xE
|
||||
AC0.M = *R03
|
||||
*0x0E14 = *AC0.M
|
||||
|
||||
// 0x20F
|
||||
if (*0x0B9B == 0) // AXPBITD->flag (on or off for this voice)
|
||||
{
|
||||
// jmp to 0x23a
|
||||
*0x0E42 = 0x0CE0
|
||||
*0x0E40 = 0x0CE0
|
||||
*0x0E41 = 0x0CE0
|
||||
*0x0E43 = 0x0CE0
|
||||
|
||||
WaitForDMATransfer()
|
||||
}
|
||||
else
|
||||
{
|
||||
// code at 0x216
|
||||
*0x0E40 = *0x0B9E + 0x0CC0 // AXPBITD->shiftL
|
||||
*0x0E41 = *0x0B9F + 0x0CC0 // AXPBITD->shiftR
|
||||
*0x0E42 = 0xCE0
|
||||
*0x0E43 = 0xCE0
|
||||
|
||||
WaitForDMATransfer()
|
||||
|
||||
// 0x22a
|
||||
Addr = (*0x0B9C << 16) | *0x0B9D
|
||||
DMA_From_Memory(0x0CC0, Addr, 0x40); // (AXPBITD->bufferHi << 16 | AXPBITD->bufferLo) -> 0xCC0
|
||||
WaitForDMATransfer()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CMD0()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CMD3()
|
||||
{
|
||||
|
||||
0x0E07 = R00
|
||||
R00 = 0x0BA2 // AXPBUPDATE->updNum
|
||||
R01 = 0x03C0
|
||||
*0x0E04 = 0x05
|
||||
|
||||
AC1 = 0
|
||||
AC0 = 0
|
||||
AX0.H = *R00++ // AXPBUPDATE->updNum[0]
|
||||
AC1.M = 0x0B80
|
||||
|
||||
// 0x256
|
||||
for (i=0; i<AX0.H; i++)
|
||||
{
|
||||
AC0.M = *R01++
|
||||
AC0.M = AC0.M + AC1.M
|
||||
AX1.L = *R01++
|
||||
R02 = AC0.M
|
||||
*R02 = AX1.L
|
||||
}
|
||||
|
||||
// 0x25c
|
||||
R03 = 0x0E05
|
||||
*R03++ = R01
|
||||
*R03++ = R02
|
||||
|
||||
// 0x260
|
||||
AC0.M = *0x0B87 // AXPB->state
|
||||
|
||||
if (AC0.M == 1)
|
||||
{
|
||||
// JMP 0x267 (AX_PB_STATE_RUN)
|
||||
*0x0E1C = *0x0E42
|
||||
|
||||
CALLR *0x0E15 // Load Sample (SrcSelectFunction)
|
||||
|
||||
// 0x270
|
||||
AC0.M = *0xBB3 // AXPBVE->currentDelta (.15 volume at start of frame)
|
||||
AC1.M = *0xBB2 // AXPBVE->currentVolume
|
||||
|
||||
// 0x278
|
||||
AX0.L = AC1.M
|
||||
AC1.M = AC1.M + AC0.M
|
||||
AC0.M = AC0.M << 1
|
||||
|
||||
SET15 // ????
|
||||
|
||||
AX1.H = AC0.M
|
||||
AC0.M = AX0.L
|
||||
|
||||
AX0.L = 0x8000
|
||||
R00 = 0x0E44
|
||||
|
||||
// 0x27f
|
||||
// scale volume table
|
||||
.
|
||||
.
|
||||
.
|
||||
/* for (int i=0; i<32; i++)
|
||||
{
|
||||
*R00++ = AC0.M;
|
||||
prod = AX0.L * AX1.H
|
||||
|
||||
*R00++ = AC1.M;
|
||||
AC0 = AC0 + prod
|
||||
prod = AX0.L * AX1.H
|
||||
|
||||
*R00++ = AC0.M;
|
||||
AC1 = AC1 + prod
|
||||
prod = AX0.L * AX1.H
|
||||
}*/
|
||||
|
||||
// 0x29f
|
||||
*0xBB2 = CurrentVolume
|
||||
|
||||
|
||||
// 0x2a1
|
||||
// mutiply volume with sample
|
||||
.
|
||||
.
|
||||
.
|
||||
|
||||
|
||||
// 0x2ea
|
||||
// Call mixer
|
||||
|
||||
// 0x02f0
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// JMP 0x332
|
||||
.
|
||||
.
|
||||
.
|
||||
.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ===============================================================
|
||||
void Func_0x065D()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSP_InterC", "DSP_InterC\DSP_InterC.vcproj", "{A010425E-9D5E-461E-910D-0804C2A944D5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A010425E-9D5E-461E-910D-0804C2A944D5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A010425E-9D5E-461E-910D-0804C2A944D5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A010425E-9D5E-461E-910D-0804C2A944D5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A010425E-9D5E-461E-910D-0804C2A944D5}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,320 +0,0 @@
|
||||
/*====================================================================
|
||||
|
||||
filename: opcodes.h
|
||||
project: GameCube DSP Tool (gcdsp)
|
||||
created: 2005.03.04
|
||||
mail: duddie@walla.com
|
||||
|
||||
Copyright (c) 2005 Duddie
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
====================================================================*/
|
||||
//
|
||||
//
|
||||
// At the moment just ls and sl are using the prolog
|
||||
// perhaps all actions on r03 must be in the prolog
|
||||
//
|
||||
#include <stdafx.h>
|
||||
|
||||
#include "OutBuffer.h"
|
||||
|
||||
|
||||
|
||||
//
|
||||
void dsp_op_ext_r_epi(uint16 _Opcode)
|
||||
{
|
||||
uint8 op = (_Opcode >> 2) & 0x3;
|
||||
uint8 reg = _Opcode & 0x3;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case 0x00:
|
||||
OutBuffer::AddCode("Error: dsp_op_ext_r_epi");
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
OutBuffer::AddCode("%s--", OutBuffer::GetRegName(reg));
|
||||
// g_dsp.r[reg]--;
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(reg));
|
||||
//g_dsp.r[reg]++;
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(reg), OutBuffer::GetRegName(reg+4));
|
||||
// g_dsp.r[reg] += g_dsp.r[reg + 4];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_mv(uint16 _Opcode)
|
||||
{
|
||||
uint8 sreg = _Opcode & 0x3;
|
||||
uint8 dreg = ((_Opcode >> 2) & 0x3);
|
||||
|
||||
OutBuffer::AddCode("%s = %s", OutBuffer::GetRegName(dreg + 0x18), OutBuffer::GetRegName(sreg + 0x1c));
|
||||
|
||||
// g_dsp.r[dreg + 0x18] = g_dsp.r[sreg + 0x1c];
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_s(uint16 _Opcode)
|
||||
{
|
||||
uint8 dreg = _Opcode & 0x3;
|
||||
uint8 sreg = ((_Opcode >> 3) & 0x3) + 0x1c;
|
||||
|
||||
OutBuffer::AddCode("WriteDMEM(%s, %s)", OutBuffer::GetRegName(dreg), OutBuffer::GetRegName(sreg));
|
||||
// dsp_dmem_write(g_dsp.r[dreg], g_dsp.r[sreg]);
|
||||
|
||||
if (_Opcode & 0x04)
|
||||
{
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(dreg), OutBuffer::GetRegName(dreg+4));
|
||||
// g_dsp.r[dreg] += g_dsp.r[dreg + 4];
|
||||
}
|
||||
else
|
||||
{
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(dreg));
|
||||
//g_dsp.r[dreg]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_l(uint16 _Opcode)
|
||||
{
|
||||
uint8 sreg = _Opcode & 0x3;
|
||||
uint8 dreg = ((_Opcode >> 3) & 0x7) + 0x18;
|
||||
|
||||
OutBuffer::AddCode("%s = ReadDMEM(%s)", OutBuffer::GetRegName(dreg), OutBuffer::GetRegName(sreg));
|
||||
// uint16 val = dsp_dmem_read(g_dsp.r[sreg]);
|
||||
// g_dsp.r[dreg] = val;
|
||||
|
||||
if (_Opcode & 0x04)
|
||||
{
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(sreg), OutBuffer::GetRegName(sreg+4));
|
||||
// g_dsp.r[sreg] += g_dsp.r[sreg + 4];
|
||||
}
|
||||
else
|
||||
{
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(sreg));
|
||||
// g_dsp.r[sreg]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_ls_pro(uint16 _Opcode)
|
||||
{
|
||||
uint8 areg = (_Opcode & 0x1) + 0x1e;
|
||||
|
||||
OutBuffer::AddCode("WriteDMEM(%s, %s)", OutBuffer::GetRegName(0x03), OutBuffer::GetRegName(areg));
|
||||
// dsp_dmem_write(g_dsp.r[0x03], g_dsp.r[areg]);
|
||||
|
||||
if (_Opcode & 0x8)
|
||||
{
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(0x03), OutBuffer::GetRegName(0x07));
|
||||
// g_dsp.r[0x03] += g_dsp.r[0x07];
|
||||
}
|
||||
else
|
||||
{
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(0x03));
|
||||
// g_dsp.r[0x03]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_ls_epi(uint16 _Opcode)
|
||||
{
|
||||
uint8 dreg = ((_Opcode >> 4) & 0x3) + 0x18;
|
||||
|
||||
OutBuffer::AddCode("%s = ReadDMEM(%s)", OutBuffer::GetRegName(dreg), OutBuffer::GetRegName(0x00));
|
||||
// uint16 val = dsp_dmem_read(g_dsp.r[0x00]);
|
||||
// dsp_op_write_reg(dreg, val);
|
||||
|
||||
if (_Opcode & 0x4)
|
||||
{
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(0x00), OutBuffer::GetRegName(0x04));
|
||||
// g_dsp.r[0x00] += g_dsp.r[0x04];
|
||||
}
|
||||
else
|
||||
{
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(0x00));
|
||||
// g_dsp.r[0x00]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_sl_pro(uint16 _Opcode)
|
||||
{
|
||||
uint8 areg = (_Opcode & 0x1) + 0x1e;
|
||||
|
||||
OutBuffer::AddCode("WriteDMEM(%s, %s)", OutBuffer::GetRegName(0x00), OutBuffer::GetRegName(areg));
|
||||
// dsp_dmem_write(g_dsp.r[0x00], g_dsp.r[areg]);
|
||||
|
||||
if (_Opcode & 0x4)
|
||||
{
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(0x00), OutBuffer::GetRegName(0x04));
|
||||
// g_dsp.r[0x00] += g_dsp.r[0x04];
|
||||
}
|
||||
else
|
||||
{
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(0x00));
|
||||
// g_dsp.r[0x00]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_sl_epi(uint16 _Opcode)
|
||||
{
|
||||
uint8 dreg = ((_Opcode >> 4) & 0x3) + 0x18;
|
||||
|
||||
OutBuffer::AddCode("%s = ReadDMEM(%s)", OutBuffer::GetRegName(dreg), OutBuffer::GetRegName(0x03));
|
||||
// uint16 val = dsp_dmem_read(g_dsp.r[0x03]);
|
||||
// dsp_op_write_reg(dreg, val);
|
||||
|
||||
if (_Opcode & 0x8)
|
||||
{
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(0x03), OutBuffer::GetRegName(0x07));
|
||||
// g_dsp.r[0x03] += g_dsp.r[0x07];
|
||||
}
|
||||
else
|
||||
{
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(0x03));
|
||||
// g_dsp.r[0x03]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_ld(uint16 _Opcode)
|
||||
{
|
||||
uint8 dreg1 = (((_Opcode >> 5) & 0x1) << 1) + 0x18;
|
||||
uint8 dreg2 = (((_Opcode >> 4) & 0x1) << 1) + 0x19;
|
||||
uint8 sreg = _Opcode & 0x3;
|
||||
|
||||
OutBuffer::AddCode("%s = ReadDMEM(%s)", OutBuffer::GetRegName(dreg1), OutBuffer::GetRegName(sreg));
|
||||
OutBuffer::AddCode("%s = ReadDMEM(%s)", OutBuffer::GetRegName(dreg2), OutBuffer::GetRegName(0x03));
|
||||
|
||||
// g_dsp.r[dreg1] = dsp_dmem_read(g_dsp.r[sreg]);
|
||||
// g_dsp.r[dreg2] = dsp_dmem_read(g_dsp.r[0x03]);
|
||||
|
||||
if (_Opcode & 0x04)
|
||||
{
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(sreg), OutBuffer::GetRegName(sreg + 0x04));
|
||||
// g_dsp.r[sreg] += g_dsp.r[sreg + 0x04];
|
||||
}
|
||||
else
|
||||
{
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(sreg));
|
||||
// g_dsp.r[sreg]++;
|
||||
}
|
||||
|
||||
if (_Opcode & 0x08)
|
||||
{
|
||||
OutBuffer::AddCode("%s += %s", OutBuffer::GetRegName(0x03), OutBuffer::GetRegName(sreg + 0x07));
|
||||
// g_dsp.r[0x03] += g_dsp.r[0x07];
|
||||
}
|
||||
else
|
||||
{
|
||||
OutBuffer::AddCode("%s++", OutBuffer::GetRegName(0x03));
|
||||
// g_dsp.r[0x03]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
// ================================================================================
|
||||
|
||||
void dsp_op_ext_ops_pro(uint16 _Opcode)
|
||||
{
|
||||
if ((_Opcode & 0xFF) == 0){return;}
|
||||
|
||||
switch ((_Opcode >> 4) & 0xf)
|
||||
{
|
||||
case 0x00:
|
||||
dsp_op_ext_r_epi(_Opcode);
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
dsp_op_ext_mv(_Opcode);
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
case 0x03:
|
||||
dsp_op_ext_s(_Opcode);
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
case 0x05:
|
||||
case 0x06:
|
||||
case 0x07:
|
||||
dsp_op_ext_l(_Opcode);
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
case 0x09:
|
||||
case 0x0a:
|
||||
case 0x0b:
|
||||
|
||||
if (_Opcode & 0x2)
|
||||
{
|
||||
dsp_op_ext_sl_pro(_Opcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsp_op_ext_ls_pro(_Opcode);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
case 0x0c:
|
||||
case 0x0d:
|
||||
case 0x0e:
|
||||
case 0x0f:
|
||||
dsp_op_ext_ld(_Opcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dsp_op_ext_ops_epi(uint16 _Opcode)
|
||||
{
|
||||
if ((_Opcode & 0xFF) == 0){return;}
|
||||
|
||||
switch ((_Opcode >> 4) & 0xf)
|
||||
{
|
||||
case 0x08:
|
||||
case 0x09:
|
||||
case 0x0a:
|
||||
case 0x0b:
|
||||
|
||||
if (_Opcode & 0x2)
|
||||
{
|
||||
dsp_op_ext_sl_epi(_Opcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsp_op_ext_ls_epi(_Opcode);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*====================================================================
|
||||
|
||||
filename: opcodes.h
|
||||
project: GameCube DSP Tool (gcdsp)
|
||||
created: 2005.03.04
|
||||
mail: duddie@walla.com
|
||||
|
||||
Copyright (c) 2005 Duddie
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
====================================================================*/
|
||||
|
||||
#ifndef _GDSP_EXT_OP_H
|
||||
#define _GDSP_EXT_OP_H
|
||||
|
||||
void dsp_op_ext_ops_pro(uint16 _Opcode);
|
||||
void dsp_op_ext_ops_epi(uint16 _Opcode);
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,48 +0,0 @@
|
||||
/*====================================================================
|
||||
|
||||
filename: gdsp_opcodes.h
|
||||
project: GCemu
|
||||
created: 2004-6-18
|
||||
mail: duddie@walla.com
|
||||
|
||||
Copyright (c) 2005 Duddie & Tratax
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
====================================================================*/
|
||||
#ifndef _GDSP_OPCODES_H
|
||||
#define _GDSP_OPCODES_H
|
||||
|
||||
void dsp_op0(uint16 opc);
|
||||
void dsp_op1(uint16 opc);
|
||||
void dsp_op2(uint16 opc);
|
||||
void dsp_op3(uint16 opc);
|
||||
void dsp_op4(uint16 opc);
|
||||
void dsp_op5(uint16 opc);
|
||||
void dsp_op6(uint16 opc);
|
||||
void dsp_op7(uint16 opc);
|
||||
void dsp_op8(uint16 opc);
|
||||
void dsp_op9(uint16 opc);
|
||||
void dsp_opab(uint16 opc);
|
||||
void dsp_opcd(uint16 opc);
|
||||
void dsp_ope(uint16 opc);
|
||||
void dsp_opf(uint16 opc);
|
||||
|
||||
|
||||
#define R_SR 0x13
|
||||
|
||||
#define FLAG_ENABLE_INTERUPT 11
|
||||
|
||||
#endif
|
||||
@@ -1,52 +0,0 @@
|
||||
// DSP_InterC.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "DSPOpcodes.h"
|
||||
|
||||
uint16 g_IMemory[0x1000];
|
||||
uint16 g_currentAddress;
|
||||
|
||||
uint16 FetchOpcode()
|
||||
{
|
||||
uint16 value = swap16(g_IMemory[g_currentAddress & 0x0FFF]);
|
||||
g_currentAddress++;
|
||||
return value;
|
||||
}
|
||||
|
||||
void DecodeOpcode(uint16 op);
|
||||
|
||||
void Decode(uint16 startAddress, uint16 endAddress)
|
||||
{
|
||||
g_currentAddress = startAddress;
|
||||
|
||||
while (g_currentAddress < endAddress)
|
||||
{
|
||||
uint16 oldPC = g_currentAddress;
|
||||
uint16 op = FetchOpcode();
|
||||
|
||||
OutBuffer::Add("// l_%4X:", oldPC);
|
||||
DecodeOpcode(op);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
FILE* pFile = fopen("c:\\_\\dsp_rom.bin", "rb");
|
||||
if (pFile == NULL)
|
||||
return -1;
|
||||
|
||||
fread(g_IMemory, 0x1000, 1, pFile);
|
||||
fclose(pFile);
|
||||
|
||||
|
||||
//////
|
||||
OutBuffer::Init();
|
||||
Decode(0x80e7, 0x81f9);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,249 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="DSP_InterC"
|
||||
ProjectGUID="{A010425E-9D5E-461E-910D-0804C2A944D5}"
|
||||
RootNamespace="DSP_InterC"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\DSP_InterC.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DSPExt.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DSPExt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DSPOpcodes.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DSPOpcodes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OutBuffer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\OutBuffer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\targetver.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,155 +0,0 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// DSP_InterC.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace OutBuffer
|
||||
{
|
||||
void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Add(const char* _fmt, ...)
|
||||
{
|
||||
static char Msg[2048];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, _fmt);
|
||||
vsprintf(Msg, _fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
printf("%s\n", Msg);
|
||||
}
|
||||
|
||||
void AddCode(const char* _fmt, ...)
|
||||
{
|
||||
static char Msg[2048];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, _fmt);
|
||||
vsprintf(Msg, _fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
printf(" %s;\n", Msg);
|
||||
}
|
||||
|
||||
// predefined labels
|
||||
typedef struct pdlabel_t
|
||||
{
|
||||
uint16 addr;
|
||||
const char* name;
|
||||
const char* description;
|
||||
} pdlabels_t;
|
||||
|
||||
pdlabel_t regnames[] =
|
||||
{
|
||||
{0x00, "R00", "Register 00",},
|
||||
{0x01, "R01", "Register 01",},
|
||||
{0x02, "R02", "Register 02",},
|
||||
{0x03, "R03", "Register 03",},
|
||||
{0x04, "R04", "Register 04",},
|
||||
{0x05, "R05", "Register 05",},
|
||||
{0x06, "R06", "Register 06",},
|
||||
{0x07, "R07", "Register 07",},
|
||||
{0x08, "R08", "Register 08",},
|
||||
{0x09, "R09", "Register 09",},
|
||||
{0x0a, "R10", "Register 10",},
|
||||
{0x0b, "R11", "Register 11",},
|
||||
{0x0c, "ST0", "Call stack",},
|
||||
{0x0d, "ST1", "Data stack",},
|
||||
{0x0e, "ST2", "Loop address stack",},
|
||||
{0x0f, "ST3", "Loop counter",},
|
||||
{0x00, "ACH0", "Accumulator High 0",},
|
||||
{0x11, "ACH1", "Accumulator High 1",},
|
||||
{0x12, "CR", "Config Register",},
|
||||
{0x13, "SR", "Special Register",},
|
||||
{0x14, "PROD_l", "PROD L",},
|
||||
{0x15, "PROD_m1", "PROD M1",},
|
||||
{0x16, "PROD_h", "PROD H",},
|
||||
{0x17, "PROD_m2", "PROD M2",},
|
||||
{0x18, "AX0_l", "Additional Accumulators Low 0",},
|
||||
{0x19, "AX1_l", "Additional Accumulators Low 1",},
|
||||
{0x1a, "AX0_h", "Additional Accumulators High 0",},
|
||||
{0x1b, "AX1_h", "Additional Accumulators High 1",},
|
||||
{0x1c, "AC0_l", "Register 28",},
|
||||
{0x1d, "AC1_l", "Register 29",},
|
||||
{0x1e, "AC0_m", "Register 00",},
|
||||
{0x1f, "AC1_m", "Register 00",},
|
||||
|
||||
// additional to resolve special names
|
||||
{0x20, "ACC0", "Accumulators 0",},
|
||||
{0x21, "ACC1", "Accumulators 1",},
|
||||
{0x22, "AX0", "Additional Accumulators 0",},
|
||||
{0x23, "AX1", "Additional Accumulators 1",},
|
||||
};
|
||||
|
||||
const pdlabel_t pdlabels[] =
|
||||
{
|
||||
{0xffa0, "COEF_A1_0", "COEF_A1_0",},
|
||||
{0xffa1, "COEF_A2_0", "COEF_A2_0",},
|
||||
{0xffa2, "COEF_A1_1", "COEF_A1_1",},
|
||||
{0xffa3, "COEF_A2_1", "COEF_A2_1",},
|
||||
{0xffa4, "COEF_A1_2", "COEF_A1_2",},
|
||||
{0xffa5, "COEF_A2_2", "COEF_A2_2",},
|
||||
{0xffa6, "COEF_A1_3", "COEF_A1_3",},
|
||||
{0xffa7, "COEF_A2_3", "COEF_A2_3",},
|
||||
{0xffa8, "COEF_A1_4", "COEF_A1_4",},
|
||||
{0xffa9, "COEF_A2_4", "COEF_A2_4",},
|
||||
{0xffaa, "COEF_A1_5", "COEF_A1_5",},
|
||||
{0xffab, "COEF_A2_5", "COEF_A2_5",},
|
||||
{0xffac, "COEF_A1_6", "COEF_A1_6",},
|
||||
{0xffad, "COEF_A2_6", "COEF_A2_6",},
|
||||
{0xffae, "COEF_A1_7", "COEF_A1_7",},
|
||||
{0xffaf, "COEF_A2_7", "COEF_A2_7",},
|
||||
{0xffc9, "DSCR", "DSP DMA Control Reg",},
|
||||
{0xffcb, "DSBL", "DSP DMA Block Length",},
|
||||
{0xffcd, "DSPA", "DSP DMA DMEM Address",},
|
||||
{0xffce, "DSMAH", "DSP DMA Mem Address H",},
|
||||
{0xffcf, "DSMAL", "DSP DMA Mem Address L",},
|
||||
{0xffd1, "SampleFormat", "SampleFormat",},
|
||||
|
||||
{0xffd3, "Unk Zelda", "Unk Zelda writes to it",},
|
||||
|
||||
{0xffd4, "ACSAH", "Accelerator start address H",},
|
||||
{0xffd5, "ACSAL", "Accelerator start address L",},
|
||||
{0xffd6, "ACEAH", "Accelerator end address H",},
|
||||
{0xffd7, "ACEAL", "Accelerator end address L",},
|
||||
{0xffd8, "ACCAH", "Accelerator current address H",},
|
||||
{0xffd9, "ACCAL", "Accelerator current address L",},
|
||||
{0xffda, "pred_scale", "pred_scale",},
|
||||
{0xffdb, "yn1", "yn1",},
|
||||
{0xffdc, "yn2", "yn2",},
|
||||
{0xffdd, "ARAM", "Direct Read from ARAM (uses ADPCM)",},
|
||||
{0xffde, "GAIN", "Gain",},
|
||||
{0xffef, "AMDM", "ARAM DMA Request Mask",},
|
||||
{0xfffb, "DIRQ", "DSP IRQ Request",},
|
||||
{0xfffc, "DMBH", "DSP Mailbox H",},
|
||||
{0xfffd, "DMBL", "DSP Mailbox L",},
|
||||
{0xfffe, "CMBH", "CPU Mailbox H",},
|
||||
{0xffff, "CMBL", "CPU Mailbox L",},
|
||||
};
|
||||
|
||||
const char* GetRegName(uint16 reg)
|
||||
{
|
||||
return regnames[reg].name;
|
||||
}
|
||||
|
||||
const char* GetMemName(uint16 addr)
|
||||
{
|
||||
static char Buffer[1024];
|
||||
for (int i=0; i<sizeof(pdlabels); i++)
|
||||
{
|
||||
if (pdlabels[i].addr == addr)
|
||||
return pdlabels[i].name;
|
||||
}
|
||||
|
||||
sprintf(Buffer, "0x%4x", addr);
|
||||
return Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace OutBuffer
|
||||
{
|
||||
void Init();
|
||||
|
||||
void Add(const char* _fmt, ...);
|
||||
void AddCode(const char* _fmt, ...);
|
||||
|
||||
const char* GetRegName(uint16 reg);
|
||||
const char* GetMemName(uint16 addr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
@@ -1,33 +0,0 @@
|
||||
========================================================================
|
||||
CONSOLE APPLICATION : DSP_InterC Project Overview
|
||||
========================================================================
|
||||
|
||||
AppWizard has created this DSP_InterC application for you.
|
||||
|
||||
This file contains a summary of what you will find in each of the files that
|
||||
make up your DSP_InterC application.
|
||||
|
||||
|
||||
DSP_InterC.vcproj
|
||||
This is the main project file for VC++ projects generated using an Application Wizard.
|
||||
It contains information about the version of Visual C++ that generated the file, and
|
||||
information about the platforms, configurations, and project features selected with the
|
||||
Application Wizard.
|
||||
|
||||
DSP_InterC.cpp
|
||||
This is the main application source file.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Other standard files:
|
||||
|
||||
StdAfx.h, StdAfx.cpp
|
||||
These files are used to build a precompiled header (PCH) file
|
||||
named DSP_InterC.pch and a precompiled types file named StdAfx.obj.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Other notes:
|
||||
|
||||
AppWizard uses "TODO:" comments to indicate parts of the source code you
|
||||
should add to or customize.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1,234 +0,0 @@
|
||||
/*====================================================================
|
||||
|
||||
filename: opcodes.h
|
||||
project: GameCube DSP Tool (gcdsp)
|
||||
created: 2005.03.04
|
||||
mail: duddie@walla.com
|
||||
|
||||
Copyright (c) 2005 Duddie
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
====================================================================*/
|
||||
|
||||
#ifndef _GDSP_OPCODES_HELPER_H
|
||||
#define _GDSP_OPCODES_HELPER_H
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include "gdsp_opcodes.h"
|
||||
#include "gdsp_memory.h"
|
||||
#include "gdsp_interpreter.h"
|
||||
#include "gdsp_registers.h"
|
||||
#include "gdsp_ext_op.h"
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
//
|
||||
// --- SR
|
||||
//
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
inline void dsp_SR_set_flag(uint8 flag)
|
||||
{
|
||||
g_dsp.r[R_SR] |= (1 << flag);
|
||||
}
|
||||
|
||||
|
||||
inline bool dsp_SR_is_flag_set(uint8 flag)
|
||||
{
|
||||
return((g_dsp.r[R_SR] & (1 << flag)) > 0);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
//
|
||||
// --- reg
|
||||
//
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
inline uint16 dsp_op_read_reg(uint8 reg)
|
||||
{
|
||||
uint16 val;
|
||||
|
||||
switch (reg & 0x1f)
|
||||
{
|
||||
case 0x0c:
|
||||
case 0x0d:
|
||||
case 0x0e:
|
||||
case 0x0f:
|
||||
val = dsp_reg_load_stack(reg - 0x0c);
|
||||
break;
|
||||
|
||||
default:
|
||||
val = g_dsp.r[reg];
|
||||
break;
|
||||
}
|
||||
|
||||
return(val);
|
||||
}
|
||||
|
||||
|
||||
inline void dsp_op_write_reg(uint8 reg, uint16 val)
|
||||
{
|
||||
switch (reg & 0x1f)
|
||||
{
|
||||
case 0x0c:
|
||||
case 0x0d:
|
||||
case 0x0e:
|
||||
case 0x0f:
|
||||
dsp_reg_store_stack(reg - 0x0c, val);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_dsp.r[reg] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
//
|
||||
// --- prod
|
||||
//
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
inline sint64 dsp_get_long_prod()
|
||||
{
|
||||
sint64 val;
|
||||
sint64 low_prod;
|
||||
val = (sint8)g_dsp.r[0x16];
|
||||
val <<= 32;
|
||||
low_prod = g_dsp.r[0x15];
|
||||
low_prod += g_dsp.r[0x17];
|
||||
low_prod <<= 16;
|
||||
low_prod |= g_dsp.r[0x14];
|
||||
val += low_prod;
|
||||
return(val);
|
||||
}
|
||||
|
||||
|
||||
inline void dsp_set_long_prod(sint64 val)
|
||||
{
|
||||
g_dsp.r[0x14] = (uint16)val;
|
||||
val >>= 16;
|
||||
g_dsp.r[0x15] = (uint16)val;
|
||||
val >>= 16;
|
||||
g_dsp.r[0x16] = (uint16)val;
|
||||
g_dsp.r[0x17] = 0;
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
//
|
||||
// --- acc
|
||||
//
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
inline sint64 dsp_get_long_acc(uint8 reg)
|
||||
{
|
||||
_dbg_assert_(reg < 2);
|
||||
sint64 val;
|
||||
sint64 low_acc;
|
||||
val = (sint8)g_dsp.r[0x10 + reg];
|
||||
val <<= 32;
|
||||
low_acc = g_dsp.r[0x1e + reg];
|
||||
low_acc <<= 16;
|
||||
low_acc |= g_dsp.r[0x1c + reg];
|
||||
val |= low_acc;
|
||||
return(val);
|
||||
}
|
||||
|
||||
|
||||
inline uint64 dsp_get_ulong_acc(uint8 reg)
|
||||
{
|
||||
_dbg_assert_(reg < 2);
|
||||
uint64 val;
|
||||
uint64 low_acc;
|
||||
val = (uint8)g_dsp.r[0x10 + reg];
|
||||
val <<= 32;
|
||||
low_acc = g_dsp.r[0x1e + reg];
|
||||
low_acc <<= 16;
|
||||
low_acc |= g_dsp.r[0x1c + reg];
|
||||
val |= low_acc;
|
||||
return(val);
|
||||
}
|
||||
|
||||
|
||||
inline void dsp_set_long_acc(uint8 _reg, sint64 val)
|
||||
{
|
||||
_dbg_assert_(_reg < 2);
|
||||
g_dsp.r[0x1c + _reg] = (uint16)val;
|
||||
val >>= 16;
|
||||
g_dsp.r[0x1e + _reg] = (uint16)val;
|
||||
val >>= 16;
|
||||
g_dsp.r[0x10 + _reg] = (uint16)val;
|
||||
}
|
||||
|
||||
|
||||
inline sint16 dsp_get_acc_l(uint8 _reg)
|
||||
{
|
||||
_dbg_assert_(_reg < 2);
|
||||
return(g_dsp.r[0x1c + _reg]);
|
||||
}
|
||||
|
||||
|
||||
inline sint16 dsp_get_acc_m(uint8 _reg)
|
||||
{
|
||||
_dbg_assert_(_reg < 2);
|
||||
return(g_dsp.r[0x1e + _reg]);
|
||||
}
|
||||
|
||||
|
||||
inline sint16 dsp_get_acc_h(uint8 _reg)
|
||||
{
|
||||
_dbg_assert_(_reg < 2);
|
||||
return(g_dsp.r[0x10 + _reg]);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
//
|
||||
// --- acx
|
||||
//
|
||||
// ---------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
inline sint64 dsp_get_long_acx(uint8 _reg)
|
||||
{
|
||||
_dbg_assert_(_reg < 2);
|
||||
sint64 val = (sint16)g_dsp.r[0x1a + _reg];
|
||||
val <<= 16;
|
||||
sint64 low_acc = g_dsp.r[0x18 + _reg];
|
||||
val |= low_acc;
|
||||
return(val);
|
||||
}
|
||||
|
||||
|
||||
inline sint16 dsp_get_ax_l(uint8 _reg)
|
||||
{
|
||||
_dbg_assert_(_reg < 2);
|
||||
return(g_dsp.r[0x18 + _reg]);
|
||||
}
|
||||
|
||||
|
||||
inline sint16 dsp_get_ax_h(uint8 _reg)
|
||||
{
|
||||
_dbg_assert_(_reg < 2);
|
||||
return(g_dsp.r[0x1a + _reg]);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,23 +0,0 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// DSP_InterC.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
void ErrorLog(const char* _fmt, ...)
|
||||
{
|
||||
char Msg[512];
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, _fmt);
|
||||
vsprintf(Msg, _fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
printf("Error");
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned long long uint64;
|
||||
typedef unsigned int uint;
|
||||
|
||||
typedef signed char sint8;
|
||||
typedef signed short sint16;
|
||||
typedef signed int sint32;
|
||||
typedef signed long long sint64;
|
||||
|
||||
extern uint16 FetchOpcode();
|
||||
extern void ErrorLog(const char* _fmt, ...);
|
||||
|
||||
inline uint16 swap16(uint16 x)
|
||||
{
|
||||
return((x >> 8) | (x << 8));
|
||||
}
|
||||
|
||||
#include "OutBuffer.h"
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// The following macros define the minimum required platform. The minimum required platform
|
||||
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
|
||||
// your application. The macros work by enabling all features available on platform versions up to and
|
||||
// including the version specified.
|
||||
|
||||
// Modify the following defines if you have to target a platform prior to the ones specified below.
|
||||
// Refer to MSDN for the latest info on corresponding values for different platforms.
|
||||
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
|
||||
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user