summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXTra.KrazzY <XTra.KrazzY@gmail.com>2009-07-01 18:05:54 +0000
committerXTra.KrazzY <XTra.KrazzY@gmail.com>2009-07-01 18:05:54 +0000
commit7d7e2ec8a86d562ac0e1de0fa6bcb3661323b9c1 (patch)
treeb1d4da50d35a50d60079845cfbc8894585b82bc2
parent71556f77f630bc331a9fdd3ee945833a56cf48ed (diff)
Added the Zelda UCode preliminary synthesizer. It's far from perfect, but it sounds like the exact pitch it should synth. I'd be glad if someone finished it.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3630 8ced0084-cf51-0410-be5f-012b33b47a6e
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj92
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/SConscript1
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp72
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp20
-rw-r--r--docs/DSP/DSP_UC_Zelda.txt64
5 files changed, 163 insertions, 86 deletions
diff --git a/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj b/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj
index dc1a5a7261..45eca9c5c3 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj
+++ b/Source/Plugins/Plugin_DSP_HLE/Plugin_DSP_HLE.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="Plugin_DSP_HLE"
ProjectGUID="{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}"
RootNamespace="Plugin_DSP"
@@ -105,7 +105,7 @@
/>
</Configuration>
<Configuration
- Name="Release|Win32"
+ Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
@@ -126,19 +126,16 @@
/>
<Tool
Name="VCMIDLTool"
+ TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="1"
- OmitFramePointers="true"
+ Optimization="0"
AdditionalIncludeDirectories="../../Core/Common/Src;../../Core/AudioCommon/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
- RuntimeLibrary="0"
- BufferSecurityCheck="false"
- EnableEnhancedInstructionSet="2"
+ PreprocessorDefinitions="LOGGING;WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
FloatingPointModel="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
@@ -157,20 +154,18 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib OpenAL32.lib"
- OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLE.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="&quot;..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)&quot;;../../../Externals/OpenAL/Win32/"
+ AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib rpcrt4.lib comctl32.lib winmm.lib OpenAL32.lib"
+ OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLED.dll"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="&quot;..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)&quot;;../../../Externals/OpenAL/Win64/"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
- TargetMachine="1"
+ TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
@@ -192,11 +187,11 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="copy ..\..\..\Externals\OpenAL\Win32\OpenAL32.dll ..\..\..\Binary\Win32\OpenAL32.dll /Y&#x0D;&#x0A;copy ..\..\..\Externals\OpenAL\Win32\wrap_oal.dll ..\..\..\Binary\Win32\wrap_oal.dll /Y&#x0D;&#x0A;"
+ CommandLine="copy ..\..\..\Externals\OpenAL\Win64\OpenAL32.dll ..\..\..\Binary\x64\OpenAL32.dll /Y&#x0D;&#x0A;copy ..\..\..\Externals\OpenAL\Win64\wrap_oal.dll ..\..\..\Binary\x64\wrap_oal.dll /Y&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
- Name="DebugFast|Win32"
+ Name="Release|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
@@ -226,7 +221,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../Core/AudioCommon/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
- PreprocessorDefinitions="DEBUGFAST;WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
@@ -249,7 +244,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib OpenAL32.lib"
- OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLEDF.dll"
+ OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLE.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)&quot;;../../../Externals/OpenAL/Win32/"
GenerateManifest="false"
@@ -287,7 +282,7 @@
/>
</Configuration>
<Configuration
- Name="Debug|x64"
+ Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
@@ -312,12 +307,15 @@
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="0"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../Core/AudioCommon/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
- PreprocessorDefinitions="LOGGING;WIN32;_DEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
FloatingPointModel="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
@@ -336,14 +334,16 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib rpcrt4.lib comctl32.lib winmm.lib OpenAL32.lib"
- OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLED.dll"
- LinkIncremental="2"
+ AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib OpenAL32.lib"
+ OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLE.dll"
+ LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)&quot;;../../../Externals/OpenAL/Win64/"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
@@ -373,7 +373,7 @@
/>
</Configuration>
<Configuration
- Name="Release|x64"
+ Name="DebugFast|Win32"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
@@ -394,7 +394,6 @@
/>
<Tool
Name="VCMIDLTool"
- TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
@@ -404,9 +403,10 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="../../Core/Common/Src;../../Core/AudioCommon/Src;../../PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
+ PreprocessorDefinitions="DEBUGFAST;WIN32;NDEBUG;_WINDOWS;_USRDLL;DSP_HLE_EXPORTS;_SECURE_SCL=0"
RuntimeLibrary="0"
BufferSecurityCheck="false"
+ EnableEnhancedInstructionSet="2"
FloatingPointModel="0"
UsePrecompiledHeader="2"
AssemblerListingLocation="$(IntDir)\"
@@ -426,9 +426,9 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="dxguid.lib dsound.lib dxerr.lib comctl32.lib winmm.lib OpenAL32.lib"
- OutputFile="../../../Binary/x64/Plugins/Plugin_DSP_HLE.dll"
+ OutputFile="../../../Binary/Win32/Plugins/Plugin_DSP_HLEDF.dll"
LinkIncremental="1"
- AdditionalLibraryDirectories="&quot;..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)&quot;;../../../Externals/OpenAL/Win64/"
+ AdditionalLibraryDirectories="&quot;..\..\AudioCommon\$(PlatformName)\$(ConfigurationName)&quot;;../../../Externals/OpenAL/Win32/"
GenerateManifest="false"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)\$(TargetName).pdb"
@@ -438,7 +438,7 @@
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(PlatformName)\$(ConfigurationName)\$(TargetName).lib"
- TargetMachine="17"
+ TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
@@ -460,7 +460,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="copy ..\..\..\Externals\OpenAL\Win64\OpenAL32.dll ..\..\..\Binary\x64\OpenAL32.dll /Y&#x0D;&#x0A;copy ..\..\..\Externals\OpenAL\Win64\wrap_oal.dll ..\..\..\Binary\x64\wrap_oal.dll /Y&#x0D;&#x0A;"
+ CommandLine="copy ..\..\..\Externals\OpenAL\Win32\OpenAL32.dll ..\..\..\Binary\Win32\OpenAL32.dll /Y&#x0D;&#x0A;copy ..\..\..\Externals\OpenAL\Win32\wrap_oal.dll ..\..\..\Binary\Win32\wrap_oal.dll /Y&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
@@ -616,7 +616,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="DebugFast|Win32"
+ Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -624,7 +624,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|x64"
+ Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -685,6 +685,10 @@
>
</File>
<File
+ RelativePath=".\Src\UCodes\UCode_Zelda_Synth.cpp"
+ >
+ </File>
+ <File
RelativePath=".\Src\UCodes\UCode_Zelda_Voice.cpp"
>
</File>
@@ -810,7 +814,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -818,7 +822,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="DebugFast|Win32"
+ Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -826,7 +830,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -834,7 +838,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|x64"
+ Name="DebugFast|Win32"
>
<Tool
Name="VCCLCompilerTool"
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript
index 3d75c9e224..3e6f5a9683 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript
@@ -23,6 +23,7 @@ files = [
'UCodes/UCode_Zelda.cpp',
'UCodes/UCode_Zelda_ADPCM.cpp',
'UCodes/UCode_Zelda_Voice.cpp',
+ 'UCodes/UCode_Zelda_Synth.cpp',
]
dspenv = env.Clone()
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp
index 2989b4ae2c..0749c4d69c 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Synth.cpp
@@ -25,19 +25,75 @@
void CUCode_Zelda::MixAddSynth_Waveform(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{
- int mask = PB.Format ? 3 : 1;
-
- for (int i = 0; i < _Size; i++)
- {
- s16 sample = (i & mask) ? 0xc000 : 0x4000;
-
- _Buffer[i++] = (s32)sample;
- }
+ float ratioFactor = 32000.0f / (float)soundStream->GetMixer()->GetSampleRate();
+ u32 _ratio = (((PB.RatioInt * 80) + PB.RatioFrac) << 4) & 0xFFFF0000;
+ u64 ratio = (u64)(((_ratio / 80) << 16) * ratioFactor);
+ int mask = PB.Format ? 3 : 1, shift = PB.Format ? 2 : 1;
+
+ u32 pos[2] = {0, 0};
+ int i = 0;
+
+ if (PB.KeyOff != 0)
+ return;
+
+ if (PB.NeedsReset)
+ {
+ PB.RemLength = PB.Length - PB.RestartPos;
+ PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1);
+ PB.ReachedEnd = 0;
+ }
+
+_lRestart:
+ if (PB.ReachedEnd)
+ {
+ PB.ReachedEnd = 0;
+
+ if (PB.RepeatMode == 0)
+ {
+ PB.KeyOff = 1;
+ PB.RemLength = 0;
+ PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1) + PB.Length;
+ return;
+ }
+ else
+ {
+ PB.RestartPos = PB.LoopStartPos;
+ PB.RemLength = PB.Length - PB.RestartPos;
+ PB.CurAddr = PB.StartAddr + (PB.RestartPos << 1);
+ pos[1] = 0; pos[0] = 0;
+ }
+ }
+
+ for (; i < _Size;)
+ {
+ s16 sample = ((pos[1] & mask) == mask) ? 0xc000 : 0x4000;
+
+ _Buffer[i++] = (s32)sample;
+
+ (*(u64*)&pos) += ratio;
+ if ((pos[1] + ((PB.CurAddr - PB.StartAddr) >> 1)) >= PB.Length)
+ {
+ PB.ReachedEnd = 1;
+ goto _lRestart;
+ }
+ }
+
+ if (PB.RemLength < pos[1])
+ {
+ PB.RemLength = 0;
+ PB.ReachedEnd = 1;
+ }
+ else
+ PB.RemLength -= pos[1];
+
+ PB.CurAddr += pos[1] << 1;
+ // There should be a position fraction as well.
}
void CUCode_Zelda::MixAddSynth_Constant(ZeldaVoicePB &PB, s32* _Buffer, int _Size)
{
+ // TODO: Header, footer and cases this synth actually happens
for (int i = 0; i < _Size; i++)
_Buffer[i++] = (s32)PB.RatioInt;
}
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp
index dd874708ee..bce5f0e3f2 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp
@@ -281,20 +281,22 @@ void CUCode_Zelda::MixAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _RightBu
{
switch (PB.Format)
{
-
// Synthesized sounds
- case 0x0000:
- case 0x0001: // Used for "Denied" sound in Zelda
- //MixAddSynth_Waveform(PB, m_TempBuffer, _Size);
- break;
+ case 0x0000: // Example: Magic meter filling up in ZWW
+ case 0x0001: // Example: "Denied" sound when trying to pull out a sword
+ // indoors in ZWW
+ MixAddSynth_Waveform(PB, m_TempBuffer, _Size);
+ break;
case 0x0006:
- //MixAddSynth_Waveform(PB, m_TempBuffer, _Size);
- break;
+ WARN_LOG(DSPHLE, "Synthesizing 0x0006 (constant sound)");
+ MixAddSynth_Constant(PB, m_TempBuffer, _Size);
+ break;
- // These are more "synth" formats - square wave, saw wave etc.
+ // These are more "synth" formats - square wave, saw wave etc.
case 0x0002:
- return;
+ WARN_LOG(DSPHLE, "Synthesizing 0x0002");
+ break;
// AFC formats
diff --git a/docs/DSP/DSP_UC_Zelda.txt b/docs/DSP/DSP_UC_Zelda.txt
index 1a62b2a1c4..066b6e46d2 100644
--- a/docs/DSP/DSP_UC_Zelda.txt
+++ b/docs/DSP/DSP_UC_Zelda.txt
@@ -2915,37 +2915,51 @@ void 08b2_Unk() {
08b2 1401 lsl $ACC0, #1 // t = PB.RatioFrac * 2
// Set up sound buffers
- 08b3 009b c000 lri $AX1.H, #0xc000 // a = 0xc000
- 08b5 0099 4000 lri $AX1.L, #0x4000 // b = 0x4000
-
- 08b7 1150 08bf bloopi #0x50, 0x08bf
- // for(int i = 0; i < 80; i++) {
- 08b9 02c0 0001 andcf $AC0.M, #0x0001
- 08bb 027c iflnz
- 08bc 1b1b srri @$AR0, $AX1.H
- 08bd 027d iflz
- 08be 1b19 srri @$AR0, $AX1.L
- 08bf 4800 addax $ACC0, $AX0.L
- // }
- 08c0 147f lsr $ACC0, #-1
+ //08b3 009b c000 lri $AX1.H, #0xc000
+ //08b5 0099 4000 lri $AX1.L, #0x4000
+
+ //08b7 1150 08bf bloopi #0x50, 0x08bf
+ for(int i = 0; i < 80; i++) {
+ //08b9 02c0 0001 andcf $AC0.M, #0x0001
+ //08bb 027c iflnz
+ // 08bc 1b1b srri @$AR0, $AX1.H
+ //08bd 027d iflz
+ // 08be 1b19 srri @$AR0, $AX1.L
+ if(($AC0.M & 1) == 1)
+ *$AR0++ = 0x4000;
+ else
+ *$AR0++ = 0xc000;
+
+ 08bf 4800 addax $ACC0, $AX0.L // t += PB.RatioInt
+ }
+ 08c0 147f lsr $ACC0, #-1 // t /= 2
08c1 02df ret
}
void 08c2_Unk() {
- 08c2 1402 lsl $ACC0, #2
- 08c3 8900 clr $ACC1
- 08c4 1fb8 mrr $AC1.L, $AX0.L
- 08c5 1501 lsl $ACC1, #1
+ 08c2 1402 lsl $ACC0, #2 // t = PB.RatioFrac * 4
+ 08c3 8900 clr $ACC1 // ACC1 = 0
+ 08c4 1fb8 mrr $AC1.L, $AX0.L // AC1.L = PB.RatioInt
+ 08c5 1501 lsl $ACC1, #1 // ACC1 *= 2
08c6 009b c000 lri $AX1.H, #0xc000
08c8 0099 4000 lri $AX1.L, #0x4000
- 08ca 1150 08d2 bloopi #0x50, 0x08d2
- 08cc 02c0 0003 andcf $AC0.M, #0x0003
- 08ce 027c iflnz
- 08cf 1b1b srri @$AR0, $AX1.H
- 08d0 027d iflz
- 08d1 1b19 srri @$AR0, $AX1.L
- 08d2 4c00 add $ACC0, $AC1.L
- 08d3 147e lsr $ACC0, #-2
+ //08ca 1150 08d2 bloopi #0x50, 0x08d2
+ for(int i = 0; i < 80; i++) {
+ //08cc 02c0 0003 andcf $AC0.M, #0x0003
+ //08ce 027c iflnz
+ // 08cf 1b1b srri @$AR0, $AX1.H
+ //08d0 027d iflz
+ // 08d1 1b19 srri @$AR0, $AX1.L
+ //08d2 4c00 add $ACC0, $AC1.L
+
+ if(($AC0.M & 3) == 3)
+ *$AR0++ = 0x4000;
+ else
+ *$AR0++ = 0xc000;
+
+ t += (PB.RatioInt * 2);
+ }
+ 08d3 147e lsr $ACC0, #-2 // t /= 4
08d4 02df ret
}