Using Unix tools to operate on a tree containing filename with spaces in them
is really annoying, so rename the handful of instances where there were spaces.

Host.cpp has never been used.

Games tend to lookup the following directories that we don't yet have anything
to put in, so prepopulate them in Data/User/Wii:

title/00010001
title/00010002
title/00010003
title/00010004
title/00010005
title/00010006
title/00010007
meta
shared2/title
 
Set eol-style native on a number of text files which didn't already have it.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5572 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang
2010-06-02 18:00:22 +00:00
parent e2ef72504e
commit 664cea45c7
102 changed files with 58499 additions and 57808 deletions

View File

@ -1,52 +1,52 @@
// 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;
}
// 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;
}

View File

@ -1,249 +1,249 @@
<?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>
<?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>

View File

@ -1,33 +1,33 @@
========================================================================
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.
/////////////////////////////////////////////////////////////////////////////
========================================================================
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.
/////////////////////////////////////////////////////////////////////////////

View File

@ -1,45 +1,45 @@
CPU:
---------------------------------------------------------------------------------------
void DSPSendCommands2(_pBuffer, _NumberOfMessages, _StartWork)
{
while (!DSP_Running_Check());
OldInterrupts = OSDisableInterrupts();
if (DSPCheckMailToDSP() != 0)
{
OSRestoreInterrupts();
return -1;
}
DSPSendMailToDSP(_NumberOfMessages)
DSPAssertInt()
while (DSPCheckMailToDSP() != 0) {}
if (_NumberOfMessages == 0)
_NumberOfMessages = 1
if (_StartWork != 0)
{
r28 = DSPStartWork(*_pBuffer, _StartWork)
}
_StartWork = 0
while(Count != _NumberOfMessages)
{
DSPSendMailToDSP(Buffer[Count])
while (DSPCheckMailToDSP() != 0) {}
Count++
}
OSRestoreInterrupts(OldInterrupts)
return r28;
}
CPU:
---------------------------------------------------------------------------------------
void DSPSendCommands2(_pBuffer, _NumberOfMessages, _StartWork)
{
while (!DSP_Running_Check());
OldInterrupts = OSDisableInterrupts();
if (DSPCheckMailToDSP() != 0)
{
OSRestoreInterrupts();
return -1;
}
DSPSendMailToDSP(_NumberOfMessages)
DSPAssertInt()
while (DSPCheckMailToDSP() != 0) {}
if (_NumberOfMessages == 0)
_NumberOfMessages = 1
if (_StartWork != 0)
{
r28 = DSPStartWork(*_pBuffer, _StartWork)
}
_StartWork = 0
while(Count != _NumberOfMessages)
{
DSPSendMailToDSP(Buffer[Count])
while (DSPCheckMailToDSP() != 0) {}
Count++
}
OSRestoreInterrupts(OldInterrupts)
return r28;
}

View File

@ -1,45 +1,45 @@
# this can be used to upgrade disassemblies that aren't too annotated.
# won't do very well on the current zelda disasm.
import os
import sys
def GetPrefixLine(l, a):
for s in a:
if s[0:len(l)] == l:
return s
return ""
def GetComment(l):
comment_start = l.find("//")
if comment_start < 0:
comment_start = l.find("->")
if comment_start < 0:
return ""
while (l[comment_start-1] == ' ') or (l[comment_start-1] == '\t'):
comment_start -= 1
return l[comment_start:]
def main():
old_lines = open("DSP_UC_Zelda.txt", "r").readlines()
# for l in old_lines:
# print l
new_lines = open("zeldanew.txt", "r").readlines()
for i in range(0, len(old_lines)):
prefix = old_lines[i][0:14]
comment = GetComment(old_lines[i])
new_line = GetPrefixLine(prefix, new_lines)
if new_line:
old_lines[i] = new_line[:-1] + comment[:-1] + "\n"
for i in range(0, len(old_lines)):
print old_lines[i],
new_file = open("output.txt", "w")
new_file.writelines(old_lines)
# this can be used to upgrade disassemblies that aren't too annotated.
# won't do very well on the current zelda disasm.
import os
import sys
def GetPrefixLine(l, a):
for s in a:
if s[0:len(l)] == l:
return s
return ""
def GetComment(l):
comment_start = l.find("//")
if comment_start < 0:
comment_start = l.find("->")
if comment_start < 0:
return ""
while (l[comment_start-1] == ' ') or (l[comment_start-1] == '\t'):
comment_start -= 1
return l[comment_start:]
def main():
old_lines = open("DSP_UC_Zelda.txt", "r").readlines()
# for l in old_lines:
# print l
new_lines = open("zeldanew.txt", "r").readlines()
for i in range(0, len(old_lines)):
prefix = old_lines[i][0:14]
comment = GetComment(old_lines[i])
new_line = GetPrefixLine(prefix, new_lines)
if new_line:
old_lines[i] = new_line[:-1] + comment[:-1] + "\n"
for i in range(0, len(old_lines)):
print old_lines[i],
new_file = open("output.txt", "w")
new_file.writelines(old_lines)
main()

