port from perforce
This commit is contained in:
38
bp10-4k/4k.sln
Normal file
38
bp10-4k/4k.sln
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Preview", "src\Preview.vcxproj", "{DA076CF4-DCD0-4001-B47D-BDC9490D140A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VmCompiler", "src\VmCompiler.vcxproj", "{AC061108-4616-4A59-A9E8-C1E7CBD21780}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShaderCompiler", "src\ShaderCompiler.vcxproj", "{AF4A824A-DAE6-4E28-8982-17D68A79AED1}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "4k", "src\4k.vcxproj", "{90C69C40-035C-4711-BC89-EF36EC784E9A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DA076CF4-DCD0-4001-B47D-BDC9490D140A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DA076CF4-DCD0-4001-B47D-BDC9490D140A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DA076CF4-DCD0-4001-B47D-BDC9490D140A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DA076CF4-DCD0-4001-B47D-BDC9490D140A}.Release|Win32.Build.0 = Release|Win32
|
||||
{AC061108-4616-4A59-A9E8-C1E7CBD21780}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AC061108-4616-4A59-A9E8-C1E7CBD21780}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AC061108-4616-4A59-A9E8-C1E7CBD21780}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AC061108-4616-4A59-A9E8-C1E7CBD21780}.Release|Win32.Build.0 = Release|Win32
|
||||
{AF4A824A-DAE6-4E28-8982-17D68A79AED1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AF4A824A-DAE6-4E28-8982-17D68A79AED1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AF4A824A-DAE6-4E28-8982-17D68A79AED1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AF4A824A-DAE6-4E28-8982-17D68A79AED1}.Release|Win32.Build.0 = Release|Win32
|
||||
{90C69C40-035C-4711-BC89-EF36EC784E9A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{90C69C40-035C-4711-BC89-EF36EC784E9A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{90C69C40-035C-4711-BC89-EF36EC784E9A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{90C69C40-035C-4711-BC89-EF36EC784E9A}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
bp10-4k/link.exe
Normal file
BIN
bp10-4k/link.exe
Normal file
Binary file not shown.
BIN
bp10-4k/nasm.exe
Normal file
BIN
bp10-4k/nasm.exe
Normal file
Binary file not shown.
57
bp10-4k/src/4k.cpp
Normal file
57
bp10-4k/src/4k.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#define TARGET_4K
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
#include "math.h"
|
||||
#include "Variables.h"
|
||||
#include "Opcodes.h"
|
||||
#include "vm.h"
|
||||
#include "demo.h"
|
||||
#include "shaders.h"
|
||||
#include "graphics.h"
|
||||
#include "synth.h"
|
||||
|
||||
#pragma data_seg(".fltused")
|
||||
extern "C" int _fltused = 1;
|
||||
|
||||
#pragma data_seg(".edit")
|
||||
static char* edit = "edit";
|
||||
|
||||
void main()
|
||||
{
|
||||
_asm
|
||||
{
|
||||
XOR ESI, ESI
|
||||
PUSH ESI
|
||||
PUSH ESI
|
||||
PUSH ESI
|
||||
PUSH ESI
|
||||
PUSH ESI
|
||||
PUSH ESI
|
||||
PUSH height
|
||||
PUSH width
|
||||
PUSH ESI
|
||||
PUSH ESI
|
||||
PUSH WS_VISIBLE
|
||||
PUSH ESI
|
||||
PUSH edit
|
||||
PUSH 0x8
|
||||
CALL dword ptr [CreateWindowExA]
|
||||
MOV dword ptr [hWnd], EAX
|
||||
CALL dword ptr [ShowCursor]
|
||||
CALL dword ptr [InitGraphics]
|
||||
CALL dword ptr [InitSound]
|
||||
|
||||
theloop:
|
||||
}
|
||||
reg[254] = get_Time();
|
||||
reg[253] = D3DX_PI;
|
||||
_asm
|
||||
{
|
||||
CALL dword ptr [DrawFrame]
|
||||
PUSH VK_ESCAPE
|
||||
CALL dword ptr [GetAsyncKeyState]
|
||||
test eax, eax
|
||||
jz theloop
|
||||
CALL dword ptr [ExitProcess]
|
||||
}
|
||||
}
|
||||
323
bp10-4k/src/4k.vcproj
Normal file
323
bp10-4k/src/4k.vcproj
Normal file
@@ -0,0 +1,323 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="4k"
|
||||
ProjectGUID="{90C69C40-035C-4711-BC89-EF36EC784E9A}"
|
||||
RootNamespace="My4k"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)\$(ProjectName)\$(PlatformName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="false"
|
||||
ExceptionHandling="0"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="d3d9.lib d3dx9.lib winmm.lib"
|
||||
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)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)\$(ProjectName)\$(PlatformName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UseUnicodeResponseFiles="false"
|
||||
Optimization="1"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="false"
|
||||
ForceConformanceInForLoopScope="false"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="0"
|
||||
DebugInformationFormat="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/CRINKLER /HASHSIZE:200 /TRUNCATEFLOATS /RANGE:d3d9 /RANGE:d3dx9_42 /ORDERTRIES:5000 /HASHTRIES:200 /COMPMODE:SLOW /PROGRESSGUI /REPORT:report.html"
|
||||
AdditionalDependencies="d3d9.lib d3dx9.lib winmm.lib"
|
||||
GenerateManifest="false"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="2"
|
||||
LinkTimeCodeGeneration="0"
|
||||
EntryPointSymbol="main"
|
||||
RandomizedBaseAddress="0"
|
||||
DataExecutionPrevention="0"
|
||||
ErrorReporting="0"
|
||||
/>
|
||||
<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="API"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\graphics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\math.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Opcodes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\synth.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Variables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vm.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Data"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\4klang.asm"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="4klang.asm"
|
||||
CommandLine="nasm.exe -fwin32 -o"4klang.obj" 4klang.asm
"
|
||||
AdditionalDependencies="4klang.asm;4klang.inc"
|
||||
Outputs="4klang.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="4klang.asm"
|
||||
CommandLine="nasm.exe -fwin32 -o"4klang.obj" 4klang.asm
"
|
||||
AdditionalDependencies="4klang.asm;4klang.inc"
|
||||
Outputs="4klang.obj"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\4klang.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\4klang.inc"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\demo.txt"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\shaders.hlsl"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Generated"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\demo.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="demo.h"
|
||||
CommandLine="$(TargetDir)VmCompiler.exe demo.txt demo.h
"
|
||||
AdditionalDependencies="demo.txt"
|
||||
Outputs="blubb"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="demo.h"
|
||||
CommandLine="$(TargetDir)VmCompiler.exe demo.txt demo.h
"
|
||||
AdditionalDependencies="demo.txt"
|
||||
Outputs="bla"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\shaders.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="shaders.h"
|
||||
CommandLine="$(TargetDir)ShaderCompiler.exe shaders.hlsl
"
|
||||
AdditionalDependencies="shaders.hlsl"
|
||||
Outputs="bla"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="shaders.h"
|
||||
CommandLine="$(TargetDir)ShaderCompiler.exe shaders.hlsl
"
|
||||
AdditionalDependencies="shaders.hlsl"
|
||||
Outputs="bla"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\4k.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
65
bp10-4k/src/4k.vcproj.FIARA.Frank.user
Normal file
65
bp10-4k/src/4k.vcproj.FIARA.Frank.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="SHAIKUR"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="SHAIKUR"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
177
bp10-4k/src/4k.vcxproj
Normal file
177
bp10-4k/src/4k.vcxproj
Normal file
@@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{90C69C40-035C-4711-BC89-EF36EC784E9A}</ProjectGuid>
|
||||
<RootNamespace>My4k</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)obj\$(Configuration)\$(ProjectName)\$(Platform)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)obj\$(Configuration)\$(ProjectName)\$(Platform)\</IntDir>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>d3d9.lib;d3dx9.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<ForceConformanceInForLoopScope>false</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/CRINKLER /HASHSIZE:200 /TRUNCATEFLOATS /RANGE:d3d9 /RANGE:d3dx9_42 /ORDERTRIES:5000 /HASHTRIES:200 /COMPMODE:SLOW /PROGRESSGUI /REPORT:report.html %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>d3d9.lib;d3dx9.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<LinkTimeCodeGeneration>
|
||||
</LinkTimeCodeGeneration>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
<RandomizedBaseAddress>
|
||||
</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<LinkErrorReporting>
|
||||
</LinkErrorReporting>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="graphics.h" />
|
||||
<ClInclude Include="math.h" />
|
||||
<ClInclude Include="Opcodes.h" />
|
||||
<ClInclude Include="synth.h" />
|
||||
<ClInclude Include="Variables.h" />
|
||||
<ClInclude Include="vm.h" />
|
||||
<ClInclude Include="4klang.h" />
|
||||
<CustomBuild Include="demo.h">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">demo.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TargetDir)VmCompiler.exe demo.txt demo.h
|
||||
</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">demo.txt;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">blubb;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">demo.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TargetDir)VmCompiler.exe demo.txt demo.h
|
||||
</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">demo.txt;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">bla;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="shaders.h">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">shaders.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TargetDir)ShaderCompiler.exe shaders.hlsl
|
||||
</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">shaders.hlsl;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">bla;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shaders.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TargetDir)ShaderCompiler.exe shaders.hlsl
|
||||
</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shaders.hlsl;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">bla;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="4klang.asm">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.asm</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">nasm.exe -fwin32 -o"4klang.obj" 4klang.asm
|
||||
</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.asm;4klang.inc;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4klang.obj;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.asm</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">nasm.exe -fwin32 -o"4klang.obj" 4klang.asm
|
||||
</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.asm;4klang.inc;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4klang.obj;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<None Include="4klang.inc" />
|
||||
<None Include="demo.txt" />
|
||||
<None Include="shaders.hlsl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="4k.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="ShaderCompiler.vcxproj">
|
||||
<Project>{af4a824a-dae6-4e28-8982-17d68a79aed1}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="VmCompiler.vcxproj">
|
||||
<Project>{ac061108-4616-4a59-a9e8-c1e7cbd21780}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
62
bp10-4k/src/4k.vcxproj.filters
Normal file
62
bp10-4k/src/4k.vcxproj.filters
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="API">
|
||||
<UniqueIdentifier>{0001e9bd-d04b-4677-9b2d-b3f1d08db53d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Data">
|
||||
<UniqueIdentifier>{afb55b39-a0c1-486f-b5aa-5fa54ffeb0aa}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Data\Generated">
|
||||
<UniqueIdentifier>{cf507248-aa0c-4a17-9c3a-6d0f07a40fe7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="graphics.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="math.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Opcodes.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="synth.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Variables.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vm.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="4klang.h">
|
||||
<Filter>Data</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="4klang.inc">
|
||||
<Filter>Data</Filter>
|
||||
</None>
|
||||
<None Include="demo.txt">
|
||||
<Filter>Data</Filter>
|
||||
</None>
|
||||
<None Include="shaders.hlsl">
|
||||
<Filter>Data</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="4k.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="4klang.asm">
|
||||
<Filter>Data</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="demo.h">
|
||||
<Filter>Data\Generated</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="shaders.h">
|
||||
<Filter>Data\Generated</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
bp10-4k/src/4k.vcxproj.user
Normal file
3
bp10-4k/src/4k.vcxproj.user
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
1452
bp10-4k/src/4klang.asm
Normal file
1452
bp10-4k/src/4klang.asm
Normal file
File diff suppressed because it is too large
Load Diff
22
bp10-4k/src/4klang.h
Normal file
22
bp10-4k/src/4klang.h
Normal file
@@ -0,0 +1,22 @@
|
||||
// some useful song defines for 4klang
|
||||
#define SAMPLE_RATE 44100
|
||||
#define BPM 172.000000
|
||||
#define MAX_INSTRUMENTS 11
|
||||
#define MAX_PATTERNS 113
|
||||
#define PATTERN_SIZE_SHIFT 4
|
||||
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
|
||||
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
#define SAMPLES_PER_TICK 3845
|
||||
#define MAX_SAMPLES (2*SAMPLES_PER_TICK*MAX_TICKS)
|
||||
#define POLYPHONY 2
|
||||
#define FLOAT_32BIT
|
||||
#define SAMPLE_TYPE float
|
||||
|
||||
#define WINDOWS_OBJECT
|
||||
|
||||
// declaration of the external synth render function, you'll always need that
|
||||
extern "C" void __stdcall _4klang_render(void*);
|
||||
// declaration of the external envelope buffer. access only if you're song was exported with that option
|
||||
extern "C" float _4klang_envelope_buffer;
|
||||
// declaration of the external note buffer. access only if you're song was exported with that option
|
||||
extern "C" int _4klang_note_buffer;
|
||||
924
bp10-4k/src/4klang.inc
Normal file
924
bp10-4k/src/4klang.inc
Normal file
@@ -0,0 +1,924 @@
|
||||
%macro export_func 1
|
||||
global _%1
|
||||
_%1:
|
||||
%endmacro
|
||||
%define USE_SECTIONS
|
||||
%define SAMPLE_RATE 44100
|
||||
%define MAX_INSTRUMENTS 11
|
||||
%define MAX_VOICES 2
|
||||
%define HLD 1
|
||||
%define BPM 172.000000
|
||||
%define MAX_PATTERNS 113
|
||||
%define PATTERN_SIZE_SHIFT 4
|
||||
%define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
|
||||
%define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
%define SAMPLES_PER_TICK 3845
|
||||
%define DEF_LFO_NORMALIZE 0.0000650038
|
||||
%define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
|
||||
;%define GO4K_USE_16BIT_OUTPUT
|
||||
;%define GO4K_USE_GROOVE_PATTERN
|
||||
%define GO4K_USE_ENVELOPE_RECORDINGS
|
||||
;%define GO4K_USE_NOTE_RECORDINGS
|
||||
%define GO4K_CLIP_OUTPUT
|
||||
%define GO4K_USE_DST
|
||||
%define GO4K_USE_DLL
|
||||
%define GO4K_USE_PAN
|
||||
%define GO4K_USE_GLOBAL_DLL
|
||||
%define GO4K_USE_ENV_CHECK
|
||||
%define GO4K_USE_ENV_MOD_GM
|
||||
%define GO4K_USE_VCO_CHECK
|
||||
%define GO4K_USE_VCO_PHASE_OFFSET
|
||||
%define GO4K_USE_VCO_SHAPE
|
||||
%define GO4K_USE_VCO_MOD_TM
|
||||
%define GO4K_USE_VCO_MOD_DM
|
||||
%define GO4K_USE_VCO_MOD_GM
|
||||
%define GO4K_USE_VCF_CHECK
|
||||
%define GO4K_USE_VCF_MOD_FM
|
||||
%define GO4K_USE_VCF_HIGH
|
||||
%define GO4K_USE_VCF_BAND
|
||||
%define GO4K_USE_VCF_PEAK
|
||||
%define GO4K_USE_DST_CHECK
|
||||
%define GO4K_USE_DLL_CHORUS_CLAMP
|
||||
%define GO4K_USE_DLL_DAMP
|
||||
%define GO4K_USE_DLL_DC_FILTER
|
||||
%define GO4K_USE_FSTG_CHECK
|
||||
%define GO4K_USE_WAVESHAPER_CLIP
|
||||
%define MAX_DELAY 65536
|
||||
%define MAX_WORKSPACE_SLOTS 8
|
||||
%define GO4K_BEGIN_CMDDEF(def_name)
|
||||
%define GO4K_END_CMDDEF db 0
|
||||
%define GO4K_BEGIN_PARAMDEF(def_name)
|
||||
%define GO4K_END_PARAMDEF
|
||||
GO4K_ENV_ID equ 1
|
||||
%macro GO4K_ENV 5
|
||||
db %1
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
db %5
|
||||
%endmacro
|
||||
%define ATTAC(val) val
|
||||
%define DECAY(val) val
|
||||
%define SUSTAIN(val) val
|
||||
%define RELEASE(val) val
|
||||
%define GAIN(val) val
|
||||
struc go4kENV_val
|
||||
.attac resd 1
|
||||
.decay resd 1
|
||||
.sustain resd 1
|
||||
.release resd 1
|
||||
.gain resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kENV_wrk
|
||||
.state resd 1
|
||||
.level resd 1
|
||||
.gm resd 1
|
||||
.am resd 1
|
||||
.dm resd 1
|
||||
.sm resd 1
|
||||
.rm resd 1
|
||||
.size
|
||||
endstruc
|
||||
%define ENV_STATE_ATTAC 0
|
||||
%define ENV_STATE_DECAY 1
|
||||
%define ENV_STATE_SUSTAIN 2
|
||||
%define ENV_STATE_RELEASE 3
|
||||
%define ENV_STATE_OFF 4
|
||||
GO4K_VCO_ID equ 2
|
||||
%macro GO4K_VCO 8
|
||||
db %1
|
||||
db %2
|
||||
%ifdef GO4K_USE_VCO_PHASE_OFFSET
|
||||
db %3
|
||||
%endif
|
||||
%ifdef GO4K_USE_VCO_GATE
|
||||
db %4
|
||||
%endif
|
||||
db %5
|
||||
%ifdef GO4K_USE_VCO_SHAPE
|
||||
db %6
|
||||
%endif
|
||||
db %7
|
||||
db %8
|
||||
%endmacro
|
||||
%define TRANSPOSE(val) val
|
||||
%define DETUNE(val) val
|
||||
%define PHASE(val) val
|
||||
%define GATES(val) val
|
||||
%define COLOR(val) val
|
||||
%define SHAPE(val) val
|
||||
%define FLAGS(val) val
|
||||
%define SINE 0x01
|
||||
%define TRISAW 0x02
|
||||
%define PULSE 0x04
|
||||
%define NOISE 0x08
|
||||
%define LFO 0x10
|
||||
%define GATE 0x20
|
||||
struc go4kVCO_val
|
||||
.transpose resd 1
|
||||
.detune resd 1
|
||||
%ifdef GO4K_USE_VCO_PHASE_OFFSET
|
||||
.phaseofs resd 1
|
||||
%endif
|
||||
%ifdef GO4K_USE_VCO_GATE
|
||||
.gate resd 1
|
||||
%endif
|
||||
.color resd 1
|
||||
%ifdef GO4K_USE_VCO_SHAPE
|
||||
.shape resd 1
|
||||
%endif
|
||||
.gain resd 1
|
||||
.flags resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kVCO_wrk
|
||||
.phase resd 1
|
||||
.tm resd 1
|
||||
.dm resd 1
|
||||
.fm resd 1
|
||||
.pm resd 1
|
||||
.cm resd 1
|
||||
.sm resd 1
|
||||
.gm resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_VCF_ID equ 3
|
||||
%macro GO4K_VCF 3
|
||||
db %1
|
||||
db %2
|
||||
db %3
|
||||
%endmacro
|
||||
%define LOWPASS 0x1
|
||||
%define HIGHPASS 0x2
|
||||
%define BANDPASS 0x4
|
||||
%define BANDSTOP 0x3
|
||||
%define ALLPASS 0x7
|
||||
%define PEAK 0x8
|
||||
%define FREQUENCY(val) val
|
||||
%define RESONANCE(val) val
|
||||
%define VCFTYPE(val) val
|
||||
struc go4kVCF_val
|
||||
.freq resd 1
|
||||
.res resd 1
|
||||
.type resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kVCF_wrk
|
||||
.low resd 1
|
||||
.high resd 1
|
||||
.band resd 1
|
||||
.freq resd 1
|
||||
.fm resd 1
|
||||
.rm resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_DST_ID equ 4
|
||||
%macro GO4K_DST 2
|
||||
db %1
|
||||
%ifdef GO4K_USE_DST_SH
|
||||
db %2
|
||||
%endif
|
||||
%endmacro
|
||||
%define DRIVE(val) val
|
||||
%define SNHFREQ(val) val
|
||||
struc go4kDST_val
|
||||
.drive resd 1
|
||||
%ifdef GO4K_USE_DST_SH
|
||||
.snhfreq resd 1
|
||||
%endif
|
||||
.size
|
||||
endstruc
|
||||
struc go4kDST_wrk
|
||||
%ifdef GO4K_USE_DST_SH
|
||||
.out resd 1
|
||||
.snhphase resd 1
|
||||
%endif
|
||||
.dm resd 1
|
||||
.sm resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_DLL_ID equ 5
|
||||
%macro GO4K_DLL 8
|
||||
db %1
|
||||
db %2
|
||||
db %3
|
||||
%ifdef GO4K_USE_DLL_DAMP
|
||||
db %4
|
||||
%endif
|
||||
%ifdef GO4K_USE_DLL_CHORUS
|
||||
db %5
|
||||
db %6
|
||||
%endif
|
||||
db %7
|
||||
db %8
|
||||
%endmacro
|
||||
%define PREGAIN(val) val
|
||||
%define DRY(val) val
|
||||
%define FEEDBACK(val) val
|
||||
%define DEPTH(val) val
|
||||
%define DAMP(val) val
|
||||
%define DELAY(val) val
|
||||
%define COUNT(val) val
|
||||
struc go4kDLL_val
|
||||
.pregain resd 1
|
||||
.dry resd 1
|
||||
.feedback resd 1
|
||||
%ifdef GO4K_USE_DLL_DAMP
|
||||
.damp resd 1
|
||||
%endif
|
||||
%ifdef GO4K_USE_DLL_CHORUS
|
||||
.freq resd 1
|
||||
.depth
|
||||
%endif
|
||||
.delay resd 1
|
||||
.count resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kDLL_wrk
|
||||
.index resd 1
|
||||
.store resd 1
|
||||
.dcin resd 1
|
||||
.dcout resd 1
|
||||
%ifdef GO4K_USE_DLL_CHORUS
|
||||
.phase resd 1
|
||||
%endif
|
||||
.buffer resd MAX_DELAY
|
||||
.size
|
||||
endstruc
|
||||
GO4K_FOP_ID equ 6
|
||||
%macro GO4K_FOP 1
|
||||
db %1
|
||||
%endmacro
|
||||
%define OP(val) val
|
||||
%define FOP_POP 0x1
|
||||
%define FOP_ADDP 0x2
|
||||
%define FOP_MULP 0x3
|
||||
%define FOP_PUSH 0x4
|
||||
%define FOP_XCH 0x5
|
||||
%define FOP_ADD 0x6
|
||||
%define FOP_MUL 0x7
|
||||
%define FOP_ADDP2 0x8
|
||||
%define FOP_LOADNOTE 0x9
|
||||
struc go4kFOP_val
|
||||
.flags resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kFOP_wrk
|
||||
.size
|
||||
endstruc
|
||||
GO4K_FST_ID equ 7
|
||||
%macro GO4K_FST 2
|
||||
db %1
|
||||
db %2
|
||||
%endmacro
|
||||
%define AMOUNT(val) val
|
||||
%define DEST(val) val
|
||||
struc go4kFST_val
|
||||
.amount resd 1
|
||||
.op1 resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kFST_wrk
|
||||
.size
|
||||
endstruc
|
||||
GO4K_PAN_ID equ 8
|
||||
%macro GO4K_PAN 1
|
||||
%ifdef GO4K_USE_PAN
|
||||
db %1
|
||||
%endif
|
||||
%endmacro
|
||||
%define PANNING(val) val
|
||||
struc go4kPAN_val
|
||||
%ifdef GO4K_USE_PAN
|
||||
.panning resd 1
|
||||
%endif
|
||||
.size
|
||||
endstruc
|
||||
struc go4kPAN_wrk
|
||||
.pm resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_OUT_ID equ 9
|
||||
%macro GO4K_OUT 2
|
||||
db %1
|
||||
%ifdef GO4K_USE_GLOBAL_DLL
|
||||
db %2
|
||||
%endif
|
||||
%endmacro
|
||||
%define AUXSEND(val) val
|
||||
struc go4kOUT_val
|
||||
.gain resd 1
|
||||
%ifdef GO4K_USE_GLOBAL_DLL
|
||||
.auxsend resd 1
|
||||
%endif
|
||||
.size
|
||||
endstruc
|
||||
struc go4kOUT_wrk
|
||||
.am resd 1
|
||||
.gm resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_ACC_ID equ 10
|
||||
%macro GO4K_ACC 1
|
||||
db %1
|
||||
%endmacro
|
||||
%define OUTPUT 0
|
||||
%define AUX 8
|
||||
%define ACCTYPE(val) val
|
||||
struc go4kACC_val
|
||||
.acctype resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kACC_wrk
|
||||
.size
|
||||
endstruc
|
||||
%ifdef GO4K_USE_FSTG
|
||||
GO4K_FSTG_ID equ 11
|
||||
%macro GO4K_FSTG 2
|
||||
db %1
|
||||
dd %2
|
||||
%endmacro
|
||||
struc go4kFSTG_val
|
||||
.amount resd 1
|
||||
.op1 resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kFSTG_wrk
|
||||
.size
|
||||
endstruc
|
||||
%endif
|
||||
%ifdef GO4K_USE_FSTG
|
||||
%define NUM_COMMANDS 12
|
||||
%else
|
||||
%define NUM_COMMANDS 11
|
||||
%endif
|
||||
struc go4k_instrument
|
||||
.release resd 1
|
||||
.note resd 1
|
||||
.workspace resd 256
|
||||
.dlloutl resd 1
|
||||
.dlloutr resd 1
|
||||
.outl resd 1
|
||||
.outr resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4k_synth
|
||||
.instruments resb go4k_instrument.size * MAX_INSTRUMENTS * MAX_VOICES
|
||||
.global resb go4k_instrument.size * MAX_VOICES
|
||||
.size
|
||||
endstruc
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc1 data align=1
|
||||
%else
|
||||
section .data align=1
|
||||
%endif
|
||||
go4k_patterns
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 37, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 44, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 42, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 68, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 71, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 66, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 69, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 90, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 92, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 89, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 85, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 80, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 87, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 95, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 85, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 87, HLD,
|
||||
db 95, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 94, HLD,
|
||||
db 97, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 94, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 65, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 75, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 73, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 78, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 0, 0, 0, 0, 60, 0, 0, 0, 60, 0, 0, 0, 0, 0, 60, 0,
|
||||
db 60, 0, 60, 0, 60, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 0, 0, 60, 0, 60, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0,
|
||||
db 60, 0, 60, 60, 0, 0, 60, 0, 0, 0, 60, 0, 60, 0, 0, 0,
|
||||
db 0, 0, 0, 60, 0, 0, 60, 0, 0, 0, 60, 0, 60, 0, 60, 0,
|
||||
db 60, 0, 0, 0, 0, 0, 60, 0, 0, 0, 60, 0, 60, 0, 60, 0,
|
||||
db 60, 0, 60, 60, 0, 0, 60, 0, 60, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 48, HLD, HLD, HLD, HLD, HLD, 48, HLD,
|
||||
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 48, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 48, HLD, HLD, HLD, HLD, HLD, 48, HLD,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 60, HLD, HLD, HLD, 0, 0, 0, 0,
|
||||
db 60, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 60, HLD, HLD, HLD, 0, 0, 60, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 0, 49, 0,
|
||||
db 49, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 49, 0, 0, 0,
|
||||
db 49, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 47, 0, 44, 0,
|
||||
db 37, 0, 37, 0, 0, 0, 49, 0, 0, 0, 0, 0, 49, 0, 0, 0,
|
||||
db 44, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 44, 0, 0, 0,
|
||||
db 44, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 54, 0, 51, 0,
|
||||
db 44, 0, 44, 0, 0, 0, 56, 0, 0, 0, 0, 0, 44, 0, 0, 0,
|
||||
db 42, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 42, 0, 0, 0,
|
||||
db 42, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 52, 0, 49, 0,
|
||||
db 42, 0, 42, 0, 0, 0, 54, 0, 0, 0, 0, 0, 42, 0, 0, 0,
|
||||
db 49, HLD, 49, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 49, 0, 61, HLD,
|
||||
db 49, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 61, 0, 47, 0, 44, 0,
|
||||
db 37, 0, 37, 0, 0, 0, 49, 0, 0, 0, 59, 0, 49, 0, 49, 0,
|
||||
db 49, 0, 0, 0, 61, 0, 0, 0, 0, 0, 61, 0, 47, 0, 44, 0,
|
||||
db 44, HLD, 44, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 44, 0, 56, HLD,
|
||||
db 44, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 56, 0, 54, 0, 51, 0,
|
||||
db 44, 0, 44, 0, 0, 0, 56, 0, 0, 0, 54, 0, 44, 0, 44, 0,
|
||||
db 44, 0, 0, 0, 56, 0, 0, 0, 0, 0, 56, 0, 54, 0, 51, 0,
|
||||
db 42, HLD, 42, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 42, 0, 54, HLD,
|
||||
db 42, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 54, 0, 52, 0, 49, 0,
|
||||
db 42, 0, 42, 0, 0, 0, 54, 0, 0, 0, 52, 0, 42, 0, 42, 0,
|
||||
db 42, 0, 0, 0, 54, 0, 0, 0, 0, 0, 54, 0, 52, 0, 49, 0,
|
||||
db 73, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 75, HLD,
|
||||
db 83, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 82, HLD,
|
||||
db 83, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 82, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 81, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
go4k_patterns_end
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc2 data align=1
|
||||
%else
|
||||
section .data
|
||||
%endif
|
||||
go4k_pattern_lists
|
||||
Instrument0List db 1, 2, 2, 2, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 4, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 4, 2, 2, 2, 1, 2, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 4, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 3, 2, 2, 2, 1, 2, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 1, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0,
|
||||
Instrument1List db 5, 2, 2, 2, 2, 2, 6, 2, 2, 2, 5, 2, 2, 2, 7, 2, 2, 2, 5, 2, 2, 2, 6, 2, 2, 2, 5, 2, 2, 2, 8, 2, 2, 2, 5, 2, 2, 2, 6, 2, 2, 2, 5, 2, 2, 2, 7, 2, 2, 2, 5, 2, 2, 2, 6, 2, 2, 2, 5, 2, 2, 2, 8, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 2, 2, 2, 7, 2, 2, 2, 8, 2, 2, 2, 5, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
|
||||
Instrument2List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 11, 12, 13, 14, 2, 15, 2, 10, 2, 12, 2, 9, 2, 0, 0, 0, 0, 16, 11, 14, 2, 17, 10, 2, 2, 14, 11, 9, 18, 15, 19, 10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
Instrument3List db 20, 2, 2, 2, 2, 2, 21, 2, 2, 2, 22, 2, 2, 2, 22, 2, 2, 2, 23, 2, 2, 2, 21, 2, 2, 2, 23, 2, 2, 2, 24, 2, 2, 2, 22, 2, 2, 2, 21, 2, 2, 2, 22, 2, 2, 2, 22, 2, 2, 2, 23, 2, 2, 2, 21, 2, 2, 2, 23, 2, 2, 2, 24, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 2, 2, 2, 22, 2, 2, 2, 22, 2, 2, 2, 23, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
|
||||
Instrument4List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 0, 0, 0, 0, 0, 0, 0, 28, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
Instrument5List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 0, 0, 0, 0, 0, 0, 0, 32, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
Instrument6List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 34, 34, 34, 35, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0,
|
||||
Instrument7List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 37, 37, 38, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
Instrument8List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 40, 41, 42, 41, 43, 44, 45, 44, 40, 41, 42, 41, 46, 47, 48, 47, 40, 41, 42, 41, 43, 44, 45, 44, 40, 41, 42, 41, 43, 44, 45, 44, 49, 50, 51, 52, 53, 54, 55, 56, 49, 50, 51, 52, 57, 58, 59, 60, 4, 2, 2, 2, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0,
|
||||
Instrument9List db 0, 0, 61, 23, 2, 13, 62, 13, 2, 21, 24, 23, 2, 12, 63, 2, 64, 2, 13, 2, 2, 12, 62, 13, 2, 24, 2, 23, 2, 22, 2, 2, 2, 2, 61, 23, 2, 13, 62, 13, 2, 21, 24, 23, 2, 12, 63, 2, 64, 2, 13, 2, 2, 12, 62, 13, 2, 24, 2, 23, 2, 22, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 23, 24, 0, 24, 13, 65, 2, 14, 9, 11, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0,
|
||||
Instrument10List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
go4k_pattern_lists_end
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc3 data align=1
|
||||
%else
|
||||
section .data
|
||||
%endif
|
||||
go4k_synth_instructions
|
||||
GO4K_BEGIN_CMDDEF(Instrument0)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument1)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument2)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument3)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument4)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument5)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument6)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument7)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument8)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument9)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument10)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Global)
|
||||
db GO4K_ACC_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_ACC_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
go4k_synth_instructions_end
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc4 data align=1
|
||||
%else
|
||||
section .data
|
||||
%endif
|
||||
go4k_synth_parameter_values
|
||||
GO4K_BEGIN_PARAMDEF(Instrument0)
|
||||
GO4K_ENV ATTAC(80),DECAY(128),SUSTAIN(40),RELEASE(80),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(48),GATES(85),COLOR(97),SHAPE(112),GAIN(128),FLAGS(PULSE)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(85),COLOR(8),SHAPE(120),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(28),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(90),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FST AMOUNT(72),DEST(1*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FST AMOUNT(56),DEST(2*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(16),RESONANCE(64),VCFTYPE(PEAK)
|
||||
GO4K_VCF FREQUENCY(48),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_FOP OP(FOP_PUSH)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_PAN PANNING(88)
|
||||
GO4K_OUT GAIN(24), AUXSEND(16)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument1)
|
||||
GO4K_ENV ATTAC(80),DECAY(96),SUSTAIN(96),RELEASE(88),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(16),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FST AMOUNT(73),DEST(14*MAX_WORKSPACE_SLOTS+4)
|
||||
GO4K_FST AMOUNT(65),DEST(7*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(68),PHASE(64),GATES(0),COLOR(96),SHAPE(112),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(60),PHASE(0),GATES(0),COLOR(96),SHAPE(112),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(0),COLOR(48),SHAPE(80),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_DST DRIVE(32), SNHFREQ(128)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(BANDSTOP)
|
||||
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(16),COUNT(1)
|
||||
GO4K_PAN PANNING(52)
|
||||
GO4K_OUT GAIN(48), AUXSEND(24)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument2)
|
||||
GO4K_ENV ATTAC(72),DECAY(96),SUSTAIN(96),RELEASE(88),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(16),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FST AMOUNT(73),DEST(14*MAX_WORKSPACE_SLOTS+4)
|
||||
GO4K_FST AMOUNT(65),DEST(7*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(68),PHASE(64),GATES(0),COLOR(96),SHAPE(112),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(60),PHASE(0),GATES(0),COLOR(96),SHAPE(112),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(0),COLOR(48),SHAPE(80),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_DST DRIVE(32), SNHFREQ(128)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(BANDSTOP)
|
||||
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(16),COUNT(1)
|
||||
GO4K_PAN PANNING(32)
|
||||
GO4K_OUT GAIN(48), AUXSEND(32)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument3)
|
||||
GO4K_ENV ATTAC(80),DECAY(96),SUSTAIN(96),RELEASE(88),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(16),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FST AMOUNT(73),DEST(14*MAX_WORKSPACE_SLOTS+4)
|
||||
GO4K_FST AMOUNT(65),DEST(7*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(68),PHASE(64),GATES(0),COLOR(96),SHAPE(112),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(60),PHASE(0),GATES(0),COLOR(96),SHAPE(112),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(0),COLOR(48),SHAPE(80),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_DST DRIVE(32), SNHFREQ(128)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(BANDSTOP)
|
||||
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(16),COUNT(1)
|
||||
GO4K_PAN PANNING(76)
|
||||
GO4K_OUT GAIN(48), AUXSEND(24)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument4)
|
||||
GO4K_ENV ATTAC(20),DECAY(57),SUSTAIN(29),RELEASE(81),GAIN(128)
|
||||
GO4K_ENV ATTAC(64),DECAY(128),SUSTAIN(128),RELEASE(128),GAIN(128)
|
||||
GO4K_FST AMOUNT(32),DEST(0*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
|
||||
GO4K_VCF FREQUENCY(88),RESONANCE(48),VCFTYPE(PEAK)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(0),DAMP(0),FREQUENCY(0),DEPTH(0),DELAY(17),COUNT(1)
|
||||
GO4K_PAN PANNING(72)
|
||||
GO4K_OUT GAIN(96), AUXSEND(48)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument5)
|
||||
GO4K_ENV ATTAC(20),DECAY(57),SUSTAIN(29),RELEASE(81),GAIN(128)
|
||||
GO4K_ENV ATTAC(64),DECAY(128),SUSTAIN(128),RELEASE(128),GAIN(128)
|
||||
GO4K_FST AMOUNT(32),DEST(0*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
|
||||
GO4K_VCF FREQUENCY(88),RESONANCE(48),VCFTYPE(PEAK)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(18),COUNT(1)
|
||||
GO4K_PAN PANNING(72)
|
||||
GO4K_OUT GAIN(48), AUXSEND(24)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument6)
|
||||
GO4K_ENV ATTAC(0),DECAY(128),SUSTAIN(128),RELEASE(64),GAIN(128)
|
||||
GO4K_ENV ATTAC(0),DECAY(92),SUSTAIN(0),RELEASE(64),GAIN(128)
|
||||
GO4K_FST AMOUNT(72),DEST(11*MAX_WORKSPACE_SLOTS+7)
|
||||
GO4K_FST AMOUNT(128),DEST(1*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(32),FLAGS(NOISE)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_FOP OP(FOP_PUSH)
|
||||
GO4K_VCF FREQUENCY(48),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(48),RESONANCE(128),VCFTYPE(BANDPASS)
|
||||
GO4K_VCO TRANSPOSE(71),DETUNE(128),PHASE(0),GATES(0),COLOR(40),SHAPE(80),GAIN(0),FLAGS(SINE)
|
||||
GO4K_VCF FREQUENCY(24),RESONANCE(64),VCFTYPE(HIGHPASS)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_PAN PANNING(52)
|
||||
GO4K_OUT GAIN(48), AUXSEND(2)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument7)
|
||||
GO4K_ENV ATTAC(0),DECAY(64),SUSTAIN(112),RELEASE(64),GAIN(128)
|
||||
GO4K_FST AMOUNT(128),DEST(0*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_ENV ATTAC(0),DECAY(70),SUSTAIN(0),RELEASE(0),GAIN(128)
|
||||
GO4K_DST DRIVE(32), SNHFREQ(128)
|
||||
GO4K_FST AMOUNT(80),DEST(6*MAX_WORKSPACE_SLOTS+1)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(45),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(66),GAIN(128),FLAGS(SINE)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_PAN PANNING(76)
|
||||
GO4K_OUT GAIN(64), AUXSEND(0)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument8)
|
||||
GO4K_ENV ATTAC(0),DECAY(128),SUSTAIN(40),RELEASE(64),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(48),GATES(85),COLOR(97),SHAPE(112),GAIN(128),FLAGS(PULSE)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(85),COLOR(8),SHAPE(120),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(28),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(90),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FST AMOUNT(72),DEST(1*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FST AMOUNT(56),DEST(2*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(16),RESONANCE(64),VCFTYPE(PEAK)
|
||||
GO4K_VCF FREQUENCY(48),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_FOP OP(FOP_PUSH)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_PAN PANNING(40)
|
||||
GO4K_OUT GAIN(48), AUXSEND(16)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument9)
|
||||
GO4K_ENV ATTAC(64),DECAY(96),SUSTAIN(96),RELEASE(88),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(16),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FST AMOUNT(73),DEST(14*MAX_WORKSPACE_SLOTS+4)
|
||||
GO4K_FST AMOUNT(65),DEST(7*MAX_WORKSPACE_SLOTS+2)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(68),PHASE(64),GATES(0),COLOR(96),SHAPE(112),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(60),PHASE(0),GATES(0),COLOR(96),SHAPE(112),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(76),DETUNE(64),PHASE(0),GATES(0),COLOR(48),SHAPE(80),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(SINE)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_DST DRIVE(32), SNHFREQ(128)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(BANDSTOP)
|
||||
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(16),COUNT(1)
|
||||
GO4K_PAN PANNING(64)
|
||||
GO4K_OUT GAIN(64), AUXSEND(48)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument10)
|
||||
GO4K_ENV ATTAC(96),DECAY(128),SUSTAIN(128),RELEASE(100),GAIN(128)
|
||||
GO4K_FST AMOUNT(80),DEST(5*MAX_WORKSPACE_SLOTS+4)
|
||||
GO4K_FST AMOUNT(96),DEST(7*MAX_WORKSPACE_SLOTS+4)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(64),FLAGS(NOISE)
|
||||
GO4K_FOP OP(FOP_PUSH)
|
||||
GO4K_VCF FREQUENCY(64),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_VCF FREQUENCY(22),RESONANCE(64),VCFTYPE(BANDPASS)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
|
||||
GO4K_FOP OP(FOP_PUSH)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_VCF FREQUENCY(16),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_FST AMOUNT(128),DEST(14*MAX_WORKSPACE_SLOTS+1)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(112),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(112),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FOP OP(FOP_PUSH)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_VCF FREQUENCY(48),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_PAN PANNING(64)
|
||||
GO4K_OUT GAIN(128), AUXSEND(128)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Global)
|
||||
GO4K_ACC ACCTYPE(AUX)
|
||||
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(120),DAMP(88),FREQUENCY(0),DEPTH(64),DELAY(0),COUNT(8)
|
||||
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(BANDSTOP)
|
||||
GO4K_FOP OP(FOP_XCH)
|
||||
GO4K_DLL PREGAIN(64),DRY(128),FEEDBACK(120),DAMP(88),FREQUENCY(0),DEPTH(64),DELAY(8),COUNT(8)
|
||||
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(BANDSTOP)
|
||||
GO4K_ACC ACCTYPE(OUTPUT)
|
||||
GO4K_VCF FREQUENCY(4),RESONANCE(128),VCFTYPE(HIGHPASS)
|
||||
GO4K_FOP OP(FOP_XCH)
|
||||
GO4K_VCF FREQUENCY(4),RESONANCE(128),VCFTYPE(HIGHPASS)
|
||||
GO4K_FOP OP(FOP_ADDP2)
|
||||
GO4K_OUT GAIN(20), AUXSEND(0)
|
||||
GO4K_END_PARAMDEF
|
||||
go4k_synth_parameter_values_end
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc5 data align=1
|
||||
%else
|
||||
section .data
|
||||
%endif
|
||||
%ifdef GO4K_USE_DLL
|
||||
global _go4k_delay_times
|
||||
_go4k_delay_times
|
||||
dw 1116
|
||||
dw 1188
|
||||
dw 1276
|
||||
dw 1356
|
||||
dw 1422
|
||||
dw 1492
|
||||
dw 1556
|
||||
dw 1618
|
||||
dw 1140
|
||||
dw 1212
|
||||
dw 1300
|
||||
dw 1380
|
||||
dw 1446
|
||||
dw 1516
|
||||
dw 1580
|
||||
dw 1642
|
||||
dw 15383
|
||||
dw 11537
|
||||
dw 23075
|
||||
%endif
|
||||
BIN
bp10-4k/src/4klang.obj
Normal file
BIN
bp10-4k/src/4klang.obj
Normal file
Binary file not shown.
1
bp10-4k/src/Debug/4k.exe.embed.manifest
Normal file
1
bp10-4k/src/Debug/4k.exe.embed.manifest
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"></assembly>
|
||||
BIN
bp10-4k/src/Debug/BuildLog.htm
Normal file
BIN
bp10-4k/src/Debug/BuildLog.htm
Normal file
Binary file not shown.
BIN
bp10-4k/src/Debug/vc90.idb
Normal file
BIN
bp10-4k/src/Debug/vc90.idb
Normal file
Binary file not shown.
BIN
bp10-4k/src/Debug/vc90.pdb
Normal file
BIN
bp10-4k/src/Debug/vc90.pdb
Normal file
Binary file not shown.
78
bp10-4k/src/Exporter.cpp
Normal file
78
bp10-4k/src/Exporter.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "stdafx.h"
|
||||
#include "Exporter.h"
|
||||
#include "Variables.h"
|
||||
|
||||
void Exporter::Export(SemAnalyzer& semAnalyzer)
|
||||
{
|
||||
ZeroMemory(jumpPositions, 128 * sizeof(unsigned int));
|
||||
ZeroMemory(demoData, 8192 * sizeof(unsigned char));
|
||||
ZeroMemory(opcodes, 128 * sizeof(opcode));
|
||||
ZeroMemory(opcodeArgCount, 128 * sizeof(unsigned char));
|
||||
for (int i = 0; i < 255; ++i)
|
||||
{
|
||||
texts[i] = CString();
|
||||
}
|
||||
//auch: opcodeDictionary
|
||||
|
||||
std::map<int, CString> labelPositions;
|
||||
int position = 0;
|
||||
for (std::vector<VmCall>::iterator iter = semAnalyzer.vmCalls.begin(); iter != semAnalyzer.vmCalls.end(); ++iter)
|
||||
{
|
||||
VmCall call = *iter;
|
||||
if (call.type == VmCall::Label)
|
||||
{
|
||||
labelPositions[position] = call.name;
|
||||
}
|
||||
else if (call.type == VmCall::FunctionCall)
|
||||
{
|
||||
position += 1 + call.arguments.size();
|
||||
}
|
||||
}
|
||||
|
||||
position = 0;
|
||||
std::map<CString, int> labelOrder;
|
||||
for (std::map<int, CString>::iterator iter = labelPositions.begin(); iter != labelPositions.end(); ++iter)
|
||||
{
|
||||
jumpPositions[position] = iter->first;
|
||||
labelOrder[iter->second] = position++;
|
||||
}
|
||||
|
||||
for (std::map<CString, int>::iterator iter = semAnalyzer.usedFunctions.begin(); iter != semAnalyzer.usedFunctions.end(); ++iter)
|
||||
{
|
||||
opcodes[iter->second] = opcodeDictionary[iter->first].first;
|
||||
opcodeArgCount[iter->second] = opcodeDictionary[iter->first].second;
|
||||
}
|
||||
|
||||
position = 0;
|
||||
for (std::vector<VmCall>::iterator iter = semAnalyzer.vmCalls.begin(); iter != semAnalyzer.vmCalls.end(); ++iter)
|
||||
{
|
||||
VmCall call = *iter;
|
||||
if (call.type == VmCall::FunctionCall)
|
||||
{
|
||||
demoData[position++] = semAnalyzer.usedFunctions[call.name];
|
||||
for (std::vector<int>::iterator iter2 = call.arguments.begin(); iter2 != call.arguments.end(); ++iter2)
|
||||
{
|
||||
int arg = *iter2;
|
||||
if (arg == -1)
|
||||
{
|
||||
demoData[position++] = labelOrder[call.labelReference];
|
||||
}
|
||||
else
|
||||
{
|
||||
demoData[position++] = *iter2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
demoDataCount = position;
|
||||
|
||||
position = 0;
|
||||
for (std::vector<CString>::iterator iter = semAnalyzer.texts.begin(); iter != semAnalyzer.texts.end(); ++iter)
|
||||
{
|
||||
texts[position++] = (LPCTSTR)*iter;
|
||||
}
|
||||
textAmount = position;
|
||||
|
||||
jumpPositionsCount = labelOrder.size();
|
||||
opcodeCount = semAnalyzer.usedFunctions.size();
|
||||
}
|
||||
13
bp10-4k/src/Exporter.h
Normal file
13
bp10-4k/src/Exporter.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "SemAnalyzer.h"
|
||||
|
||||
|
||||
class Exporter
|
||||
{
|
||||
public:
|
||||
Exporter() {};
|
||||
virtual ~Exporter() {};
|
||||
|
||||
void Export(SemAnalyzer& semAnalyzer);
|
||||
};
|
||||
196
bp10-4k/src/LanguageSpecifier.cpp
Normal file
196
bp10-4k/src/LanguageSpecifier.cpp
Normal file
@@ -0,0 +1,196 @@
|
||||
#include "stdafx.h"
|
||||
#include "LanguageSpecifier.h"
|
||||
#include "Variables.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
LanguageSpecifier::LanguageSpecifier()
|
||||
: lineNumber(1)
|
||||
{
|
||||
identifiers.push_back(_T("reg"));
|
||||
|
||||
/*functions[_T("Add")] = 2;
|
||||
functions[_T("Call")] = 1;
|
||||
functions[_T("CallEqualsGreater")] = 3;
|
||||
functions[_T("CameraPosition")] = 3;
|
||||
functions[_T("Color")] = 3;
|
||||
functions[_T("Cos")] = 1;
|
||||
functions[_T("Div")] = 2;
|
||||
functions[_T("DrawMesh")] = 1;
|
||||
functions[_T("DrawText")] = 1;
|
||||
functions[_T("Goto")] = 1;
|
||||
functions[_T("GotoEqualsGreater")] = 3;
|
||||
functions[_T("Max")] = 2;
|
||||
functions[_T("Min")] = 2;
|
||||
functions[_T("Mod")] = 2;
|
||||
functions[_T("Mul")] = 2;
|
||||
functions[_T("PopMatrix")] = 0;
|
||||
functions[_T("PushMatrix")] = 0;
|
||||
functions[_T("Rand")] = 1;
|
||||
functions[_T("Rotate")] = 3;
|
||||
functions[_T("SwapBuffers")] = 0;
|
||||
functions[_T("Scale")] = 3;
|
||||
functions[_T("Seed")] = 1;
|
||||
functions[_T("Set")] = 2;
|
||||
functions[_T("Sin")] = 1;
|
||||
functions[_T("Sub")] = 2;
|
||||
functions[_T("Terminate")] = 0;
|
||||
functions[_T("Translate")] = 3;*/
|
||||
|
||||
symbols.push_back(_T(";"));
|
||||
symbols.push_back(_T("("));
|
||||
symbols.push_back(_T(")"));
|
||||
symbols.push_back(_T(","));
|
||||
symbols.push_back(_T(":"));
|
||||
symbols.push_back(_T("\""));
|
||||
|
||||
aliase[_T("sphere")] = _T("0");
|
||||
aliase[_T("box")] = _T("1");
|
||||
aliase[_T("cube")] = _T("1");
|
||||
aliase[_T("cylinder")] = _T("2");
|
||||
aliase[_T("torus1")] = _T("3");
|
||||
aliase[_T("torus2")] = _T("4");
|
||||
aliase[_T("teapot")] = _T("5");
|
||||
|
||||
aliase[_T("time")] = _T("254");
|
||||
aliase[_T("pi")] = _T("253");
|
||||
|
||||
aliase[_T("x")] = _T("0");
|
||||
aliase[_T("y")] = _T("1");
|
||||
aliase[_T("z")] = _T("2");
|
||||
}
|
||||
|
||||
|
||||
Keyword LanguageSpecifier::Classify(const CString& keyword, char* chars)
|
||||
{
|
||||
Keyword::Type type = Keyword::Unknown;
|
||||
if (!keyword.IsEmpty())
|
||||
{
|
||||
if (find(identifiers.begin(), identifiers.end(), keyword) != identifiers.end())
|
||||
{
|
||||
type = Keyword::Identifier;
|
||||
}
|
||||
else if (opcodeDictionary.find(keyword) != opcodeDictionary.end())
|
||||
{
|
||||
type = Keyword::FunctionCall;
|
||||
}
|
||||
else if (find(symbols.begin(), symbols.end(), keyword) != symbols.end())
|
||||
{
|
||||
type = Keyword::Symbol;
|
||||
}
|
||||
else if (*chars == ':')
|
||||
{
|
||||
type = Keyword::Label;
|
||||
if (find(knownLabels.begin(), knownLabels.end(), keyword) == knownLabels.end())
|
||||
knownLabels.push_back(keyword);
|
||||
}
|
||||
else if (keyword[0] >= '0' && keyword[0] <= '9')
|
||||
{
|
||||
type = Keyword::Number;
|
||||
}
|
||||
}
|
||||
return Keyword(type, keyword, lineNumber);
|
||||
}
|
||||
|
||||
|
||||
Keyword LanguageSpecifier::GetNextKeyword(char** charss)
|
||||
{
|
||||
CString keywordString;
|
||||
Keyword keyword(Keyword::Unknown, keywordString, lineNumber);
|
||||
|
||||
char* chars = *charss;
|
||||
while (*chars != 0)
|
||||
{
|
||||
if (chars[0] == '/' && chars[1] == '/')
|
||||
{
|
||||
while (*chars != '\n' && *chars != 0)
|
||||
{
|
||||
if (*chars == '\n')
|
||||
++lineNumber;
|
||||
|
||||
++chars;
|
||||
}
|
||||
|
||||
keywordString = CString();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (chars[0] == '"')
|
||||
{
|
||||
++chars;
|
||||
keywordString = CString();
|
||||
while (*chars != '"')
|
||||
{
|
||||
keywordString += *chars++;
|
||||
}
|
||||
++chars;
|
||||
|
||||
keyword = Keyword(Keyword::Text, keywordString, lineNumber);
|
||||
break;
|
||||
}
|
||||
|
||||
if (keywordString.IsEmpty() && (*chars == '\t' || *chars == '\n' || *chars == ' ' || *chars == 0))
|
||||
{
|
||||
if (*chars == '\n')
|
||||
++lineNumber;
|
||||
|
||||
++chars;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (keywordString.IsEmpty() && (*chars >= '0' && *chars <= '9'))
|
||||
{
|
||||
char* ptr = chars;
|
||||
while (*ptr >= '0' && *ptr <= '9')
|
||||
{
|
||||
++ptr;
|
||||
}
|
||||
char* tmp = new char[ptr - chars + 1];
|
||||
tmp[ptr - chars] = 0;
|
||||
memcpy_s(tmp, ptr - chars, chars, ptr - chars);
|
||||
chars = ptr;
|
||||
|
||||
int number = atoi(tmp);
|
||||
if (number >= 255)
|
||||
{
|
||||
CString msg = fileName;
|
||||
msg.AppendFormat(_T("(%d): Syntax error: '%d' is out of range. Valid values are between 0 and 254."), lineNumber, number);
|
||||
VMERROR(msg);
|
||||
}
|
||||
|
||||
keyword = Keyword(Keyword::Number, CString(tmp), lineNumber);
|
||||
delete [] tmp;
|
||||
break;
|
||||
}
|
||||
|
||||
keywordString += *chars++;
|
||||
|
||||
if (find(symbols.begin(), symbols.end(), keywordString) != symbols.end())
|
||||
{
|
||||
keyword = Classify(keywordString, chars);
|
||||
break;
|
||||
}
|
||||
|
||||
if ((find(symbols.begin(), symbols.end(), CString(*chars)) != symbols.end()) || (*chars == '\t' || *chars == '\n' || *chars == '\r' || *chars == ' ' || *chars == 0))
|
||||
{
|
||||
if (*chars == '\n')
|
||||
++lineNumber;
|
||||
|
||||
keyword = Classify(keywordString, chars);
|
||||
if (keyword.type == Keyword::Label)
|
||||
*chars++;
|
||||
|
||||
if (aliase.find(keywordString) != aliase.end())
|
||||
{
|
||||
keyword = Classify(aliase[keywordString], chars);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*charss = chars;
|
||||
return keyword;
|
||||
}
|
||||
46
bp10-4k/src/LanguageSpecifier.h
Normal file
46
bp10-4k/src/LanguageSpecifier.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
struct Keyword
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
Unknown,
|
||||
Identifier,
|
||||
FunctionCall,
|
||||
Label,
|
||||
LabelReference,
|
||||
Text,
|
||||
Number,
|
||||
Symbol
|
||||
};
|
||||
|
||||
Keyword(Type _type, const CString& _name, int _lineNumber)
|
||||
: type(_type)
|
||||
, name(_name)
|
||||
, lineNumber(_lineNumber)
|
||||
{
|
||||
}
|
||||
|
||||
Type type;
|
||||
CString name;
|
||||
int lineNumber;
|
||||
};
|
||||
|
||||
class LanguageSpecifier
|
||||
{
|
||||
std::vector<CString> identifiers;
|
||||
std::vector<CString> symbols;
|
||||
std::map<CString, CString> aliase;
|
||||
int lineNumber;
|
||||
|
||||
public:
|
||||
std::vector<CString> knownLabels;
|
||||
CString fileName;
|
||||
|
||||
LanguageSpecifier();
|
||||
virtual ~LanguageSpecifier() {}
|
||||
|
||||
Keyword Classify(const CString& keyword, char* chars);
|
||||
Keyword GetNextKeyword(char** charss);
|
||||
};
|
||||
90
bp10-4k/src/LexAnalyzer.cpp
Normal file
90
bp10-4k/src/LexAnalyzer.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "stdafx.h"
|
||||
#include "LexAnalyzer.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
char* TextFileRead(const CString& fileName)
|
||||
{
|
||||
FILE* file;
|
||||
char* content = NULL;
|
||||
size_t count = 0;
|
||||
|
||||
if (fileName.IsEmpty())
|
||||
{
|
||||
VMERROR(_T("Error: No file to parse!"));
|
||||
}
|
||||
|
||||
_tfopen_s(&file, fileName, _T("rt"));
|
||||
if (file == NULL)
|
||||
{
|
||||
CString msg = _T("Error: Can't open ");
|
||||
msg += fileName;
|
||||
VMERROR(msg);
|
||||
}
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
count = ftell(file);
|
||||
rewind(file);
|
||||
|
||||
if (count <= 0)
|
||||
{
|
||||
CString msg = _T("Error: File ");
|
||||
msg += fileName;
|
||||
msg += _T(" was empty or returned negative file size!");
|
||||
VMERROR(msg);
|
||||
}
|
||||
|
||||
content = new char[count + 2];
|
||||
content[0] = (char)0xBF;
|
||||
content += 1;
|
||||
count = fread_s(content, count + 1, sizeof(char), count, file);
|
||||
content[count] = 0;
|
||||
|
||||
fclose(file);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
void LexAnalyzer::Parse(const CString& fileName)
|
||||
{
|
||||
language.fileName = fileName;
|
||||
char* code = TextFileRead(fileName);
|
||||
Parse(code);
|
||||
}
|
||||
|
||||
|
||||
void LexAnalyzer::Parse(char* code)
|
||||
{
|
||||
Keyword keyword(Keyword::Unknown, CString(), -1);
|
||||
do
|
||||
{
|
||||
keyword = language.GetNextKeyword(&code);
|
||||
if (!keyword.name.IsEmpty())
|
||||
keywords.push_back(keyword);
|
||||
} while (!keyword.name.IsEmpty());
|
||||
|
||||
for (std::vector<Keyword>::iterator iter = keywords.begin(); iter != keywords.end(); ++iter)
|
||||
{
|
||||
Keyword& keyword = *iter;
|
||||
if (keyword.type == Keyword::Unknown)
|
||||
{
|
||||
if (find(language.knownLabels.begin(), language.knownLabels.end(), keyword.name) != language.knownLabels.end())
|
||||
{
|
||||
Keyword& nextKeyword = *(iter + 1);
|
||||
if (nextKeyword.name == _T(":"))
|
||||
keyword.type = Keyword::Label;
|
||||
else
|
||||
keyword.type = Keyword::LabelReference;
|
||||
}
|
||||
else
|
||||
{
|
||||
CString msg;
|
||||
msg.AppendFormat(_T("(%d): Syntax error: "), keyword.lineNumber);
|
||||
msg += keyword.name;
|
||||
VMERROR(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
bp10-4k/src/LexAnalyzer.h
Normal file
24
bp10-4k/src/LexAnalyzer.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include "LanguageSpecifier.h"
|
||||
|
||||
class LexAnalyzer
|
||||
{
|
||||
public:
|
||||
LanguageSpecifier language;
|
||||
std::vector<Keyword> keywords;
|
||||
|
||||
LexAnalyzer()
|
||||
{
|
||||
}
|
||||
|
||||
LexAnalyzer(const CString& as_FileName)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~LexAnalyzer()
|
||||
{
|
||||
}
|
||||
|
||||
void Parse(const CString& file);
|
||||
void Parse(char* code);
|
||||
};
|
||||
223
bp10-4k/src/Opcodes.h
Normal file
223
bp10-4k/src/Opcodes.h
Normal file
@@ -0,0 +1,223 @@
|
||||
#pragma once
|
||||
|
||||
void UpdateMatrices();
|
||||
|
||||
#ifndef TARGET_4K
|
||||
class AutoRegisterOpcode
|
||||
{
|
||||
public:
|
||||
AutoRegisterOpcode(const CString& _name, opcode _opcode, int argCount)
|
||||
{
|
||||
opcodeDictionary[_name] = std::make_pair(_opcode, argCount);
|
||||
}
|
||||
};
|
||||
#define OPCODE(name, argCount) void op##name(float* args, int arg0); AutoRegisterOpcode __autoreg_op##name(_T(#name), op##name, argCount); inline void op##name(float* args, int arg0)
|
||||
#else
|
||||
#define OPCODE(name, argCount) inline void op##name(float* args, int arg0)
|
||||
#endif
|
||||
|
||||
#pragma code_seg(".scale")
|
||||
void Scale(float af_Min, float af_Max, float* a)
|
||||
{
|
||||
int i = 8;
|
||||
while(i--)
|
||||
{
|
||||
a[i] = a[i] * (af_Max - af_Min) / 254.0f + af_Min;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma code_seg(".opAdd")
|
||||
OPCODE(Add, 2)
|
||||
{
|
||||
reg[arg0] += args[1];
|
||||
};
|
||||
|
||||
#pragma code_seg(".opAbs")
|
||||
OPCODE(Abs, 1)
|
||||
{
|
||||
reg[arg0] = x_Abs(reg[arg0]);
|
||||
};
|
||||
|
||||
#pragma code_seg(".opCall")
|
||||
OPCODE(Call, 1)
|
||||
{
|
||||
callStack[callStackSize++] = demoIndex;
|
||||
demoIndex = jumpPositions[arg0];
|
||||
}
|
||||
|
||||
#pragma code_seg(".opCallEqualsGreater")
|
||||
OPCODE(CallEqualsGreater, 3)
|
||||
{
|
||||
if (reg[arg0] < args[1])
|
||||
return;
|
||||
|
||||
callStack[callStackSize++] = demoIndex;
|
||||
demoIndex = jumpPositions[x_Ftol(args[2])];
|
||||
}
|
||||
|
||||
#pragma code_seg(".opCameraPosition")
|
||||
OPCODE(CameraPosition, 3)
|
||||
{
|
||||
Scale(-10.0f, 10.0f, args);
|
||||
viewPosition = D3DXVECTOR3(args[0], args[1], args[2]);
|
||||
};
|
||||
|
||||
#pragma code_seg(".opColor")
|
||||
OPCODE(Color, 4)
|
||||
{
|
||||
Scale(0.0f, 1.0f, args);
|
||||
d3dDevice->SetPixelShaderConstantF(0, args, 1);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opCos")
|
||||
OPCODE(Cos, 1)
|
||||
{
|
||||
reg[arg0] = x_Cos(reg[arg0]);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opDiv")
|
||||
OPCODE(Div, 2)
|
||||
{
|
||||
reg[arg0] = reg[arg0] / args[1];
|
||||
}
|
||||
|
||||
#pragma code_seg(".opDrawMesh")
|
||||
OPCODE(DrawMesh, 1)
|
||||
{
|
||||
UpdateMatrices();
|
||||
meshes[arg0]->DrawSubset(0);
|
||||
};
|
||||
|
||||
#pragma code_seg(".opDrawMesh")
|
||||
OPCODE(DrawText, 1)
|
||||
{
|
||||
UpdateMatrices();
|
||||
textMeshes[arg0]->DrawSubset(0);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opGoto")
|
||||
OPCODE(Goto, 1)
|
||||
{
|
||||
demoIndex = jumpPositions[arg0];
|
||||
}
|
||||
|
||||
#pragma code_seg(".opGotoEqualsGreater")
|
||||
OPCODE(GotoEqualsGreater, 3)
|
||||
{
|
||||
if (reg[arg0] < args[1])
|
||||
return;
|
||||
|
||||
demoIndex = jumpPositions[x_Ftol(args[2])];
|
||||
}
|
||||
|
||||
#pragma code_seg(".opMax")
|
||||
OPCODE(Max, 2)
|
||||
{
|
||||
reg[arg0] = x_Max(reg[arg0], args[1]);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opMin")
|
||||
OPCODE(Min, 2)
|
||||
{
|
||||
reg[arg0] = x_Min(reg[arg0], args[1]);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opMod")
|
||||
OPCODE(Mod, 2)
|
||||
{
|
||||
reg[arg0] = x_Fmod(reg[arg0], args[1]);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opMul")
|
||||
OPCODE(Mul, 2)
|
||||
{
|
||||
reg[arg0] = reg[arg0] * args[1];
|
||||
}
|
||||
|
||||
#pragma code_seg(".opPopMatrix")
|
||||
OPCODE(PopMatrix, 0)
|
||||
{
|
||||
matrixStack->Pop();
|
||||
}
|
||||
|
||||
#pragma code_seg(".opPushMatrix")
|
||||
OPCODE(PushMatrix, 0)
|
||||
{
|
||||
matrixStack->Push();
|
||||
}
|
||||
|
||||
#pragma code_seg(".opRand")
|
||||
OPCODE(Rand, 1)
|
||||
{
|
||||
reg[arg0] = x_Rand();
|
||||
}
|
||||
|
||||
#pragma code_seg(".opReturn")
|
||||
OPCODE(Return, 0)
|
||||
{
|
||||
demoIndex = callStack[--callStackSize];
|
||||
//callStack[callStackSize] = 0;
|
||||
}
|
||||
|
||||
#pragma code_seg(".opRotate")
|
||||
OPCODE(Rotate, 2)
|
||||
{
|
||||
Scale(0.0f, M_2PI, args);
|
||||
matrixStack->RotateAxisLocal(&rotationAxis[arg0], args[1]);
|
||||
};
|
||||
|
||||
#pragma code_seg(".opSwapBuffers")
|
||||
OPCODE(SwapBuffers, 0)
|
||||
{
|
||||
processingVm = false;
|
||||
}
|
||||
|
||||
#pragma code_seg(".opScale")
|
||||
OPCODE(Scale, 3)
|
||||
{
|
||||
Scale(-2.0f, 2.0f, args);
|
||||
matrixStack->ScaleLocal(args[0], args[1], args[2]);
|
||||
};
|
||||
|
||||
#pragma code_seg(".opSeed")
|
||||
OPCODE(Seed, 1)
|
||||
{
|
||||
x_Randomize(arg0);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opSet")
|
||||
OPCODE(Set, 2)
|
||||
{
|
||||
reg[arg0] = args[1];
|
||||
}
|
||||
|
||||
#pragma code_seg(".opSin")
|
||||
OPCODE(Sin, 1)
|
||||
{
|
||||
reg[arg0] = x_Sin(reg[arg0]);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opSign")
|
||||
OPCODE(Sign, 1)
|
||||
{
|
||||
reg[arg0] = x_Sign(reg[arg0]);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opSub")
|
||||
OPCODE(Sub, 2)
|
||||
{
|
||||
reg[arg0] = reg[arg0] - args[1];
|
||||
}
|
||||
|
||||
#pragma code_seg(".opTerminate")
|
||||
OPCODE(Terminate, 0)
|
||||
{
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
#pragma code_seg(".opTranslate")
|
||||
OPCODE(Translate, 3)
|
||||
{
|
||||
Scale(-10.0f, 10.0f, args);
|
||||
matrixStack->TranslateLocal(args[0], args[1], args[2]);
|
||||
}
|
||||
138
bp10-4k/src/Preview.cpp
Normal file
138
bp10-4k/src/Preview.cpp
Normal file
@@ -0,0 +1,138 @@
|
||||
// 4k.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
#include "stdafx.h"
|
||||
#include "math.h"
|
||||
#include "Variables.h"
|
||||
#include <io.h>
|
||||
|
||||
OpcodeDictionary opcodeDictionary;
|
||||
unsigned int jumpPositions[128];
|
||||
unsigned char demoData[8192];
|
||||
opcode opcodes[128];
|
||||
CStringA texts[255];
|
||||
unsigned char textAmount;
|
||||
unsigned char opcodeArgCount[128];
|
||||
unsigned int jumpPositionsCount;
|
||||
unsigned int demoDataCount;
|
||||
unsigned int opcodeCount;
|
||||
|
||||
#include "Opcodes.h"
|
||||
#include "vm.h"
|
||||
#include "shaders.h"
|
||||
#include "graphics.h"
|
||||
#include "Window.h"
|
||||
#include "VmCompiler.h"
|
||||
|
||||
HANDLE recompileEvent;
|
||||
|
||||
DWORD WINAPI filemon(void* args)
|
||||
{
|
||||
__time64_t lastChangedDate = 0;
|
||||
while (true)
|
||||
{
|
||||
_finddata_t fdata;
|
||||
long hfile = _findfirst("demo.txt", &fdata);
|
||||
if (hfile != -1)
|
||||
{
|
||||
if (fdata.time_write != lastChangedDate)
|
||||
{
|
||||
lastChangedDate = fdata.time_write;
|
||||
::SetEvent(recompileEvent);
|
||||
}
|
||||
_findclose(hfile);
|
||||
}
|
||||
::Sleep(100);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
recompileEvent = ::CreateEvent(NULL, FALSE, FALSE, TEXT("WriteEvent"));
|
||||
|
||||
Window wnd(_T("BluFlame VM: Preview"), width, height);
|
||||
wnd.Initialize();
|
||||
hWnd = wnd.get_Handle();
|
||||
d3dPresParams.Windowed = true;
|
||||
InitGraphics();
|
||||
|
||||
LARGE_INTEGER lli_TicksPerSecond, lli_OldTime;
|
||||
QueryPerformanceCounter(&lli_OldTime);
|
||||
bool done = false;
|
||||
double ld_ElapsedTime = 0;
|
||||
|
||||
SetThreadPriority((HANDLE)CreateThread(0, 0, &filemon, 0, 0, 0), THREAD_PRIORITY_BELOW_NORMAL);
|
||||
bool codeValid = false;
|
||||
while (!done)
|
||||
{
|
||||
MSG msg;
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
{
|
||||
done = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (::WaitForSingleObject(recompileEvent, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
try
|
||||
{
|
||||
demoIndex = 0;
|
||||
processingVm = false;
|
||||
callStackSize = 0;
|
||||
CompileVMCodeFromFile(_T("demo.txt"));
|
||||
InitTexts();
|
||||
codeValid = true;
|
||||
}
|
||||
catch (VmError)
|
||||
{
|
||||
d3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f), 1.0f, 0);
|
||||
::MessageBox(NULL, errorString, _T("BluFlame VM"), MB_OK);
|
||||
wnd.set_Title(_T("Invalid VM code, please fix!"));
|
||||
codeValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!codeValid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
LARGE_INTEGER lli_Time;
|
||||
QueryPerformanceCounter(&lli_Time);
|
||||
QueryPerformanceFrequency(&lli_TicksPerSecond);
|
||||
lli_Time.QuadPart -= lli_OldTime.QuadPart;
|
||||
double ld_Time = double(lli_Time.QuadPart) / (lli_TicksPerSecond.QuadPart);
|
||||
QueryPerformanceCounter(&lli_OldTime);
|
||||
|
||||
if (wnd.get_Active())
|
||||
{
|
||||
ld_ElapsedTime += ld_Time;
|
||||
try
|
||||
{
|
||||
reg[254] = ld_ElapsedTime;
|
||||
reg[253] = D3DX_PI;
|
||||
DrawFrame();
|
||||
}
|
||||
catch (VmError)
|
||||
{
|
||||
::MessageBox(NULL, errorString, _T("BluFlame VM"), MB_OK);
|
||||
wnd.set_Title(_T("Invalid VM code, please fix!"));
|
||||
codeValid = false;
|
||||
}
|
||||
|
||||
TCHAR ls_Title[255];
|
||||
_stprintf_s(ls_Title, 255, _T("FPS: %.2f"), float(1.0 / ld_Time));
|
||||
wnd.set_Title(ls_Title);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
307
bp10-4k/src/Preview.vcproj
Normal file
307
bp10-4k/src/Preview.vcproj
Normal file
@@ -0,0 +1,307 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="Preview"
|
||||
ProjectGUID="{DA076CF4-DCD0-4001-B47D-BDC9490D140A}"
|
||||
RootNamespace="My4k"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)\$(ProjectName)\$(PlatformName)"
|
||||
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"
|
||||
AdditionalDependencies="d3d9.lib d3dx9.lib winmm.lib"
|
||||
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)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)\$(ProjectName)\$(PlatformName)"
|
||||
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"
|
||||
AdditionalDependencies="d3d9.lib d3dx9.lib winmm.lib"
|
||||
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"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Preview.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Window.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Window.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="StdAfx"
|
||||
>
|
||||
<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>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\targetver.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="API"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\graphics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\math.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Opcodes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Variables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vm.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Data"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\demo.txt"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\shaders.hlsl"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Generated"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\shaders.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="shaders.h"
|
||||
CommandLine="$(TargetDir)ShaderCompiler.exe shaders.hlsl
"
|
||||
AdditionalDependencies="shaders.hlsl"
|
||||
Outputs="bla"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="shaders.h"
|
||||
CommandLine="$(TargetDir)ShaderCompiler.exe shaders.hlsl
"
|
||||
AdditionalDependencies="shaders.hlsl"
|
||||
Outputs="bla"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Compiler"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Exporter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LanguageSpecifier.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LexAnalyzer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SemAnalyzer.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
65
bp10-4k/src/Preview.vcproj.FIARA.Frank.user
Normal file
65
bp10-4k/src/Preview.vcproj.FIARA.Frank.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="SHAIKUR"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="SHAIKUR"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
138
bp10-4k/src/Preview.vcxproj
Normal file
138
bp10-4k/src/Preview.vcxproj
Normal file
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DA076CF4-DCD0-4001-B47D-BDC9490D140A}</ProjectGuid>
|
||||
<RootNamespace>My4k</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)obj\$(Configuration)\$(ProjectName)\$(Platform)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)obj\$(Configuration)\$(ProjectName)\$(Platform)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>d3d9.lib;d3dx9.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>d3d9.lib;d3dx9.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Preview.cpp" />
|
||||
<ClCompile Include="Window.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Exporter.cpp" />
|
||||
<ClCompile Include="LanguageSpecifier.cpp" />
|
||||
<ClCompile Include="LexAnalyzer.cpp" />
|
||||
<ClCompile Include="SemAnalyzer.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Window.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="graphics.h" />
|
||||
<ClInclude Include="math.h" />
|
||||
<ClInclude Include="Opcodes.h" />
|
||||
<ClInclude Include="Variables.h" />
|
||||
<ClInclude Include="vm.h" />
|
||||
<CustomBuild Include="shaders.h">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">shaders.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(TargetDir)ShaderCompiler.exe shaders.hlsl
|
||||
</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">shaders.hlsl;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">bla;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shaders.h</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TargetDir)ShaderCompiler.exe shaders.hlsl
|
||||
</Command>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">shaders.hlsl;%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">bla;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="demo.txt" />
|
||||
<None Include="shaders.hlsl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="ShaderCompiler.vcxproj">
|
||||
<Project>{af4a824a-dae6-4e28-8982-17d68a79aed1}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="VmCompiler.vcxproj">
|
||||
<Project>{ac061108-4616-4a59-a9e8-c1e7cbd21780}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
85
bp10-4k/src/Preview.vcxproj.filters
Normal file
85
bp10-4k/src/Preview.vcxproj.filters
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{3c96b2b9-5ced-4fb1-95ad-4d04acdbdf0c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="StdAfx">
|
||||
<UniqueIdentifier>{6aa362ff-aec5-49a0-ba0a-6ce40d2a2f8d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="API">
|
||||
<UniqueIdentifier>{9b0d67a6-fef4-403c-9cd4-a68583c5e9bf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Data">
|
||||
<UniqueIdentifier>{6f2cad1f-b58e-48e1-a068-ba2f0c9fbc40}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Data\Generated">
|
||||
<UniqueIdentifier>{be8ddce8-9852-4f29-a4e7-f74701ef7d74}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Compiler">
|
||||
<UniqueIdentifier>{e0fabc3c-6dd5-4324-bdf3-1f352380e425}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Preview.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Window.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>StdAfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Exporter.cpp">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LanguageSpecifier.cpp">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LexAnalyzer.cpp">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SemAnalyzer.cpp">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Window.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>StdAfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>StdAfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="graphics.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="math.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Opcodes.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Variables.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vm.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="demo.txt">
|
||||
<Filter>Data</Filter>
|
||||
</None>
|
||||
<None Include="shaders.hlsl">
|
||||
<Filter>Data</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="shaders.h">
|
||||
<Filter>Data\Generated</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
bp10-4k/src/Preview.vcxproj.user
Normal file
3
bp10-4k/src/Preview.vcxproj.user
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
133
bp10-4k/src/SemAnalyzer.cpp
Normal file
133
bp10-4k/src/SemAnalyzer.cpp
Normal file
@@ -0,0 +1,133 @@
|
||||
#include "stdafx.h"
|
||||
#include "SemAnalyzer.h"
|
||||
#include "Variables.h"
|
||||
|
||||
|
||||
SemAnalyzer::SemAnalyzer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SemAnalyzer::~SemAnalyzer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int SemAnalyzer::ParseFunction(const CString& fileName, std::vector<Keyword>::iterator& iter, std::vector<int>& args, CString& labelReference)
|
||||
{
|
||||
int argCount = 0;
|
||||
Keyword keyword = *iter++;
|
||||
Keyword nextKeyword = keyword;
|
||||
if (keyword.name != _T("("))
|
||||
{
|
||||
CString msg = fileName;
|
||||
msg.AppendFormat(_T("(%d): Semantic error: expected '('"), keyword.lineNumber);
|
||||
VMERROR(msg);
|
||||
}
|
||||
do
|
||||
{
|
||||
keyword = *iter++;
|
||||
if (keyword.type == Keyword::Text)
|
||||
{
|
||||
if (find(texts.begin(), texts.end(), keyword.name) == texts.end())
|
||||
{
|
||||
texts.push_back(keyword.name);
|
||||
}
|
||||
int i = 0;
|
||||
for (std::vector<CString>::iterator iter = texts.begin(); iter != texts.end(); ++iter, ++i)
|
||||
{
|
||||
if (*iter == keyword.name)
|
||||
{
|
||||
args.push_back(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (keyword.type == Keyword::Identifier && keyword.name == _T("reg"))
|
||||
{
|
||||
args.push_back(255);
|
||||
keyword = *iter++;
|
||||
}
|
||||
if (keyword.name == _T(")"))
|
||||
break;
|
||||
|
||||
if (keyword.type != Keyword::Number && keyword.type != Keyword::LabelReference)
|
||||
{
|
||||
CString msg = fileName;
|
||||
msg.AppendFormat(_T("(%d): Semantic error: expected numeric argument"), keyword.lineNumber);
|
||||
VMERROR(msg);
|
||||
}
|
||||
nextKeyword = *iter++;
|
||||
if (nextKeyword.name != _T(",") && nextKeyword.name != _T(")"))
|
||||
{
|
||||
CString msg = fileName;
|
||||
msg.AppendFormat(_T("(%d): Semantic error: expected ',' or ')'"), keyword.lineNumber);
|
||||
VMERROR(msg);
|
||||
}
|
||||
|
||||
if (keyword.type == Keyword::Number)
|
||||
args.push_back(atoi((LPCSTR)CStringA(keyword.name)));
|
||||
else
|
||||
{
|
||||
labelReference = keyword.name;
|
||||
args.push_back(-1);
|
||||
}
|
||||
}
|
||||
++argCount;
|
||||
} while (nextKeyword.name != ")");
|
||||
|
||||
keyword = *iter++;
|
||||
if (keyword.name != _T(";"))
|
||||
{
|
||||
CString msg = fileName;
|
||||
msg.AppendFormat(_T("(%d): Semantic error: expected ';'"), keyword.lineNumber);
|
||||
VMERROR(msg);
|
||||
}
|
||||
|
||||
return argCount;
|
||||
}
|
||||
|
||||
|
||||
void SemAnalyzer::Parse(const CString& fileName, std::vector<Keyword> keywords)
|
||||
{
|
||||
std::vector<Keyword>::iterator iter = keywords.begin();
|
||||
while (iter != keywords.end())
|
||||
{
|
||||
VmCall vmCall;
|
||||
Keyword keyword = *iter++;
|
||||
vmCall.name = keyword.name;
|
||||
if (keyword.type == Keyword::Label)
|
||||
{
|
||||
vmCall.type = VmCall::Label;
|
||||
}
|
||||
else if (keyword.type == Keyword::FunctionCall)
|
||||
{
|
||||
vmCall.type = VmCall::FunctionCall;
|
||||
int args = ParseFunction(fileName, iter, vmCall.arguments, vmCall.labelReference);
|
||||
if (args != opcodeDictionary[vmCall.name].second)
|
||||
{
|
||||
CString msg = fileName;
|
||||
msg.AppendFormat(_T("(%d): Semantic error: Function '"), keyword.lineNumber);
|
||||
msg += vmCall.name;
|
||||
msg.AppendFormat(_T("' expects %d arguments, but only %d were provided."), opcodeDictionary[vmCall.name].second, args);
|
||||
VMERROR(msg);
|
||||
}
|
||||
if (usedFunctions.find(vmCall.name) == usedFunctions.end())
|
||||
{
|
||||
usedFunctions[vmCall.name] = usedFunctions.size();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CString msg = fileName;
|
||||
msg.AppendFormat(_T("(%d): Semantic error: Unexpected lexeme: "), keyword.lineNumber);
|
||||
msg += keyword.name;
|
||||
VMERROR(msg);
|
||||
}
|
||||
|
||||
vmCalls.push_back(vmCall);
|
||||
}
|
||||
}
|
||||
35
bp10-4k/src/SemAnalyzer.h
Normal file
35
bp10-4k/src/SemAnalyzer.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include "LexAnalyzer.h"
|
||||
|
||||
|
||||
struct VmCall
|
||||
{
|
||||
enum Type
|
||||
{
|
||||
FunctionCall,
|
||||
Label
|
||||
};
|
||||
|
||||
CString name;
|
||||
Type type;
|
||||
std::vector<int> arguments;
|
||||
CString labelReference;
|
||||
};
|
||||
|
||||
class SemAnalyzer
|
||||
{
|
||||
public:
|
||||
LanguageSpecifier language;
|
||||
std::vector<CString> texts;
|
||||
std::vector<VmCall> vmCalls;
|
||||
std::map<CString, int> usedFunctions;
|
||||
|
||||
SemAnalyzer();
|
||||
virtual ~SemAnalyzer();
|
||||
|
||||
void Parse(const CString& fileName, std::vector<Keyword> keywords);
|
||||
|
||||
private:
|
||||
int ParseFunction(const CString& fileName, std::vector<Keyword>::iterator& iter, std::vector<int>& args, CString& labelReference);
|
||||
};
|
||||
240
bp10-4k/src/ShaderCompiler.cpp
Normal file
240
bp10-4k/src/ShaderCompiler.cpp
Normal file
@@ -0,0 +1,240 @@
|
||||
#define COMPILER
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <memory.h>
|
||||
#include <tchar.h>
|
||||
#include <ios>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <sstream>
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
bool includeNewLines = false;
|
||||
|
||||
|
||||
|
||||
bool strcmp_s(char* s1, char* s2, int count)
|
||||
{
|
||||
while (count--)
|
||||
{
|
||||
if (*s1 != *s2)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* cmdLine, int showState)
|
||||
{
|
||||
try
|
||||
{
|
||||
FILE* file;
|
||||
char* content = NULL;
|
||||
size_t count = 0;
|
||||
CStringA msg;
|
||||
|
||||
fopen_s(&file, cmdLine, "rt");
|
||||
if (file == NULL)
|
||||
{
|
||||
msg = "Error: Can't open ";
|
||||
msg += cmdLine;
|
||||
throw (LPCSTR)msg;
|
||||
}
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
count = ftell(file);
|
||||
rewind(file);
|
||||
|
||||
if (count <= 0)
|
||||
{
|
||||
msg = "Error: File ";
|
||||
msg += cmdLine;
|
||||
msg += " was empty or returned negative file size!";
|
||||
fclose(file);
|
||||
throw (LPCSTR)msg;
|
||||
}
|
||||
|
||||
content = new char[count];
|
||||
ZeroMemory(content, count);
|
||||
fread(content, 1, count, file);
|
||||
fclose(file);
|
||||
|
||||
CStringA outFile = cmdLine;
|
||||
outFile = outFile.Left(outFile.GetLength() - 4) + "h";
|
||||
fopen_s(&file, outFile, "wt");
|
||||
|
||||
int outputCount = 0;
|
||||
msg = "#pragma once\n\n#pragma data_seg(\".shader\")\nstatic const char* shader = \""; fwrite(msg, 1, msg.GetLength(), file);
|
||||
bool comment = false;
|
||||
int shaderAmount = 0;
|
||||
static char* shaderProfiles[256];
|
||||
static char* shaderNames[256];
|
||||
for (unsigned int i = 0; i < count && content[i] != 0; ++i)
|
||||
{
|
||||
if (comment == true)
|
||||
{
|
||||
if (content[i] == '\n')
|
||||
{
|
||||
comment = false;
|
||||
if (!includeNewLines)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (content[i] == '\t' || content[i] == '\r')
|
||||
continue;
|
||||
|
||||
if (!includeNewLines && content[i] == '\n')
|
||||
continue;
|
||||
|
||||
if (content[i] == ' ' && content[i+1] == ' ')
|
||||
continue;
|
||||
|
||||
if (content[i] == '/' && content[i+1] == '/')
|
||||
{
|
||||
if (content[i+2] == '/')
|
||||
{
|
||||
int j = i+3;
|
||||
for (; true; ++j)
|
||||
{
|
||||
if (content[j] == '\n')
|
||||
break;
|
||||
}
|
||||
if (content[i+3] == '(' && content[j-1] == ')')
|
||||
{
|
||||
int k = i+4;
|
||||
shaderNames[shaderAmount] = content+k;
|
||||
for (; true; ++k)
|
||||
{
|
||||
if (content[k] == ',')
|
||||
break;
|
||||
}
|
||||
content[k] = '\0';
|
||||
shaderProfiles[shaderAmount] = content+k+1;
|
||||
content[j-1] = '\0';
|
||||
i = j;
|
||||
++shaderAmount;
|
||||
if (includeNewLines)
|
||||
{
|
||||
fwrite("\\n", 1, 2, file);
|
||||
++outputCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
comment = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (content[i] == '\n')
|
||||
fwrite("\\n", 1, 2, file);
|
||||
else
|
||||
fwrite(&content[i], 1, 1, file);
|
||||
++outputCount;
|
||||
}
|
||||
fwrite("\";\n\n", 1, 4, file);
|
||||
|
||||
msg.Format("#pragma bss_seg(\".shaderBss\")\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
for (int i = 0; i < shaderAmount; ++i)
|
||||
{
|
||||
if (shaderProfiles[i][0] == 'p')
|
||||
{
|
||||
msg.Format("static IDirect3DPixelShader9* "); fwrite(msg, 1, msg.GetLength(), file);
|
||||
}
|
||||
else if (shaderProfiles[i][0] == 'v')
|
||||
{
|
||||
msg.Format("static IDirect3DVertexShader9* "); fwrite(msg, 1, msg.GetLength(), file);
|
||||
}
|
||||
else if (shaderProfiles[i][0] == 't')
|
||||
{
|
||||
msg.Format("static ID3DXTextureShader* "); fwrite(msg, 1, msg.GetLength(), file);
|
||||
}
|
||||
|
||||
fwrite(shaderNames[i], 1, strlen(shaderNames[i]), file);
|
||||
fwrite(";\n", 1, 2, file);
|
||||
}
|
||||
fwrite("\n", 1, 1, file);
|
||||
|
||||
msg.Format("#pragma data_seg(\".shaderCreationFunctions\")\nstatic void* shaderCreationFunctions[] = {\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
for (int i = 0; i < shaderAmount; ++i)
|
||||
{
|
||||
if (shaderProfiles[i][0] == 'p')
|
||||
{
|
||||
msg.Format("\t(void*)0x1A8, //CreatePixelShader\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
}
|
||||
else if (shaderProfiles[i][0] == 'v')
|
||||
{
|
||||
msg.Format("\t(void*)0x16C, //CreateVertexShader\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
}
|
||||
else if (shaderProfiles[i][0] == 't')
|
||||
{
|
||||
msg.Format("\t(void*)D3DXCreateTextureShader,\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
}
|
||||
}
|
||||
fwrite("};\n\n", 1, 4, file);
|
||||
|
||||
msg.Format("#pragma data_seg(\".shaderCreationFunctionsDevice\")\nstatic bool shaderCreationFunctionsDevice[] = {\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
for (int i = 0; i < shaderAmount; ++i)
|
||||
{
|
||||
if (shaderProfiles[i][0] == 'p')
|
||||
{
|
||||
fwrite("\ttrue,\n", 1, 7, file);
|
||||
}
|
||||
else if (shaderProfiles[i][0] == 'v')
|
||||
{
|
||||
fwrite("\ttrue,\n", 1, 7, file);
|
||||
}
|
||||
else if (shaderProfiles[i][0] == 't')
|
||||
{
|
||||
fwrite("\tfalse,\n", 1, 7, file);
|
||||
}
|
||||
}
|
||||
fwrite("};\n\n", 1, 4, file);
|
||||
|
||||
msg.Format("#pragma data_seg(\".shaderLength\")\nstatic const int shaderLength = %d;\n\n", outputCount); fwrite(msg, 1, msg.GetLength(), file);
|
||||
msg.Format("#pragma data_seg(\".shaderAmount\")\nstatic const int shaderAmount = %d;\n\n", shaderAmount); fwrite(msg, 1, msg.GetLength(), file);
|
||||
msg.Format("#pragma data_seg(\".shaderEntryPoint\")\nstatic char shaderEntryPoint[] = {'a', 0};\n\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
msg.Format("#pragma data_seg(\".shaderProfiles\")\nstatic const char* shaderProfiles[] = {"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
for (int i = 0; i < shaderAmount; ++i)
|
||||
{
|
||||
fwrite("\"", 1, 1, file);
|
||||
fwrite(shaderProfiles[i], 1, strlen(shaderProfiles[i]), file);
|
||||
fwrite("\", ", 1, 3, file);
|
||||
}
|
||||
msg.Format("};\n\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
|
||||
msg.Format("#pragma data_seg(\".shaderTargets\")\nstatic const void* shaderTargets[] = {"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
for (int i = 0; i < shaderAmount; ++i)
|
||||
{
|
||||
fwrite("&", 1, 1, file);
|
||||
fwrite(shaderNames[i], 1, strlen(shaderNames[i]), file);
|
||||
fwrite(", ", 1, 2, file);
|
||||
}
|
||||
msg.Format("};\n\n"); fwrite(msg, 1, msg.GetLength(), file);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
catch (LPCSTR e)
|
||||
{
|
||||
std::cerr << e << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
186
bp10-4k/src/ShaderCompiler.vcproj
Normal file
186
bp10-4k/src/ShaderCompiler.vcproj
Normal file
@@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="ShaderCompiler"
|
||||
ProjectGUID="{AF4A824A-DAE6-4E28-8982-17D68A79AED1}"
|
||||
RootNamespace="Compiler"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)\$(ProjectName)\$(PlatformName)"
|
||||
ConfigurationType="1"
|
||||
UseOfATL="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
Outputs=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
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)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)\$(ProjectName)\$(PlatformName)"
|
||||
ConfigurationType="1"
|
||||
UseOfATL="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
Outputs=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="CompilerStdAfx.h"
|
||||
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
EntryPointSymbol=""
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
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>
|
||||
<File
|
||||
RelativePath=".\ShaderCompiler.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
65
bp10-4k/src/ShaderCompiler.vcproj.FIARA.Frank.user
Normal file
65
bp10-4k/src/ShaderCompiler.vcproj.FIARA.Frank.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="SHAIKUR"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="SHAIKUR"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
113
bp10-4k/src/ShaderCompiler.vcxproj
Normal file
113
bp10-4k/src/ShaderCompiler.vcxproj
Normal file
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{AF4A824A-DAE6-4E28-8982-17D68A79AED1}</ProjectGuid>
|
||||
<RootNamespace>Compiler</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfAtl>Static</UseOfAtl>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfAtl>Static</UseOfAtl>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)obj\$(Configuration)\$(ProjectName)\$(Platform)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)obj\$(Configuration)\$(ProjectName)\$(Platform)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<CustomBuildStep>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
<Outputs>%(Outputs)</Outputs>
|
||||
</CustomBuildStep>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<CustomBuildStep>
|
||||
<Message>
|
||||
</Message>
|
||||
<Command>
|
||||
</Command>
|
||||
<Outputs>%(Outputs)</Outputs>
|
||||
</CustomBuildStep>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>CompilerStdAfx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<EntryPointSymbol>
|
||||
</EntryPointSymbol>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ShaderCompiler.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
3
bp10-4k/src/ShaderCompiler.vcxproj.user
Normal file
3
bp10-4k/src/ShaderCompiler.vcxproj.user
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
78
bp10-4k/src/Variables.h
Normal file
78
bp10-4k/src/Variables.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
#pragma data_seg(".width")
|
||||
static const unsigned int width = 800;
|
||||
#pragma data_seg(".height")
|
||||
static const unsigned int height = 600;
|
||||
|
||||
typedef void (*opcode)(float*, int);
|
||||
extern unsigned int jumpPositions[128];
|
||||
extern unsigned char demoData[8192];
|
||||
extern opcode opcodes[128];
|
||||
extern unsigned char opcodeArgCount[128];
|
||||
extern unsigned char textAmount;
|
||||
#ifdef TARGET_4K
|
||||
extern char* texts[255];
|
||||
#else
|
||||
extern CStringA texts[255];
|
||||
#endif
|
||||
|
||||
#ifndef TARGET_4K
|
||||
typedef std::map<CString, std::pair<opcode, int>> OpcodeDictionary;
|
||||
extern unsigned int jumpPositionsCount;
|
||||
extern unsigned int demoDataCount;
|
||||
extern unsigned int opcodeCount;
|
||||
extern OpcodeDictionary opcodeDictionary;
|
||||
#endif
|
||||
|
||||
#pragma bss_seg(".compilerBss")
|
||||
static ID3DXMatrixStack* matrixStack;
|
||||
static float reg[256];
|
||||
static unsigned int callStack[256];
|
||||
static unsigned char callStackSize;
|
||||
static int demoIndex;
|
||||
static D3DXMATRIX viewMatrix, projectionMatrix, viewProjectionMatrix;
|
||||
static D3DXVECTOR3 viewPosition;
|
||||
static IDirect3DDevice9* d3dDevice;
|
||||
static ID3DXMesh* meshes[64];
|
||||
static ID3DXMesh* textMeshes[64];
|
||||
static IDirect3DTexture9* noiseTexture;
|
||||
static IDirect3DTexture9* renderTexture;
|
||||
static IDirect3DTexture9* blurRenderTexture;
|
||||
static IDirect3DSurface9* renderSurface;
|
||||
static IDirect3DSurface9* blurRenderSurface;
|
||||
static IDirect3DSurface9* bufferSurface;
|
||||
static bool processingVm;
|
||||
static float demoParams[8];
|
||||
static HWND hWnd;
|
||||
static HDC hDc;
|
||||
static ID3DXBuffer* shaderBuffer;
|
||||
static ID3DXBuffer* errorBuffer;
|
||||
|
||||
#pragma data_seg(".rotationAxis")
|
||||
const D3DXVECTOR3 rotationAxis[] =
|
||||
{
|
||||
D3DXVECTOR3(1.0, 0.0, 0.0),
|
||||
D3DXVECTOR3(0.0, 1.0, 0.0),
|
||||
D3DXVECTOR3(0.0, 0.0, 1.0),
|
||||
D3DXVECTOR3(0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
#pragma data_seg(".identityVectors")
|
||||
const D3DXVECTOR4 identityVectors[] =
|
||||
{
|
||||
D3DXVECTOR4( 1, 1, 1, 1),
|
||||
D3DXVECTOR4(-1,-1,-1,-1)
|
||||
};
|
||||
|
||||
#pragma data_seg(".M_PId4")
|
||||
#define M_PId4 tf16_PId4
|
||||
const float tf16_PId4 = D3DX_PI / 4.0f;
|
||||
|
||||
#pragma data_seg(".M_4d3")
|
||||
#define M_4d3 tf16_4d3
|
||||
const float tf16_4d3 = 4.0f / 3.0f;
|
||||
|
||||
#pragma data_seg(".M_2PI")
|
||||
#define M_2PI tf16_2PI
|
||||
const float tf16_2PI = 2.0f * D3DX_PI;
|
||||
107
bp10-4k/src/VmCompiler.cpp
Normal file
107
bp10-4k/src/VmCompiler.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
#include "stdafx.h"
|
||||
#include "VmCompiler.h"
|
||||
#include "Variables.h"
|
||||
#include "math.h"
|
||||
|
||||
OpcodeDictionary opcodeDictionary;
|
||||
unsigned int jumpPositions[128];
|
||||
unsigned char demoData[8192];
|
||||
opcode opcodes[128];
|
||||
CStringA texts[255];
|
||||
unsigned char textAmount;
|
||||
unsigned char opcodeArgCount[128];
|
||||
unsigned int jumpPositionsCount;
|
||||
unsigned int demoDataCount;
|
||||
unsigned int opcodeCount;
|
||||
|
||||
#include "Opcodes.h"
|
||||
|
||||
void UpdateMatrices() {};
|
||||
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
CompileVMCodeFromFile(argv[1]);
|
||||
|
||||
FILE* file;
|
||||
fopen_s(&file, CStringA(argv[2]), "w");
|
||||
if (file == NULL)
|
||||
{
|
||||
CString msg = _T("Error: Can't open ");
|
||||
msg += argv[2];
|
||||
msg += _T(" for writing!");
|
||||
VMERROR(msg);
|
||||
}
|
||||
|
||||
CString out;
|
||||
out.Format(L"#pragma once\n\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
|
||||
out.Format(L"#pragma data_seg(\".jumpPositions\")\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
out.Format(L"unsigned int jumpPositions[] =\n{\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
for (unsigned int i = 0; i < jumpPositionsCount; ++i)
|
||||
{
|
||||
out.Format(_T("\t%d,\n"), jumpPositions[i]); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
}
|
||||
out.Format(L"};\n\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
|
||||
out.Format(L"#pragma data_seg(\".opcodes\")\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
out.Format(L"opcode opcodes[] =\n{\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
for (unsigned int i = 0; i < opcodeCount; ++i)
|
||||
{
|
||||
for (OpcodeDictionary::iterator iter = opcodeDictionary.begin(); iter != opcodeDictionary.end(); ++iter)
|
||||
{
|
||||
if (iter->second.first == opcodes[i])
|
||||
{
|
||||
out = _T("\top");
|
||||
out += iter->first;
|
||||
out += _T(",\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
out.Format(L"};\n\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
|
||||
out.Format(L"#pragma data_seg(\".opcodeArgCount\")\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
out.Format(L"unsigned char opcodeArgCount[] =\n{\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
for (unsigned int i = 0; i < opcodeCount; ++i)
|
||||
{
|
||||
out.Format(_T("\t%d,\n"), opcodeArgCount[i]); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
}
|
||||
out.Format(L"};\n\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
|
||||
out.Format(L"#pragma data_seg(\".demoData\")\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
out.Format(L"unsigned char demoData[] =\n{\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
for (unsigned int i = 0; i < demoDataCount; ++i)
|
||||
{
|
||||
out.Format(_T("\t%d,"), demoData[i]); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
if (i % 20 == 0)
|
||||
fwrite("\n", 1, 1, file);
|
||||
}
|
||||
out.Format(L"};\n\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
|
||||
out.Format(L"#pragma data_seg(\".texts\")\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
out.Format(L"char* texts[] =\n{\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
unsigned int textAmount = 0;
|
||||
for (; textAmount < 255; ++textAmount)
|
||||
{
|
||||
if (texts[textAmount].IsEmpty())
|
||||
break;
|
||||
|
||||
out = _T("\t\"");
|
||||
out += CStringA(texts[textAmount]);
|
||||
out += _T("\",\n");
|
||||
fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
}
|
||||
out.Format(L"};\n\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
|
||||
out.Format(L"#pragma data_seg(\".textAmount\")\n"); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
out.Format(L"unsigned char textAmount = %d;\n", textAmount); fwrite((LPCSTR)CStringA(out), 1, out.GetLength(), file);
|
||||
}
|
||||
catch (VmError)
|
||||
{
|
||||
::MessageBox(NULL, errorString, _T("BluFlame VM"), MB_OK);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
29
bp10-4k/src/VmCompiler.h
Normal file
29
bp10-4k/src/VmCompiler.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "LexAnalyzer.h"
|
||||
#include "SemAnalyzer.h"
|
||||
#include "Exporter.h"
|
||||
|
||||
|
||||
void CompileVMCodeFromFile(const CString& fileName)
|
||||
{
|
||||
LexAnalyzer lexAnalyzer;
|
||||
SemAnalyzer semAnalyzer;
|
||||
Exporter exporter;
|
||||
|
||||
lexAnalyzer.Parse(fileName);
|
||||
semAnalyzer.Parse(fileName, lexAnalyzer.keywords);
|
||||
exporter.Export(semAnalyzer);
|
||||
}
|
||||
|
||||
|
||||
void CompileVMCodeFromMemory(char* code)
|
||||
{
|
||||
LexAnalyzer lexAnalyzer;
|
||||
SemAnalyzer semAnalyzer;
|
||||
Exporter exporter;
|
||||
|
||||
lexAnalyzer.Parse(code);
|
||||
semAnalyzer.Parse(_T("memory"), lexAnalyzer.keywords);
|
||||
exporter.Export(semAnalyzer);
|
||||
}
|
||||
271
bp10-4k/src/VmCompiler.vcproj
Normal file
271
bp10-4k/src/VmCompiler.vcproj
Normal file
@@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="VmCompiler"
|
||||
ProjectGUID="{AC061108-4616-4A59-A9E8-C1E7CBD21780}"
|
||||
RootNamespace="Compiler"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)\$(ProjectName)\$(PlatformName)"
|
||||
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)bin"
|
||||
IntermediateDirectory="$(SolutionDir)obj\$(ConfigurationName)\$(ProjectName)\$(PlatformName)"
|
||||
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"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\VmCompiler.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\VmCompiler.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="StdAfx"
|
||||
>
|
||||
<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>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\targetver.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="API"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\math.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Opcodes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Variables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vm.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Compiler"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Exporter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Exporter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LanguageSpecifier.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LanguageSpecifier.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LexAnalyzer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LexAnalyzer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SemAnalyzer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SemAnalyzer.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
65
bp10-4k/src/VmCompiler.vcproj.FIARA.Frank.user
Normal file
65
bp10-4k/src/VmCompiler.vcproj.FIARA.Frank.user
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioUserFile
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
ShowAllFiles="false"
|
||||
>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments="demo.txt demo.h"
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="SHAIKUR"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor="0"
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<DebugSettings
|
||||
Command="$(TargetPath)"
|
||||
WorkingDirectory=""
|
||||
CommandArguments=""
|
||||
Attach="false"
|
||||
DebuggerType="3"
|
||||
Remote="1"
|
||||
RemoteMachine="SHAIKUR"
|
||||
RemoteCommand=""
|
||||
HttpUrl=""
|
||||
PDBPath=""
|
||||
SQLDebugging=""
|
||||
Environment=""
|
||||
EnvironmentMerge="true"
|
||||
DebuggerFlavor=""
|
||||
MPIRunCommand=""
|
||||
MPIRunArguments=""
|
||||
MPIRunWorkingDirectory=""
|
||||
ApplicationCommand=""
|
||||
ApplicationArguments=""
|
||||
ShimCommand=""
|
||||
MPIAcceptMode=""
|
||||
MPIAcceptFilter=""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
</VisualStudioUserFile>
|
||||
112
bp10-4k/src/VmCompiler.vcxproj
Normal file
112
bp10-4k/src/VmCompiler.vcxproj
Normal file
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{AC061108-4616-4A59-A9E8-C1E7CBD21780}</ProjectGuid>
|
||||
<RootNamespace>Compiler</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)obj\$(Configuration)\$(ProjectName)\$(Platform)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)obj\$(Configuration)\$(ProjectName)\$(Platform)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="VmCompiler.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Exporter.cpp" />
|
||||
<ClCompile Include="LanguageSpecifier.cpp" />
|
||||
<ClCompile Include="LexAnalyzer.cpp" />
|
||||
<ClCompile Include="SemAnalyzer.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="VmCompiler.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="math.h" />
|
||||
<ClInclude Include="Opcodes.h" />
|
||||
<ClInclude Include="Variables.h" />
|
||||
<ClInclude Include="vm.h" />
|
||||
<ClInclude Include="Exporter.h" />
|
||||
<ClInclude Include="LanguageSpecifier.h" />
|
||||
<ClInclude Include="LexAnalyzer.h" />
|
||||
<ClInclude Include="SemAnalyzer.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
72
bp10-4k/src/VmCompiler.vcxproj.filters
Normal file
72
bp10-4k/src/VmCompiler.vcxproj.filters
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{d67245a7-18e4-4bfd-8cbb-f799221de1e9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="StdAfx">
|
||||
<UniqueIdentifier>{76bf6272-2684-46cb-8528-15d01679c7a5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="API">
|
||||
<UniqueIdentifier>{ba8536da-6c4a-446f-a5d0-8e1638a9fe78}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Compiler">
|
||||
<UniqueIdentifier>{3d1d9b39-f00a-4119-8c5b-8f82b83f216b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="VmCompiler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>StdAfx</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Exporter.cpp">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LanguageSpecifier.cpp">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LexAnalyzer.cpp">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SemAnalyzer.cpp">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="VmCompiler.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>StdAfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>StdAfx</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="math.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Opcodes.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Variables.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vm.h">
|
||||
<Filter>API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Exporter.h">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LanguageSpecifier.h">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LexAnalyzer.h">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SemAnalyzer.h">
|
||||
<Filter>Compiler</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
bp10-4k/src/VmCompiler.vcxproj.user
Normal file
3
bp10-4k/src/VmCompiler.vcxproj.user
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
252
bp10-4k/src/Window.cpp
Normal file
252
bp10-4k/src/Window.cpp
Normal file
@@ -0,0 +1,252 @@
|
||||
#include "stdafx.h"
|
||||
#include "Window.h"
|
||||
|
||||
#define WINDOW_CLASS _T("BluFlameIntroClass")
|
||||
|
||||
|
||||
Window::Window(LPCTSTR _title, int _width, int _height)
|
||||
: active(true)
|
||||
, deviceContext(NULL)
|
||||
, hWnd(NULL)
|
||||
, hInstance(NULL)
|
||||
, title(_title)
|
||||
, width(_width)
|
||||
, height(_height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Window::~Window()
|
||||
{
|
||||
::SetWindowLong(hWnd, GWL_USERDATA, PtrToLong(NULL));
|
||||
|
||||
if (deviceContext)
|
||||
{
|
||||
ReleaseDC(hWnd, deviceContext);
|
||||
hWnd = NULL;
|
||||
}
|
||||
|
||||
if (hWnd)
|
||||
{
|
||||
DestroyWindow(hWnd);
|
||||
hWnd = NULL;
|
||||
}
|
||||
|
||||
UnregisterClass(WINDOW_CLASS, hInstance);
|
||||
hInstance = NULL;
|
||||
}
|
||||
|
||||
|
||||
BOOL CenterWindow(HWND hwnd)
|
||||
{
|
||||
RECT rect, rectP;
|
||||
int width, height;
|
||||
int screenwidth, screenheight;
|
||||
int x, y;
|
||||
|
||||
GetWindowRect(hwnd, &rect);
|
||||
|
||||
rectP.left = 0;
|
||||
rectP.top = 0;
|
||||
rectP.right = GetSystemMetrics(SM_CXSCREEN);
|
||||
rectP.bottom = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
width = rect.right - rect.left;
|
||||
height = rect.bottom - rect.top;
|
||||
|
||||
x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
|
||||
y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
|
||||
|
||||
screenwidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
screenheight = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
if(x < 0) x = 0;
|
||||
if(y < 0) y = 0;
|
||||
if(x + width > screenwidth) x = screenwidth - width;
|
||||
if(y + height > screenheight) y = screenheight - height;
|
||||
|
||||
MoveWindow(hwnd, x, y, width, height, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void Window::Initialize()
|
||||
{
|
||||
WNDCLASS windowClass;
|
||||
DWORD exStyle;
|
||||
DWORD style;
|
||||
RECT windowRect;
|
||||
|
||||
windowRect.left = (long)0;
|
||||
windowRect.right = (long)width;
|
||||
windowRect.top = (long)0;
|
||||
windowRect.bottom = (long)height;
|
||||
|
||||
hInstance = GetModuleHandle(NULL);
|
||||
windowClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||
windowClass.lpfnWndProc = (WNDPROC)MessageCallback;
|
||||
windowClass.cbClsExtra = 0;
|
||||
windowClass.cbWndExtra = sizeof(this);
|
||||
windowClass.hInstance = hInstance;
|
||||
windowClass.hIcon = LoadIcon(NULL, IDI_WINLOGO);
|
||||
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
windowClass.hbrBackground = NULL;
|
||||
windowClass.lpszMenuName = NULL;
|
||||
windowClass.lpszClassName = WINDOW_CLASS;
|
||||
if (!RegisterClass(&windowClass))
|
||||
throw _T("Cannot register window class!");
|
||||
|
||||
exStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
||||
style = WS_OVERLAPPEDWINDOW;
|
||||
|
||||
AdjustWindowRectEx(&windowRect, style, FALSE, exStyle);
|
||||
|
||||
if (!(hWnd = CreateWindowEx(
|
||||
exStyle,
|
||||
WINDOW_CLASS,
|
||||
title,
|
||||
style |
|
||||
WS_CLIPSIBLINGS |
|
||||
WS_CLIPCHILDREN,
|
||||
0, 0,
|
||||
windowRect.right - windowRect.left,
|
||||
windowRect.bottom - windowRect.top,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
this)))
|
||||
{
|
||||
throw _T("Cannot create Window!");
|
||||
}
|
||||
|
||||
CenterWindow(hWnd);
|
||||
|
||||
if (!(deviceContext = GetDC(hWnd)))
|
||||
{
|
||||
throw _T("Cannot get Device Context!");
|
||||
}
|
||||
|
||||
ShowWindow(hWnd, SW_SHOW);
|
||||
SetForegroundWindow(hWnd);
|
||||
SetFocus(hWnd);
|
||||
}
|
||||
|
||||
|
||||
LRESULT Window::MessageCallback(HWND ar_Handle, UINT aw_Message, WPARAM aw_Param, LPARAM al_Param)
|
||||
{
|
||||
Window* lr_Window_;
|
||||
|
||||
if (aw_Message == WM_NCCREATE)
|
||||
{
|
||||
lr_Window_ = reinterpret_cast<Window*>(((LPCREATESTRUCT)al_Param)->lpCreateParams);
|
||||
lr_Window_->hWnd = ar_Handle;
|
||||
|
||||
::SetWindowLong(ar_Handle, GWL_USERDATA, PtrToLong((PVOID)(reinterpret_cast<LONG_PTR>(lr_Window_))));
|
||||
}
|
||||
else
|
||||
{
|
||||
lr_Window_ = reinterpret_cast<Window*>(::GetWindowLong(ar_Handle, GWL_USERDATA));
|
||||
}
|
||||
|
||||
if (lr_Window_ != NULL)
|
||||
{
|
||||
return lr_Window_->ProcessMessage(aw_Message, aw_Param, al_Param);
|
||||
}
|
||||
|
||||
return DefWindowProc(ar_Handle, aw_Message, aw_Param, al_Param);
|
||||
}
|
||||
|
||||
|
||||
LRESULT Window::ProcessMessage(UINT aw_Message, WPARAM aw_Param, LPARAM al_Param)
|
||||
{
|
||||
switch (aw_Message)
|
||||
{
|
||||
case WM_ACTIVATE:
|
||||
{
|
||||
if (!HIWORD(aw_Param))
|
||||
{
|
||||
set_Active(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_Active(false);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
case WM_SYSCOMMAND:
|
||||
{
|
||||
switch (aw_Param)
|
||||
{
|
||||
case SC_SCREENSAVE:
|
||||
case SC_MONITORPOWER:
|
||||
return 0;
|
||||
case SC_MINIMIZE:
|
||||
set_Active(false);
|
||||
break;
|
||||
case SC_RESTORE:
|
||||
set_Active(true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_CLOSE:
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
case WM_KEYDOWN:
|
||||
{
|
||||
if (aw_Param == 27)
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, aw_Message, aw_Param, al_Param);
|
||||
}
|
||||
|
||||
|
||||
void Window::set_Active(bool ab_Active)
|
||||
{
|
||||
active = ab_Active;
|
||||
}
|
||||
|
||||
|
||||
bool Window::get_Active()
|
||||
{
|
||||
return active;
|
||||
}
|
||||
|
||||
|
||||
void Window::set_DeviceContext(HDC ar_DeviceContext)
|
||||
{
|
||||
deviceContext = ar_DeviceContext;
|
||||
}
|
||||
|
||||
|
||||
HDC Window::get_DeviceContext()
|
||||
{
|
||||
return deviceContext;
|
||||
}
|
||||
|
||||
|
||||
HWND Window::get_Handle()
|
||||
{
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
|
||||
void Window::set_Title(LPCTSTR as_Title)
|
||||
{
|
||||
SetWindowText(hWnd, as_Title);
|
||||
}
|
||||
|
||||
|
||||
LPCTSTR Window::get_Title()
|
||||
{
|
||||
TCHAR* ls_Text = _T("");
|
||||
GetWindowText(hWnd, ls_Text, GetWindowTextLength(hWnd));
|
||||
return ls_Text;
|
||||
}
|
||||
32
bp10-4k/src/Window.h
Normal file
32
bp10-4k/src/Window.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
class Window
|
||||
{
|
||||
public:
|
||||
Window(LPCTSTR title, int width, int height);
|
||||
virtual ~Window();
|
||||
|
||||
// IWindow:
|
||||
virtual void Initialize();
|
||||
virtual LRESULT ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
virtual void set_Active(bool active);
|
||||
virtual bool get_Active();
|
||||
virtual void set_DeviceContext(HDC deviceContext);
|
||||
virtual void set_Title(LPCTSTR title);
|
||||
virtual LPCTSTR get_Title();
|
||||
virtual HDC get_DeviceContext();
|
||||
virtual HWND get_Handle();
|
||||
|
||||
private:
|
||||
static LRESULT CALLBACK MessageCallback(HWND handle, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
LPCTSTR title;
|
||||
int width;
|
||||
int height;
|
||||
HDC deviceContext;
|
||||
HWND hWnd;
|
||||
HINSTANCE hInstance;
|
||||
|
||||
bool active;
|
||||
};
|
||||
110
bp10-4k/src/demo.h
Normal file
110
bp10-4k/src/demo.h
Normal file
@@ -0,0 +1,110 @@
|
||||
#pragma once
|
||||
|
||||
#pragma data_seg(".jumpPositions")
|
||||
unsigned int jumpPositions[] =
|
||||
{
|
||||
0,
|
||||
5,
|
||||
35,
|
||||
47,
|
||||
54,
|
||||
60,
|
||||
79,
|
||||
129,
|
||||
190,
|
||||
196,
|
||||
257,
|
||||
302,
|
||||
332,
|
||||
340,
|
||||
};
|
||||
|
||||
#pragma data_seg(".opcodes")
|
||||
opcode opcodes[] =
|
||||
{
|
||||
opCall,
|
||||
opSwapBuffers,
|
||||
opGoto,
|
||||
opCameraPosition,
|
||||
opSet,
|
||||
opMul,
|
||||
opSeed,
|
||||
opPushMatrix,
|
||||
opAdd,
|
||||
opGotoEqualsGreater,
|
||||
opSub,
|
||||
opTranslate,
|
||||
opPopMatrix,
|
||||
opReturn,
|
||||
opColor,
|
||||
opRand,
|
||||
opScale,
|
||||
opDrawMesh,
|
||||
opSin,
|
||||
opCos,
|
||||
opRotate,
|
||||
opDiv,
|
||||
};
|
||||
|
||||
#pragma data_seg(".opcodeArgCount")
|
||||
unsigned char opcodeArgCount[] =
|
||||
{
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
2,
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
4,
|
||||
1,
|
||||
3,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
};
|
||||
|
||||
#pragma data_seg(".demoData")
|
||||
unsigned char demoData[] =
|
||||
{
|
||||
0,
|
||||
1, 1, 2, 0, 3, 128, 128, 192, 4, 3, 16, 5, 3, 16, 4, 7, 255, 3, 5, 7,
|
||||
4, 4, 1, 255, 3, 4, 4, 255, 254, 5, 4, 64, 6, 1, 7, 4, 2, 255, 1, 5,
|
||||
2, 4, 8, 2, 255, 4, 9, 2, 255, 7, 4, 2, 5, 10, 2, 255, 7, 2, 3, 10,
|
||||
2, 254, 11, 127, 127, 255, 2, 0, 6, 12, 10, 1, 1, 9, 1, 0, 2, 13, 7, 14,
|
||||
0, 254, 254, 254, 5, 5, 254, 15, 5, 15, 6, 5, 5, 3, 5, 6, 3, 8, 5, 127,
|
||||
8, 6, 127, 11, 255, 5, 255, 6, 129, 16, 128, 128, 192, 16, 150, 150, 150, 17, 1, 12,
|
||||
14, 192, 254, 192, 128, 17, 4, 13, 4, 0, 255, 254, 18, 0, 5, 0, 32, 8, 0, 128,
|
||||
4, 1, 255, 254, 4, 2, 255, 254, 18, 1, 19, 2, 5, 1, 127, 5, 2, 127, 8, 1,
|
||||
127, 8, 2, 127, 3, 255, 1, 255, 0, 255, 2, 0, 8, 7, 16, 254, 254, 254, 4, 1,
|
||||
255, 254, 5, 1, 16, 0, 10, 12, 13, 4, 1, 254, 5, 1, 8, 7, 15, 2, 15, 3,
|
||||
5, 2, 254, 5, 3, 254, 20, 1, 255, 2, 20, 2, 255, 3, 4, 2, 64, 5, 2, 64,
|
||||
11, 255, 2, 128, 128, 15, 2, 5, 2, 127, 8, 2, 127, 16, 255, 2, 255, 2, 255, 2,
|
||||
14, 254, 254, 254, 254, 17, 1, 12, 10, 1, 1, 9, 1, 0, 9, 13, 7, 0, 11, 16,
|
||||
206, 206, 206, 14, 64, 64, 64, 64, 17, 1, 12, 11, 127, 127, 119, 16, 140, 140, 140, 14,
|
||||
0, 0, 0, 254, 17, 3, 16, 196, 196, 196, 20, 2, 32, 14, 0, 0, 0, 0, 17, 1,
|
||||
13, 7, 0, 12, 20, 0, 64, 0, 12, 20, 0, 64, 0, 12, 20, 0, 64, 0, 12, 20,
|
||||
1, 64, 0, 12, 20, 1, 128, 0, 12, 12, 13, 6, 1, 4, 1, 192, 5, 1, 2, 7,
|
||||
11, 128, 128, 134, 15, 2, 15, 3, 5, 2, 8, 5, 3, 8, 8, 2, 126, 8, 3, 126,
|
||||
15, 4, 21, 4, 4, 8, 4, 128, 11, 255, 2, 255, 3, 255, 4, 15, 2, 8, 2, 131,
|
||||
16, 255, 2, 255, 2, 255, 2, 15, 2, 5, 2, 8, 15, 2, 8, 2, 1, 5, 2, 128,
|
||||
4, 3, 255, 2, 4, 4, 255, 2, 8, 2, 16, 8, 3, 96, 4, 5, 255, 1, 21, 5,
|
||||
8, 14, 255, 2, 255, 3, 255, 4, 255, 5, 17, 1, 12, 10, 1, 1, 9, 1, 0, 13,
|
||||
13,};
|
||||
|
||||
#pragma data_seg(".texts")
|
||||
char* texts[] =
|
||||
{
|
||||
};
|
||||
|
||||
#pragma data_seg(".textAmount")
|
||||
unsigned char textAmount = 0;
|
||||
221
bp10-4k/src/demo.txt
Normal file
221
bp10-4k/src/demo.txt
Normal file
@@ -0,0 +1,221 @@
|
||||
demo:
|
||||
//Call(borgScene);
|
||||
//Call(insideCubeScene);
|
||||
|
||||
CameraPosition(128, 128, 96);
|
||||
PushMatrix();
|
||||
Set(1, reg time);
|
||||
Mul(1, 60);
|
||||
Rotate(y, reg 1);
|
||||
Translate(123, 123, 127);
|
||||
Color(254,254,254,128);
|
||||
DrawText("T");
|
||||
PopMatrix();
|
||||
|
||||
SwapBuffers();
|
||||
Goto(demo);
|
||||
|
||||
insideCubeScene:
|
||||
CameraPosition(128, 128, 192);
|
||||
Set(3, 12);
|
||||
Mul(3, 12);
|
||||
Set(7, reg 3);
|
||||
Mul(7, 5);
|
||||
Set(1, reg 3);
|
||||
Set(4, reg time);
|
||||
Mul(4, 64);
|
||||
Seed(1);
|
||||
PushMatrix();
|
||||
Set(9, reg time);
|
||||
Sin(9);
|
||||
Mul(9, 128);
|
||||
Add(9, 32);
|
||||
Translate(127, 127, reg 9);
|
||||
Color(0,0,0,254);
|
||||
DrawMesh(cylinder);
|
||||
PopMatrix();
|
||||
tunnelLoop:
|
||||
PushMatrix();
|
||||
PushMatrix();
|
||||
Set(2, reg 1);
|
||||
Mul(2, 5);
|
||||
Add(2, reg 4);
|
||||
negateWhile:
|
||||
GotoEqualsGreater(2, reg 7, negate);
|
||||
Goto(continue);
|
||||
negate:
|
||||
Sub(2, reg 7);
|
||||
Goto(negateWhile);
|
||||
continue:
|
||||
Sub(2, 254);
|
||||
Translate(127, 127, reg 2);
|
||||
Set(9, reg time);
|
||||
Set(8, reg 2);
|
||||
Div(8, 64);
|
||||
Add(9, reg 8);
|
||||
Sin(9);
|
||||
Mul(9, 64);
|
||||
Rotate(z, reg 9);
|
||||
Call(drawWallTorus);
|
||||
PopMatrix();
|
||||
PopMatrix();
|
||||
Sub(1, 1);
|
||||
GotoEqualsGreater(1, 0, tunnelLoop);
|
||||
Return();
|
||||
|
||||
drawWallTorus:
|
||||
Color(254,128,0,128);
|
||||
DrawMesh(torus2);
|
||||
Call(drawRandCubeWallTorus);
|
||||
Rotate(z,64);
|
||||
Call(drawRandCubeWallTorus);
|
||||
Rotate(z,64);
|
||||
Call(drawRandCubeWallTorus);
|
||||
Rotate(z,64);
|
||||
Call(drawRandCubeWallTorus);
|
||||
Return();
|
||||
|
||||
drawRandCubeWallTorus:
|
||||
Set(5, 12);
|
||||
PushMatrix();
|
||||
Rotate(z, 32);
|
||||
Translate(120, 132, 127);
|
||||
wallTorusLoop:
|
||||
Translate(128, 127, 127);
|
||||
Rand(6);
|
||||
Add(6,1);
|
||||
Mul(6,3);
|
||||
GotoEqualsGreater(6, 1, endDrawWallTorus);
|
||||
PushMatrix();
|
||||
Rand(6);
|
||||
Mul(6, 2);
|
||||
Add(6,130);
|
||||
Scale(reg 6, reg 6, 160);
|
||||
Color(0,128,254,254);
|
||||
DrawMesh(cube);
|
||||
PopMatrix();
|
||||
endDrawWallTorus:
|
||||
Sub(5, 1);
|
||||
GotoEqualsGreater(5, 0, wallTorusLoop);
|
||||
PopMatrix();
|
||||
dontDrawRandCubeWallTorus:
|
||||
Return();
|
||||
|
||||
borgScene:
|
||||
Set(0, reg time);
|
||||
Sin(0);
|
||||
Mul(0, 32);
|
||||
Add(0, 128);
|
||||
Set(1, reg time);
|
||||
Set(2, reg time);
|
||||
Sin(1);
|
||||
Cos(2);
|
||||
Mul(1, 127);
|
||||
Mul(2, 127);
|
||||
Add(1, 127);
|
||||
Add(2, 127);
|
||||
CameraPosition(reg 1, reg 0, reg 2);
|
||||
//CameraPosition(128, 128, 64);
|
||||
Call(drawSky);
|
||||
PushMatrix();
|
||||
Scale(254, 254, 254);
|
||||
Set(1, reg time);
|
||||
Mul(1, 16);
|
||||
Call(borgCube);
|
||||
PopMatrix();
|
||||
Return();
|
||||
|
||||
drawSky:
|
||||
Set(1, 254);
|
||||
Mul(1, 2);
|
||||
skyLoop:
|
||||
PushMatrix();
|
||||
Rand(2);
|
||||
Rand(3);
|
||||
Mul(2, 254);
|
||||
Mul(3, 254);
|
||||
Rotate(y, reg 2);
|
||||
Rotate(z, reg 3);
|
||||
Set(2, 64);
|
||||
Mul(2, 64);
|
||||
Translate(reg 2, 128, 128);
|
||||
Rand(2);
|
||||
Mul(2, 32);
|
||||
Add(2, 192);
|
||||
Scale(reg 2, reg 2, reg 2);
|
||||
Color(254,254,254,254);
|
||||
DrawMesh(cube);
|
||||
PopMatrix();
|
||||
Sub(1, 1);
|
||||
GotoEqualsGreater(1, 0, skyLoop);
|
||||
Return();
|
||||
|
||||
borgCube:
|
||||
Color(64, 64, 64, 64);
|
||||
DrawMesh(cube);
|
||||
PushMatrix();
|
||||
Call(borgCubeHalf);
|
||||
PopMatrix();
|
||||
Translate(127, 127, 119);
|
||||
Scale(140, 140, 140);
|
||||
Color(254, 128, 0, 254);
|
||||
DrawMesh(torus1);
|
||||
Scale(196, 196, 196);
|
||||
Rotate(z, 32);
|
||||
Color(0, 0, 0, 0);
|
||||
DrawMesh(cube);
|
||||
Return();
|
||||
|
||||
borgCubeHalf:
|
||||
PushMatrix();
|
||||
Call(randomCubeSide);
|
||||
Rotate(x, 64);
|
||||
Call(randomCubeSide);
|
||||
Rotate(x, 64);
|
||||
Call(randomCubeSide);
|
||||
Rotate(x, 64);
|
||||
Call(randomCubeSide);
|
||||
Rotate(y, 64);
|
||||
Call(randomCubeSide);
|
||||
Rotate(y, 128);
|
||||
Call(randomCubeSide);
|
||||
PopMatrix();
|
||||
Return();
|
||||
|
||||
randomCubeSide:
|
||||
Seed(1);
|
||||
Set(1, 128);
|
||||
Mul(1, 2);
|
||||
randomCubeLoop:
|
||||
PushMatrix();
|
||||
Translate(128, 128, 134);
|
||||
Rand(2);
|
||||
Rand(3);
|
||||
Mul(2, 8);
|
||||
Mul(3, 8);
|
||||
Add(2, 126);
|
||||
Add(3, 126);
|
||||
Rand(4);
|
||||
Div(4, 4);
|
||||
Add(4, 128);
|
||||
Translate(reg 2, reg 3, reg 4);
|
||||
Rand(2);
|
||||
Add(2, 131);
|
||||
Scale(reg 2, reg 2, reg 2);
|
||||
Rand(2);
|
||||
Mul(2, 8);
|
||||
Rand(2);
|
||||
Add(2, 1);
|
||||
Mul(2, 128);
|
||||
Set(3, reg 2);
|
||||
Set(4, reg 2);
|
||||
Add(2, 16);
|
||||
Add(3, 96);
|
||||
Set(5, reg 1);
|
||||
Div(5, 8);
|
||||
Color(reg 2, reg 3, reg 4, reg 5);
|
||||
DrawMesh(cube);
|
||||
PopMatrix();
|
||||
Sub(1, 1);
|
||||
GotoEqualsGreater(1, 0, randomCubeLoop);
|
||||
Return();
|
||||
180
bp10-4k/src/graphics.h
Normal file
180
bp10-4k/src/graphics.h
Normal file
@@ -0,0 +1,180 @@
|
||||
#pragma once
|
||||
|
||||
#pragma data_seg(".screenQuad")
|
||||
struct ScreenQuadVertex { float x, y, z, w, u, v; };
|
||||
ScreenQuadVertex screenQuad[] = {
|
||||
{width, height, 0, 1, 1, 1},
|
||||
{-1, height, 0, 1, 0, 1},
|
||||
{width, -1, 0, 1, 1, 0},
|
||||
{-1, -1, 0, 1, 0, 0}
|
||||
};
|
||||
|
||||
#pragma data_seg(".d3dPresParams")
|
||||
D3DPRESENT_PARAMETERS d3dPresParams = {
|
||||
width,
|
||||
height,
|
||||
D3DFMT_A8R8G8B8,
|
||||
1,
|
||||
D3DMULTISAMPLE_4_SAMPLES,
|
||||
0,
|
||||
D3DSWAPEFFECT_DISCARD,
|
||||
0,
|
||||
false,
|
||||
true,
|
||||
D3DFMT_D16,
|
||||
0,
|
||||
D3DPRESENT_RATE_DEFAULT,
|
||||
D3DPRESENT_INTERVAL_ONE
|
||||
};
|
||||
|
||||
#pragma code_seg(".InitTexts")
|
||||
__forceinline void InitTexts()
|
||||
{
|
||||
hDc = ::GetDC(hWnd);
|
||||
::SelectObject(hDc, CreateFontA(0, 0, 0, 0, FW_BOLD, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "wingdings"));
|
||||
for (int i = 0; i < textAmount; ++i)
|
||||
D3DXCreateTextA(d3dDevice, hDc, (LPCSTR)texts[i], 0.0f, 0.1f, &textMeshes[i], NULL, NULL);
|
||||
}
|
||||
|
||||
#pragma code_seg(".InitGraphics")
|
||||
inline void InitGraphics()
|
||||
{
|
||||
d3dPresParams.hDeviceWindow = hWnd;
|
||||
#ifdef _DEBUG
|
||||
d3dPresParams.Windowed = true;
|
||||
#endif
|
||||
Direct3DCreate9(D3D_SDK_VERSION)->CreateDevice(0, D3DDEVTYPE_HAL, hWnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dPresParams, &d3dDevice);
|
||||
|
||||
for (int i = 0; i < shaderAmount; ++i)
|
||||
{
|
||||
D3DXCompileShader(shader, shaderLength, 0, 0, shaderEntryPoint, shaderProfiles[i], 0, &shaderBuffer, &errorBuffer, 0);
|
||||
(*shaderEntryPoint)++;
|
||||
|
||||
#ifndef TARGET_4K
|
||||
if (errorBuffer->GetBufferSize() != 0)
|
||||
OutputDebugStringA((LPCSTR)errorBuffer->GetBufferPointer());
|
||||
#endif
|
||||
|
||||
void* bufferPointer = shaderBuffer->GetBufferPointer();
|
||||
if (shaderCreationFunctionsDevice[i]) _asm
|
||||
{
|
||||
MOV ebx, DWORD ptr [i]
|
||||
MOV eax, DWORD ptr [d3dDevice]
|
||||
MOV eax, DWORD ptr [eax]
|
||||
MOV ecx, DWORD ptr shaderTargets[ebx*4]
|
||||
PUSH ecx
|
||||
MOV ecx, DWORD ptr shaderCreationFunctions[ebx*4]
|
||||
PUSH DWORD ptr [bufferPointer]
|
||||
PUSH DWORD ptr [d3dDevice]
|
||||
MOV eax, DWORD ptr [eax+ecx]
|
||||
CALL eax
|
||||
}
|
||||
else
|
||||
D3DXCreateTextureShader((DWORD*)bufferPointer, (LPD3DXTEXTURESHADER*)shaderTargets[i]);
|
||||
}
|
||||
|
||||
D3DXCreateSphere(d3dDevice, 1, 64, 64, &meshes[0], NULL);
|
||||
D3DXCreateBox(d3dDevice, 1, 1, 1, &meshes[1], NULL);
|
||||
D3DXCreateCylinder(d3dDevice, 1, 1, 1, 32, 1, &meshes[2], NULL);
|
||||
D3DXCreateTorus(d3dDevice, 0.5f, 1, 4, 4, &meshes[3], NULL);
|
||||
D3DXCreateTorus(d3dDevice, 0.25f, 1, 4, 4, &meshes[4], NULL);
|
||||
D3DXCreateTeapot(d3dDevice, &meshes[5], NULL);
|
||||
D3DXCreateMatrixStack(0, &matrixStack);
|
||||
|
||||
InitTexts();
|
||||
|
||||
d3dDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &blurRenderTexture, NULL);
|
||||
d3dDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &renderTexture, NULL);
|
||||
|
||||
d3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
|
||||
d3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
|
||||
|
||||
blurRenderTexture->GetSurfaceLevel(0, &blurRenderSurface);
|
||||
renderTexture->GetSurfaceLevel(0, &renderSurface);
|
||||
d3dDevice->GetRenderTarget(0, &bufferSurface);
|
||||
|
||||
d3dDevice->Present(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
#pragma code_seg(".UpdateMatrices")
|
||||
void UpdateMatrices()
|
||||
{
|
||||
_asm
|
||||
{
|
||||
push 44800000h
|
||||
push 3E000000h
|
||||
push 3FAA0000h
|
||||
push 3F490000h
|
||||
push offset projectionMatrix
|
||||
push offset rotationAxis+0Ch
|
||||
push offset rotationAxis+24h
|
||||
push offset viewPosition
|
||||
push offset viewMatrix
|
||||
call DWORD ptr[D3DXMatrixLookAtLH]
|
||||
call dword ptr [D3DXMatrixPerspectiveFovLH]
|
||||
|
||||
mov eax,dword ptr [d3dDevice]
|
||||
mov esi,dword ptr [eax]
|
||||
push 4
|
||||
push offset viewProjectionMatrix
|
||||
push 4
|
||||
push eax
|
||||
push 4
|
||||
push offset viewMatrix
|
||||
push 0
|
||||
push eax
|
||||
push offset projectionMatrix
|
||||
push offset viewMatrix
|
||||
push offset viewProjectionMatrix
|
||||
push offset viewMatrix
|
||||
mov eax,dword ptr [matrixStack]
|
||||
push eax
|
||||
mov eax,dword ptr [eax]
|
||||
call dword ptr [eax+44h]
|
||||
push eax
|
||||
push offset viewMatrix
|
||||
call dword ptr [D3DXMatrixMultiply]
|
||||
call dword ptr [D3DXMatrixMultiply]
|
||||
call dword ptr [esi+178h]
|
||||
call dword ptr [esi+178h]
|
||||
}
|
||||
}
|
||||
|
||||
#pragma code_seg(".DrawFrame")
|
||||
inline void DrawFrame()
|
||||
{
|
||||
d3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DXCOLOR(0.0f, 0.0f, 0.0f, 0.5f), 1.0f, 0);
|
||||
d3dDevice->BeginScene();
|
||||
|
||||
d3dDevice->SetVertexShader(vertexShader);
|
||||
d3dDevice->SetPixelShader(lightShader);
|
||||
d3dDevice->SetVertexShaderConstantF(9, identityVectors[0], 1);
|
||||
|
||||
//matrixStack->LoadIdentity();
|
||||
RunVM();
|
||||
|
||||
//GLOW
|
||||
d3dDevice->SetTexture(0, blurRenderTexture);
|
||||
d3dDevice->SetTexture(1, renderTexture);
|
||||
|
||||
d3dDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
|
||||
|
||||
d3dDevice->StretchRect(bufferSurface, NULL, blurRenderSurface, NULL, D3DTEXF_LINEAR);
|
||||
d3dDevice->StretchRect(bufferSurface, NULL, renderSurface, NULL, D3DTEXF_LINEAR);
|
||||
|
||||
d3dDevice->SetPixelShader(blurShader);
|
||||
|
||||
int i = 4;
|
||||
do
|
||||
{
|
||||
d3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, screenQuad, sizeof(ScreenQuadVertex));
|
||||
d3dDevice->StretchRect(bufferSurface, NULL, blurRenderSurface, NULL, D3DTEXF_LINEAR);
|
||||
} while (--i);
|
||||
|
||||
d3dDevice->SetPixelShader(combineShader);
|
||||
d3dDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, screenQuad, sizeof(ScreenQuadVertex));
|
||||
// END GLOW
|
||||
|
||||
d3dDevice->EndScene();
|
||||
d3dDevice->Present(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
113
bp10-4k/src/math.h
Normal file
113
bp10-4k/src/math.h
Normal file
@@ -0,0 +1,113 @@
|
||||
#pragma once
|
||||
|
||||
#pragma code_seg(".ftol")
|
||||
DWORD x_Ftol(float af_Value)
|
||||
{
|
||||
DWORD ldw_Result;
|
||||
__asm fld af_Value
|
||||
__asm fistp ldw_Result
|
||||
return ldw_Result;
|
||||
}
|
||||
|
||||
#pragma code_seg(".frac")
|
||||
float x_Frac(float af_Value)
|
||||
{
|
||||
return af_Value - x_Ftol(af_Value);
|
||||
}
|
||||
|
||||
#pragma code_seg(".abs")
|
||||
float x_Abs(float af_Value)
|
||||
{
|
||||
__asm fld af_Value
|
||||
__asm fabs
|
||||
}
|
||||
|
||||
#pragma code_seg(".sin")
|
||||
float x_Sin(float af_Value)
|
||||
{
|
||||
__asm fld af_Value
|
||||
__asm fsin
|
||||
}
|
||||
|
||||
#pragma code_seg(".cos")
|
||||
float x_Cos(float af_Value)
|
||||
{
|
||||
__asm fld af_Value
|
||||
__asm fcos
|
||||
}
|
||||
|
||||
#pragma code_seg(".sign")
|
||||
float x_Sign(float af_Value)
|
||||
{
|
||||
return af_Value > 0 ? 1.0f : -1.0f;
|
||||
}
|
||||
|
||||
#pragma code_seg(".sqrt")
|
||||
float x_Sqrt(float af_Value)
|
||||
{
|
||||
__asm fld af_Value
|
||||
__asm fsqrt
|
||||
}
|
||||
|
||||
#pragma code_seg(".memcpy")
|
||||
void x_MemCopy(void* av_Dest_, const void* av_Src_, size_t ai_Size)
|
||||
{
|
||||
__asm mov esi, av_Src_
|
||||
__asm mov edi, av_Dest_
|
||||
__asm mov ecx, ai_Size
|
||||
__asm rep movsb
|
||||
}
|
||||
|
||||
#pragma code_seg(".fmod")
|
||||
float x_Fmod(float x, float y)
|
||||
{
|
||||
__asm fld y
|
||||
__asm fld x
|
||||
__asm fprem
|
||||
__asm fxch
|
||||
__asm fstp x
|
||||
}
|
||||
|
||||
#pragma bss_seg(".seed")
|
||||
static unsigned long seed;
|
||||
|
||||
#pragma code_seg(".randomize")
|
||||
void x_Randomize(unsigned long x)
|
||||
{
|
||||
seed = x;
|
||||
}
|
||||
|
||||
#pragma code_seg(".rand")
|
||||
float x_Rand()
|
||||
{
|
||||
seed = seed * 0x76364873 + 1234567;
|
||||
return (float)(seed & 0x7FFFFFFF) * (const float)(2.0f / (float)0x7FFFFFFF) - 1.0f;
|
||||
}
|
||||
|
||||
#pragma code_seg(".pow")
|
||||
float x_Pow(float x, float y)
|
||||
{
|
||||
float r;
|
||||
__asm
|
||||
{
|
||||
fld y
|
||||
fld x
|
||||
fyl2x
|
||||
fld1
|
||||
fld st(1)
|
||||
fprem
|
||||
f2xm1
|
||||
faddp st(1),st
|
||||
fscale
|
||||
fxch st(1)
|
||||
fstp st(0)
|
||||
fstp r
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
#pragma code_seg(".max")
|
||||
float x_Max(float a, float b) { return (a > b) ? a : b; }
|
||||
|
||||
#pragma code_seg(".min")
|
||||
float x_Min(float a, float b) { return (a < b) ? a : b; }
|
||||
42
bp10-4k/src/shaders.h
Normal file
42
bp10-4k/src/shaders.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#pragma data_seg(".shader")
|
||||
static const char* shader = "sampler r,s,t;float4 u,v,w,z,k;float4x4 x,y;void a(inout float4 h:POSITION,float3 i:NORMAL,out float3 j[3]:TEXCOORD){h.z*=z.x;float3 m=mul(x,h);h=mul(y,h);j[0]=mul(x,i);j[1]=float3(0,5,-5)-m;j[2]=v-m;}float4 b(float3 h[3]:TEXCOORD):COLOR{float3 m,n;m=normalize(h[0]),n=normalize(h[1]);float l=max(.1,dot(m,n));return u*l+u.a*pow(max(0,dot(2*m*l-n,normalize(h[2]))),32);}float4 c(float2 h:TEXCOORD):COLOR{float4 m=tex2D(r,h);float2 n;for(float i=0;i<6;i+=.6){sincos(i,n.x,n.y);float4 t=tex2D(r,h+.01*n);m+=t;}return m/11;}float4 d(float2 h:TEXCOORD):COLOR{float4 m=tex2D(r,h),t=tex2D(s,h);return m*pow(m.a,2)+m.a*t;}";
|
||||
|
||||
#pragma bss_seg(".shaderBss")
|
||||
static IDirect3DVertexShader9* vertexShader;
|
||||
static IDirect3DPixelShader9* lightShader;
|
||||
static IDirect3DPixelShader9* blurShader;
|
||||
static IDirect3DPixelShader9* combineShader;
|
||||
|
||||
#pragma data_seg(".shaderCreationFunctions")
|
||||
static void* shaderCreationFunctions[] = {
|
||||
(void*)0x16C, //CreateVertexShader
|
||||
(void*)0x1A8, //CreatePixelShader
|
||||
(void*)0x1A8, //CreatePixelShader
|
||||
(void*)0x1A8, //CreatePixelShader
|
||||
};
|
||||
|
||||
#pragma data_seg(".shaderCreationFunctionsDevice")
|
||||
static bool shaderCreationFunctionsDevice[] = {
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
};
|
||||
|
||||
#pragma data_seg(".shaderLength")
|
||||
static const int shaderLength = 615;
|
||||
|
||||
#pragma data_seg(".shaderAmount")
|
||||
static const int shaderAmount = 4;
|
||||
|
||||
#pragma data_seg(".shaderEntryPoint")
|
||||
static char shaderEntryPoint[] = {'a', 0};
|
||||
|
||||
#pragma data_seg(".shaderProfiles")
|
||||
static const char* shaderProfiles[] = {"vs_3_0", "ps_3_0", "ps_3_0", "ps_3_0", };
|
||||
|
||||
#pragma data_seg(".shaderTargets")
|
||||
static const void* shaderTargets[] = {&vertexShader, &lightShader, &blurShader, &combineShader, };
|
||||
|
||||
44
bp10-4k/src/shaders.hlsl
Normal file
44
bp10-4k/src/shaders.hlsl
Normal file
@@ -0,0 +1,44 @@
|
||||
sampler r,s,t;
|
||||
float4 u,v,w,z,k;
|
||||
float4x4 x,y;
|
||||
|
||||
///(vertexShader,vs_3_0)
|
||||
void a(inout float4 h:POSITION,float3 i:NORMAL,out float3 j[3]:TEXCOORD)
|
||||
{
|
||||
h.z*=z.x;
|
||||
float3 m=mul(x,h);
|
||||
h=mul(y,h);
|
||||
j[0]=mul(x,i);
|
||||
j[1]=float3(0,5,-5)-m;
|
||||
j[2]=v-m;
|
||||
}
|
||||
|
||||
///(lightShader,ps_3_0)
|
||||
float4 b(float3 h[3]:TEXCOORD):COLOR
|
||||
{
|
||||
float3 m,n;
|
||||
m=normalize(h[0]),n=normalize(h[1]);
|
||||
float l=max(.1,dot(m,n));
|
||||
return u*l+u.a*pow(max(0,dot(2*m*l-n,normalize(h[2]))),32);
|
||||
}
|
||||
|
||||
///(blurShader,ps_3_0)
|
||||
float4 c(float2 h:TEXCOORD):COLOR
|
||||
{
|
||||
float4 m=tex2D(r,h);
|
||||
float2 n;
|
||||
for(float i=0;i<6;i+=.6)
|
||||
{
|
||||
sincos(i,n.x,n.y);
|
||||
float4 t=tex2D(r,h+.01*n);
|
||||
m+=t;
|
||||
}
|
||||
return m/11;
|
||||
}
|
||||
|
||||
///(combineShader,ps_3_0)
|
||||
float4 d(float2 h:TEXCOORD):COLOR
|
||||
{
|
||||
float4 m=tex2D(r,h),t=tex2D(s,h);
|
||||
return m*pow(m.a,2)+m.a*t;
|
||||
}
|
||||
9
bp10-4k/src/stdafx.cpp
Normal file
9
bp10-4k/src/stdafx.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// 4k.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
CString errorString;
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
26
bp10-4k/src/stdafx.h
Normal file
26
bp10-4k/src/stdafx.h
Normal file
@@ -0,0 +1,26 @@
|
||||
// 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>
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
||||
#include <atlbase.h>
|
||||
#include <atlstr.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
|
||||
extern CString errorString;
|
||||
struct VmError {};
|
||||
#define VMERROR(s) { errorString = s; throw VmError(); }
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
91
bp10-4k/src/synth.h
Normal file
91
bp10-4k/src/synth.h
Normal file
@@ -0,0 +1,91 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_EXTRA_LEAN
|
||||
#include "mmreg.h"
|
||||
#include "4klang.h"
|
||||
|
||||
#define USE_SOUND_THREAD
|
||||
|
||||
#pragma bss_seg(".synthnothing")
|
||||
static float lpSoundBuffer[MAX_SAMPLES];
|
||||
static HWAVEOUT hWaveOut;
|
||||
|
||||
#pragma data_seg(".wavefmt")
|
||||
WAVEFORMATEX WaveFMT =
|
||||
{
|
||||
#ifdef FLOAT_32BIT
|
||||
WAVE_FORMAT_IEEE_FLOAT,
|
||||
#else
|
||||
WAVE_FORMAT_PCM,
|
||||
#endif
|
||||
2, // channels
|
||||
SAMPLE_RATE, // samples per sec
|
||||
SAMPLE_RATE*sizeof(SAMPLE_TYPE)*2, // bytes per sec
|
||||
sizeof(SAMPLE_TYPE)*2, // block alignment;
|
||||
sizeof(SAMPLE_TYPE)*8, // bits per sample
|
||||
0 // extension not needed
|
||||
};
|
||||
|
||||
#pragma data_seg(".wavehdr")
|
||||
WAVEHDR WaveHDR =
|
||||
{
|
||||
(LPSTR)lpSoundBuffer,
|
||||
MAX_SAMPLES*sizeof(SAMPLE_TYPE)*2, // MAX_SAMPLES*sizeof(float)*2(stereo)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
#pragma data_seg(".mmtime")
|
||||
MMTIME MMTime =
|
||||
{
|
||||
TIME_SAMPLES,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
#ifdef USE_SOUND_THREAD
|
||||
#pragma code_seg(".sndthrd")
|
||||
DWORD WINAPI SoundThread( LPVOID lpParam )
|
||||
{
|
||||
_4klang_render(lpSoundBuffer);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma code_seg(".initsnd")
|
||||
extern "C" void InitSound()
|
||||
{
|
||||
#ifdef USE_SOUND_THREAD
|
||||
CreateThread(0, 0, SoundThread, 0, 0, 0);
|
||||
#else
|
||||
_4klang_render(lpSoundBuffer);
|
||||
#endif
|
||||
_asm
|
||||
{
|
||||
push esi
|
||||
push esi
|
||||
push esi
|
||||
push offset WaveFMT
|
||||
push 0FFFFFFFFh
|
||||
push offset hWaveOut
|
||||
call dword ptr [waveOutOpen]
|
||||
push 20h
|
||||
push offset WaveHDR
|
||||
push dword ptr [hWaveOut]
|
||||
push 20h
|
||||
push offset WaveHDR
|
||||
push dword ptr [hWaveOut]
|
||||
call dword ptr [waveOutPrepareHeader]
|
||||
call dword ptr [waveOutWrite]
|
||||
}
|
||||
}
|
||||
|
||||
#pragma code_seg(".time")
|
||||
extern "C" float get_Time()
|
||||
{
|
||||
waveOutGetPosition(hWaveOut, &MMTime, sizeof(MMTIME));
|
||||
return float(MMTime.u.sample) / SAMPLE_RATE;
|
||||
}
|
||||
13
bp10-4k/src/targetver.h
Normal file
13
bp10-4k/src/targetver.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#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
|
||||
|
||||
35
bp10-4k/src/vm.h
Normal file
35
bp10-4k/src/vm.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#pragma code_seg(".RunVM")
|
||||
void RunVM()
|
||||
{
|
||||
processingVm = true;
|
||||
while (processingVm)
|
||||
{
|
||||
int opcode = demoData[demoIndex++];
|
||||
|
||||
int i = opcodeArgCount[opcode];
|
||||
int j = 0;
|
||||
while (i--)
|
||||
{
|
||||
if (demoData[demoIndex] == 255)
|
||||
{
|
||||
demoParams[j++] = reg[demoData[++demoIndex]];
|
||||
++demoIndex;
|
||||
continue;
|
||||
}
|
||||
demoParams[j++] = demoData[demoIndex++];
|
||||
};
|
||||
|
||||
#ifndef TARGET_4K
|
||||
if (opcodes[opcode] == NULL)
|
||||
{
|
||||
errorString = _T("The VM stopped unexpectedly! Ensure a constant running loop. To end the demo, use Terminate();");
|
||||
throw VmError();
|
||||
}
|
||||
#endif
|
||||
|
||||
// call opcode
|
||||
opcodes[opcode](demoParams, x_Ftol(demoParams[0]));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user