Try a new CPU. No idea what i'm doing :/

This commit is contained in:
Asnivor 2024-11-15 17:08:41 +00:00
parent 71be0c95f9
commit 6dbd59cfc6
4 changed files with 334 additions and 0 deletions

View File

@ -0,0 +1,5 @@
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
// such as names of functions and macros.
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
#define W_EXPORT __declspec(dllexport)
#define W_EXPORT __attribute__((visibility("default")))

View File

@ -0,0 +1,152 @@
#ifdef _WIN32
#define W_EXPORT __declspec(dllexport)
#else
#define W_EXPORT __attribute__((visibility("default")))
#endif // _WIN32
#include "w65c02s.h/include/w65c02s.h"
W_EXPORT void exp_w65c02s_init(struct w65c02s_cpu* cpu,
uint8_t(*mem_read)(struct w65c02s_cpu*, uint16_t),
void (*mem_write)(struct w65c02s_cpu*, uint16_t, uint8_t),
void* cpu_data) {
w65c02s_init(cpu, mem_read, mem_write, cpu_data);
}
W_EXPORT size_t exp_w65c02s_cpu_size(void) {
return w65c02s_cpu_size();
}
W_EXPORT unsigned long exp_w65c02s_run_cycles(struct w65c02s_cpu* cpu, unsigned long cycles) {
return w65c02s_run_cycles(cpu, cycles);
}
W_EXPORT unsigned long exp_w65c02s_step_instruction(struct w65c02s_cpu* cpu) {
return w65c02s_step_instruction(cpu);
}
W_EXPORT unsigned long exp_w65c02s_run_instructions(struct w65c02s_cpu* cpu,
unsigned long instructions,
bool finish_existing) {
return w65c02s_run_instructions(cpu, instructions, finish_existing);
}
W_EXPORT unsigned long exp_w65c02s_get_cycle_count(const struct w65c02s_cpu* cpu) {
return w65c02s_get_cycle_count(cpu);
}
W_EXPORT unsigned long exp_w65c02s_get_instruction_count(const struct w65c02s_cpu* cpu) {
return w65c02s_get_instruction_count(cpu);
}
W_EXPORT void* exp_w65c02s_get_cpu_data(const struct w65c02s_cpu* cpu) {
return w65c02s_get_cpu_data(cpu);
}
W_EXPORT void exp_w65c02s_reset_cycle_count(struct w65c02s_cpu* cpu) {
w65c02s_reset_cycle_count(cpu);
}
W_EXPORT void exp_w65c02s_reset_instruction_count(struct w65c02s_cpu* cpu) {
w65c02s_reset_instruction_count(cpu);
}
W_EXPORT bool exp_w65c02s_is_cpu_waiting(const struct w65c02s_cpu* cpu) {
return w65c02s_is_cpu_waiting(cpu);
}
W_EXPORT bool exp_w65c02s_is_cpu_stopped(const struct w65c02s_cpu* cpu) {
return w65c02s_is_cpu_stopped(cpu);
}
W_EXPORT void exp_w65c02s_break(struct w65c02s_cpu* cpu) {
w65c02s_break(cpu);
}
W_EXPORT void exp_w65c02s_stall(struct w65c02s_cpu* cpu, unsigned long cycles) {
w65c02s_stall(cpu, cycles);
}
W_EXPORT void exp_w65c02s_nmi(struct w65c02s_cpu* cpu) {
w65c02s_nmi(cpu);
}
W_EXPORT void exp_w65c02s_reset(struct w65c02s_cpu* cpu) {
w65c02s_reset(cpu);
}
W_EXPORT void exp_w65c02s_irq(struct w65c02s_cpu* cpu) {
w65c02s_irq(cpu);
}
W_EXPORT void exp_w65c02s_irq_cancel(struct w65c02s_cpu* cpu) {
w65c02s_irq_cancel(cpu);
}
W_EXPORT void exp_w65c02s_set_overflow(struct w65c02s_cpu* cpu) {
w65c02s_set_overflow(cpu);
}
W_EXPORT bool exp_w65c02s_hook_brk(struct w65c02s_cpu* cpu, bool (*brk_hook)(uint8_t)) {
return w65c02s_hook_brk(cpu, brk_hook);
}
W_EXPORT bool exp_w65c02s_hook_stp(struct w65c02s_cpu* cpu, bool (*stp_hook)(void)) {
return w65c02s_hook_stp(cpu, stp_hook);
}
W_EXPORT bool exp_w65c02s_hook_end_of_instruction(struct w65c02s_cpu* cpu,
void (*instruction_hook)(void)) {
return w65c02s_hook_end_of_instruction(cpu, instruction_hook);
}
W_EXPORT uint8_t exp_w65c02s_reg_get_a(const struct w65c02s_cpu* cpu) {
return w65c02s_reg_get_a(cpu);
}
W_EXPORT uint8_t exp_w65c02s_reg_get_x(const struct w65c02s_cpu* cpu) {
return w65c02s_reg_get_x(cpu);
}
W_EXPORT uint8_t exp_w65c02s_reg_get_y(const struct w65c02s_cpu* cpu) {
return w65c02s_reg_get_y(cpu);
}
W_EXPORT uint8_t exp_w65c02s_reg_get_p(const struct w65c02s_cpu* cpu) {
return w65c02s_reg_get_p(cpu);
}
W_EXPORT uint8_t exp_w65c02s_reg_get_s(const struct w65c02s_cpu* cpu) {
return w65c02s_reg_get_s(cpu);
}
W_EXPORT uint16_t exp_w65c02s_reg_get_pc(const struct w65c02s_cpu* cpu) {
return w65c02s_reg_get_pc(cpu);
}
W_EXPORT void exp_w65c02s_reg_set_a(struct w65c02s_cpu* cpu, uint8_t value) {
w65c02s_reg_set_a(cpu, value);
}
W_EXPORT void exp_w65c02s_reg_set_x(struct w65c02s_cpu* cpu, uint8_t value) {
w65c02s_reg_set_x(cpu, value);
}
W_EXPORT void exp_w65c02s_reg_set_y(struct w65c02s_cpu* cpu, uint8_t value) {
w65c02s_reg_set_y(cpu, value);
}
W_EXPORT void exp_w65c02s_reg_set_p(struct w65c02s_cpu* cpu, uint8_t value) {
w65c02s_reg_set_p(cpu, value);
}
W_EXPORT void exp_w65c02s_reg_set_s(struct w65c02s_cpu* cpu, uint8_t value) {
w65c02s_reg_set_s(cpu, value);
}
W_EXPORT void exp_w65c02s_reg_set_pc(struct w65c02s_cpu* cpu, uint16_t value) {
w65c02s_reg_set_pc(cpu, value);
}