View File

@ -1,150 +1,150 @@
; This is the ucode used to "unlock" memcards
; RE purely out of interest, and hunch that it does trickies
IROM_BASE: equ 0x8000
; Exception vectors
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
halt ; Exception 0-6 nop slide to here
rti ; Exception 7
halt
; Entry point
; Standard init stuff
sbset #0x06
sbclr #0x03
sbclr #0x04
sbset #0x05
lri $CR, #0x00ff
lri $WR0, #0xffff
lri $WR1, #0xffff
lri $WR2, #0xffff
lri $WR3, #0xffff
set40
; 0xdcd10000 is the init mail
call wait_for_dsp_mbox
si @DMBH, #0xdcd1
si @DMBL, #0x0000
si @DIRQ, #0x0001
; Wait for cpu to say "go!" - i think
wait_for_start_cmd:
call wait_for_cpu_mbox
lrs $AC1.L, @CMBL
cmpi $AC1.M, #0xff00
jnz wait_for_start_cmd
dma_dram_and_prepare_for_crazy_irom_func:
call wait_for_cpu_mbox
mrr $AC0.M, $AC1.M
lrs $AC0.L, @CMBL ; main ram addr.l
andi $AC0.M, #0x0fff ; main ram addr.h & 0x0fff
lri $AX0.L, #0x0400 ; dsp addr
lri $AX0.H, #0x0010 ; length (bytes)
lri $AX1.L, #0x0000 ; dsp dram to cpu
set16
call do_dma
call IROM_BASE+0x0644; holy mother of jesus that func is gonna be hard
; 0xdcd10003 means finished unlocking?
call wait_for_dsp_mbox
si @DMBH, #0xdcd1
si @DMBL, #0x0003
si @DIRQ, #0x0001
set40
call wait_for_cpu_mbox
cmpi $AC1.M, #0xcdd1
jnz dma_dram_and_prepare_for_crazy_irom_func
lrs $AC1.M, @CMBL
cmpi $AC1.M, #0x0001
jz _005afunc
cmpi $AC1.M, #0x0002
jz IROM_BASE ; End of this ucode, wait for a new one
jmp dma_dram_and_prepare_for_crazy_irom_func
halt ; Prolly never reached
; 10 mails from cpu then irom func - looks interesting
_005afunc:
set16
call wait_for_cpu_mbox
lrs $AC1.L, @CMBL
call wait_for_cpu_mbox
lrs $AC1.L, @CMBL
call wait_for_cpu_mbox
lrs $AC1.L, @CMBL
call wait_for_cpu_mbox
lr $IX1, @CMBL
andi $AC1.M, #0x0fff
mrr $IX0, $AC1.M
call wait_for_cpu_mbox
lr $IX3, @CMBL
call wait_for_cpu_mbox
lr $IX2, @CMBL
call wait_for_cpu_mbox
lr $AR0, @CMBL
call wait_for_cpu_mbox
lrs $AX0.L, @CMBL
andi $AC1.M, #0x0fff
mrr $AX0.H, $AC1.M
call wait_for_cpu_mbox
lrs $AX1.L, @CMBL
call wait_for_cpu_mbox
lrs $AX1.H, @CMBL
sbclr #0x05
sbclr #0x06
jmp IROM_BASE+0x00b5; IROM - can dma stuff
halt
wait_for_dsp_mbox:
lrs $AC1.M, @DMBH
andcf $AC1.M, #0x8000
jlz wait_for_dsp_mbox
ret
wait_for_cpu_mbox:
lrs $AC1.M, @CMBH
andcf $AC1.M, #0x8000
jlnz wait_for_cpu_mbox
ret
do_dma:
srs @DSMAH, $AC0.M
srs @DSMAL, $AC0.L
sr @DSPA, $AX0.L
sr @DSCR, $AX1.L
sr @DSBL, $AX0.H
wait_dma:
lrs $AC0.M, @DSCR
andcf $AC0.M, #0x0004
jlz wait_dma
ret
; Trailing nops...pad to 32bytes
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
; uCode is 0xb0 words
; This is the ucode used to "unlock" memcards
; RE purely out of interest, and hunch that it does trickies
IROM_BASE: equ 0x8000
; Exception vectors
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
halt ; Exception 0-6 nop slide to here
rti ; Exception 7
halt
; Entry point
; Standard init stuff
sbset #0x06
sbclr #0x03
sbclr #0x04
sbset #0x05
lri $CR, #0x00ff
lri $WR0, #0xffff
lri $WR1, #0xffff
lri $WR2, #0xffff
lri $WR3, #0xffff
set40
; 0xdcd10000 is the init mail
call wait_for_dsp_mbox
si @DMBH, #0xdcd1
si @DMBL, #0x0000
si @DIRQ, #0x0001
; Wait for cpu to say "go!" - i think
wait_for_start_cmd:
call wait_for_cpu_mbox
lrs $AC1.L, @CMBL
cmpi $AC1.M, #0xff00
jnz wait_for_start_cmd
dma_dram_and_prepare_for_crazy_irom_func:
call wait_for_cpu_mbox
mrr $AC0.M, $AC1.M
lrs $AC0.L, @CMBL ; main ram addr.l
andi $AC0.M, #0x0fff ; main ram addr.h & 0x0fff
lri $AX0.L, #0x0400 ; dsp addr
lri $AX0.H, #0x0010 ; length (bytes)
lri $AX1.L, #0x0000 ; dsp dram to cpu
set16
call do_dma
call IROM_BASE+0x0644; holy mother of jesus that func is gonna be hard
; 0xdcd10003 means finished unlocking?
call wait_for_dsp_mbox
si @DMBH, #0xdcd1
si @DMBL, #0x0003
si @DIRQ, #0x0001
set40
call wait_for_cpu_mbox
cmpi $AC1.M, #0xcdd1
jnz dma_dram_and_prepare_for_crazy_irom_func
lrs $AC1.M, @CMBL
cmpi $AC1.M, #0x0001
jz _005afunc
cmpi $AC1.M, #0x0002
jz IROM_BASE ; End of this ucode, wait for a new one
jmp dma_dram_and_prepare_for_crazy_irom_func
halt ; Prolly never reached
; 10 mails from cpu then irom func - looks interesting
_005afunc:
set16
call wait_for_cpu_mbox
lrs $AC1.L, @CMBL
call wait_for_cpu_mbox
lrs $AC1.L, @CMBL
call wait_for_cpu_mbox
lrs $AC1.L, @CMBL
call wait_for_cpu_mbox
lr $IX1, @CMBL
andi $AC1.M, #0x0fff
mrr $IX0, $AC1.M
call wait_for_cpu_mbox
lr $IX3, @CMBL
call wait_for_cpu_mbox
lr $IX2, @CMBL
call wait_for_cpu_mbox
lr $AR0, @CMBL
call wait_for_cpu_mbox
lrs $AX0.L, @CMBL
andi $AC1.M, #0x0fff
mrr $AX0.H, $AC1.M
call wait_for_cpu_mbox
lrs $AX1.L, @CMBL
call wait_for_cpu_mbox
lrs $AX1.H, @CMBL
sbclr #0x05
sbclr #0x06
jmp IROM_BASE+0x00b5; IROM - can dma stuff
halt
wait_for_dsp_mbox:
lrs $AC1.M, @DMBH
andcf $AC1.M, #0x8000
jlz wait_for_dsp_mbox
ret
wait_for_cpu_mbox:
lrs $AC1.M, @CMBH
andcf $AC1.M, #0x8000
jlnz wait_for_cpu_mbox
ret
do_dma:
srs @DSMAH, $AC0.M
srs @DSMAL, $AC0.L
sr @DSPA, $AX0.L
sr @DSCR, $AX1.L
sr @DSBL, $AX0.H
wait_dma:
lrs $AC0.M, @DSCR
andcf $AC0.M, #0x0004
jlz wait_dma
ret
; Trailing nops...pad to 32bytes
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
; uCode is 0xb0 words

View File

@ -1,34 +1,34 @@
DSP startup sequence:
DspBoot called with (JASystem::TAudioThread::syncDSP()) as a parameter.
DSP lib initialized
A Dsp task is created:
init callback = DspHandShake()
req callback = JASystem::TAudioThread::syncDSP()
Task is pushed as first task and executed
DSP send DSP_INIT command (0xDCD10003)
__DSPHandler receive the command
task's init callback (DspHandShake) is called
1 mail is read from dsp (and discarded)
DSP flag is set as running
AIRegisterDMACallback(JASystem::TAudioThread::syncAudio((void))
AIStartDMA() to initialize dma in AI module
-----------------------------------
DSP run sequence:
__DSPHandler receive command DSP_RESUME
callback JASystem::TAudioThread::syncDSP called and pull 1 mail
A message is send by OSSendMessage(1)
JASystem::TAudioThread::audioproc receive OSMessage:
0=update dac
1=update dsp
2=nop ?
3=exit thread
DSP startup sequence:
DspBoot called with (JASystem::TAudioThread::syncDSP()) as a parameter.
DSP lib initialized
A Dsp task is created:
init callback = DspHandShake()
req callback = JASystem::TAudioThread::syncDSP()
Task is pushed as first task and executed
DSP send DSP_INIT command (0xDCD10003)
__DSPHandler receive the command
task's init callback (DspHandShake) is called
1 mail is read from dsp (and discarded)
DSP flag is set as running
AIRegisterDMACallback(JASystem::TAudioThread::syncAudio((void))
AIStartDMA() to initialize dma in AI module
-----------------------------------
DSP run sequence:
__DSPHandler receive command DSP_RESUME
callback JASystem::TAudioThread::syncDSP called and pull 1 mail
A message is send by OSSendMessage(1)
JASystem::TAudioThread::audioproc receive OSMessage:
0=update dac
1=update dsp
2=nop ?
3=exit thread
dsp is updated