View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35327.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ziplantil_w65c02s.h", "ziplantil_w65c02s.h.vcxproj", "{A99553CF-EDF3-49D7-B7C9-684957EFFC80}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A99553CF-EDF3-49D7-B7C9-684957EFFC80}.Debug|x64.ActiveCfg = Debug|x64
{A99553CF-EDF3-49D7-B7C9-684957EFFC80}.Debug|x64.Build.0 = Debug|x64
{A99553CF-EDF3-49D7-B7C9-684957EFFC80}.Debug|x86.ActiveCfg = Debug|Win32
{A99553CF-EDF3-49D7-B7C9-684957EFFC80}.Debug|x86.Build.0 = Debug|Win32
{A99553CF-EDF3-49D7-B7C9-684957EFFC80}.Release|x64.ActiveCfg = Release|x64
{A99553CF-EDF3-49D7-B7C9-684957EFFC80}.Release|x64.Build.0 = Release|x64
{A99553CF-EDF3-49D7-B7C9-684957EFFC80}.Release|x86.ActiveCfg = Release|Win32
{A99553CF-EDF3-49D7-B7C9-684957EFFC80}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {90297FEA-61EA-4995-ACCE-21481D9898C4}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" 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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{a99553cf-edf3-49d7-b7c9-684957effc80}</ProjectGuid>
<RootNamespace>ziplantilw65c02sh</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>ziplantil_w65c02s</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<CompileAs>CompileAsC</CompileAs>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ziplantil_w65c02s.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="w65c02s.h\include\w65c02s.h" />
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>