Skip to content

Commit

Permalink
Added SMS/GG/SG-1000 support
Browse files Browse the repository at this point in the history
  • Loading branch information
SourMesen committed Dec 14, 2023
1 parent 0019f6b commit 5308983
Show file tree
Hide file tree
Showing 198 changed files with 13,478 additions and 439 deletions.
51 changes: 49 additions & 2 deletions Core/Core.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Debugger\AddressInfo.h" />
<ClInclude Include="Debugger\Base6502Assembler.h" />
<ClInclude Include="Debugger\CdlManager.h" />
<ClInclude Include="Debugger\DisassemblySearch.h" />
Expand All @@ -30,10 +31,38 @@
<ClInclude Include="Gameboy\Carts\GbMbc7.h" />
<ClInclude Include="NES\HdPacks\HdBuilderPpu.h" />
<ClInclude Include="NES\HdPacks\HdPackBuilder.h" />
<ClInclude Include="NES\Mappers\Audio\emu2413.h" />
<ClInclude Include="Shared\ColorUtilities.h" />
<ClInclude Include="Shared\Utilities\emu2413.h" />
<ClInclude Include="NES\Mappers\Nintendo\FnsMmc1.h" />
<ClInclude Include="Shared\SaveStateCompatInfo.h" />
<ClInclude Include="Shared\Utilities\Emu2413Serializer.h" />
<ClInclude Include="Shared\Video\SoftwareRenderer.h" />
<ClInclude Include="SMS\Carts\SmsCodemasterCart.h" />
<ClInclude Include="SMS\Carts\SmsNemesisCart.h" />
<ClInclude Include="SMS\Carts\SmsKoreanCart.h" />
<ClInclude Include="SMS\Carts\SmsMsxCart.h" />
<ClInclude Include="SMS\Carts\SmsSegaCart.h" />
<ClInclude Include="SMS\Carts\SmsCart.h" />
<ClInclude Include="SMS\Debugger\DummySmsCpu.h" />
<ClInclude Include="SMS\Debugger\SmsAssembler.h" />
<ClInclude Include="SMS\Debugger\SmsDebugger.h" />
<ClInclude Include="SMS\Debugger\SmsDisUtils.h" />
<ClInclude Include="SMS\Debugger\SmsEventManager.h" />
<ClInclude Include="SMS\Debugger\SmsTraceLogger.h" />
<ClInclude Include="SMS\Debugger\SmsVdpTools.h" />
<ClInclude Include="SMS\Input\SmsController.h" />
<ClInclude Include="SMS\Input\SmsLightPhaser.h" />
<ClInclude Include="SMS\SmsBiosMapper.h" />
<ClInclude Include="SMS\SmsConsole.h" />
<ClInclude Include="SMS\SmsControlManager.h" />
<ClInclude Include="SMS\SmsCpu.h" />
<ClInclude Include="SMS\SmsDefaultVideoFilter.h" />
<ClInclude Include="SMS\SmsFmAudio.h" />
<ClInclude Include="SMS\SmsMemoryManager.h" />
<ClInclude Include="SMS\SmsNtscFilter.h" />
<ClInclude Include="SMS\SmsPsg.h" />
<ClInclude Include="SMS\SmsTypes.h" />
<ClInclude Include="SMS\SmsVdp.h" />
<ClInclude Include="SNES\DSP\DspInterpolation.h" />
<ClInclude Include="SNES\DSP\Dsp.h" />
<ClInclude Include="NES\Debugger\NesCodeDataLogger.h" />
Expand Down Expand Up @@ -692,6 +721,7 @@
<ClCompile Include="Debugger\ExpressionEvaluator.NecDsp.cpp" />
<ClCompile Include="Debugger\ExpressionEvaluator.Nes.cpp" />
<ClCompile Include="Debugger\ExpressionEvaluator.Pce.cpp" />
<ClCompile Include="Debugger\ExpressionEvaluator.Sms.cpp" />
<ClCompile Include="Debugger\ExpressionEvaluator.Snes.cpp" />
<ClCompile Include="Debugger\ExpressionEvaluator.Spc.cpp" />
<ClCompile Include="Debugger\StepBackManager.cpp" />
Expand Down Expand Up @@ -722,7 +752,7 @@
<ClCompile Include="NES\APU\BaseExpansionAudio.cpp" />
<ClCompile Include="NES\Loaders\StudyBoxLoader.cpp" />
<ClCompile Include="NES\Loaders\UnifLoader.cpp" />
<ClCompile Include="NES\Mappers\Audio\emu2413.cpp">
<ClCompile Include="Shared\Utilities\emu2413.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='PGO Profile|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
Expand Down Expand Up @@ -784,6 +814,23 @@
<ClCompile Include="Shared\Video\RotateFilter.cpp" />
<ClCompile Include="Shared\Video\SoftwareRenderer.cpp" />
<ClCompile Include="Shared\Video\SystemHud.cpp" />
<ClCompile Include="SMS\Carts\SmsCart.cpp" />
<ClCompile Include="SMS\Debugger\DummySmsCpu.cpp" />
<ClCompile Include="SMS\Debugger\SmsAssembler.cpp" />
<ClCompile Include="SMS\Debugger\SmsDebugger.cpp" />
<ClCompile Include="SMS\Debugger\SmsDisUtils.cpp" />
<ClCompile Include="SMS\Debugger\SmsEventManager.cpp" />
<ClCompile Include="SMS\Debugger\SmsTraceLogger.cpp" />
<ClCompile Include="SMS\Debugger\SmsVdpTools.cpp" />
<ClCompile Include="SMS\SmsBiosMapper.cpp" />
<ClCompile Include="SMS\SmsConsole.cpp" />
<ClCompile Include="SMS\SmsControlManager.cpp" />
<ClCompile Include="SMS\SmsCpu.cpp" />
<ClCompile Include="SMS\SmsFmAudio.cpp" />
<ClCompile Include="SMS\SmsMemoryManager.cpp" />
<ClCompile Include="SMS\SmsNtscFilter.cpp" />
<ClCompile Include="SMS\SmsPsg.cpp" />
<ClCompile Include="SMS\SmsVdp.cpp" />
<ClCompile Include="SNES\AluMulDiv.cpp" />
<ClCompile Include="SNES\Debugger\DummySnesCpu.cpp" />
<ClCompile Include="SNES\Debugger\DummySpc.cpp" />
Expand Down
168 changes: 162 additions & 6 deletions Core/Core.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -2601,9 +2601,6 @@
<ClInclude Include="Shared\DebuggerRequest.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="NES\Mappers\Audio\emu2413.h">
<Filter>NES\Mappers\Audio</Filter>
</ClInclude>
<ClInclude Include="NES\HdPacks\HdBuilderPpu.h">
<Filter>NES\HdPacks</Filter>
</ClInclude>
Expand Down Expand Up @@ -2631,6 +2628,96 @@
<ClInclude Include="NES\Mappers\Nintendo\FnsMmc1.h">
<Filter>NES\Mappers\Nintendo</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsConsole.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsDefaultVideoFilter.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsControlManager.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsCpu.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsMemoryManager.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsVdp.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsTypes.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\Debugger\SmsDebugger.h">
<Filter>SMS\Debugger</Filter>
</ClInclude>
<ClInclude Include="SMS\Debugger\DummySmsCpu.h">
<Filter>SMS\Debugger</Filter>
</ClInclude>
<ClInclude Include="SMS\Debugger\SmsAssembler.h">
<Filter>SMS\Debugger</Filter>
</ClInclude>
<ClInclude Include="SMS\Debugger\SmsDisUtils.h">
<Filter>SMS\Debugger</Filter>
</ClInclude>
<ClInclude Include="SMS\Debugger\SmsTraceLogger.h">
<Filter>SMS\Debugger</Filter>
</ClInclude>
<ClInclude Include="SMS\Debugger\SmsEventManager.h">
<Filter>SMS\Debugger</Filter>
</ClInclude>
<ClInclude Include="SMS\Debugger\SmsVdpTools.h">
<Filter>SMS\Debugger</Filter>
</ClInclude>
<ClInclude Include="SMS\Carts\SmsCart.h">
<Filter>SMS\Carts</Filter>
</ClInclude>
<ClInclude Include="SMS\Carts\SmsSegaCart.h">
<Filter>SMS\Carts</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsPsg.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\Input\SmsController.h">
<Filter>SMS\Input</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsNtscFilter.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="SMS\Carts\SmsCodemasterCart.h">
<Filter>SMS\Carts</Filter>
</ClInclude>
<ClInclude Include="Debugger\AddressInfo.h">
<Filter>Debugger</Filter>
</ClInclude>
<ClInclude Include="SMS\Input\SmsLightPhaser.h">
<Filter>SMS\Input</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsFmAudio.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="Shared\Utilities\Emu2413Serializer.h">
<Filter>Shared\Utilities</Filter>
</ClInclude>
<ClInclude Include="Shared\Utilities\emu2413.h">
<Filter>Shared\Utilities</Filter>
</ClInclude>
<ClInclude Include="SMS\SmsBiosMapper.h">
<Filter>SMS</Filter>
</ClInclude>
<ClInclude Include="Shared\ColorUtilities.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="SMS\Carts\SmsMsxCart.h">
<Filter>SMS\Carts</Filter>
</ClInclude>
<ClInclude Include="SMS\Carts\SmsKoreanCart.h">
<Filter>SMS\Carts</Filter>
</ClInclude>
<ClInclude Include="SMS\Carts\SmsNemesisCart.h">
<Filter>SMS\Carts</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Shared\Video\RotateFilter.cpp">
Expand Down Expand Up @@ -2759,15 +2846,69 @@
<ClCompile Include="Shared\DebuggerRequest.cpp">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="NES\Mappers\Audio\emu2413.cpp">
<Filter>NES\Mappers\Audio</Filter>
</ClCompile>
<ClCompile Include="NES\HdPacks\HdPackBuilder.cpp">
<Filter>NES\HdPacks</Filter>
</ClCompile>
<ClCompile Include="Shared\Video\SoftwareRenderer.cpp">
<Filter>Shared\Video</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsConsole.cpp">
<Filter>SMS</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsCpu.cpp">
<Filter>SMS</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsControlManager.cpp">
<Filter>SMS</Filter>
</ClCompile>
<ClCompile Include="SMS\Debugger\SmsDebugger.cpp">
<Filter>SMS\Debugger</Filter>
</ClCompile>
<ClCompile Include="SMS\Debugger\DummySmsCpu.cpp">
<Filter>SMS\Debugger</Filter>
</ClCompile>
<ClCompile Include="SMS\Debugger\SmsAssembler.cpp">
<Filter>SMS\Debugger</Filter>
</ClCompile>
<ClCompile Include="SMS\Debugger\SmsDisUtils.cpp">
<Filter>SMS\Debugger</Filter>
</ClCompile>
<ClCompile Include="SMS\Debugger\SmsTraceLogger.cpp">
<Filter>SMS\Debugger</Filter>
</ClCompile>
<ClCompile Include="SMS\Debugger\SmsEventManager.cpp">
<Filter>SMS\Debugger</Filter>
</ClCompile>
<ClCompile Include="SMS\Debugger\SmsVdpTools.cpp">
<Filter>SMS\Debugger</Filter>
</ClCompile>
<ClCompile Include="Debugger\ExpressionEvaluator.Sms.cpp">
<Filter>Debugger</Filter>
</ClCompile>
<ClCompile Include="SMS\Carts\SmsCart.cpp">
<Filter>SMS\Carts</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsVdp.cpp">
<Filter>SMS</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsNtscFilter.cpp">
<Filter>SMS</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsPsg.cpp">
<Filter>SMS</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsMemoryManager.cpp">
<Filter>SMS</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsFmAudio.cpp">
<Filter>SMS</Filter>
</ClCompile>
<ClCompile Include="Shared\Utilities\emu2413.cpp">
<Filter>Shared\Utilities</Filter>
</ClCompile>
<ClCompile Include="SMS\SmsBiosMapper.cpp">
<Filter>SMS</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="PCE">
Expand Down Expand Up @@ -2842,5 +2983,20 @@
<Filter Include="NES\Mappers\NSF">
<UniqueIdentifier>{a27bca76-05ce-4940-a583-d50aef2668f8}</UniqueIdentifier>
</Filter>
<Filter Include="SMS">
<UniqueIdentifier>{418fea7a-2766-464e-a553-e0647531fca2}</UniqueIdentifier>
</Filter>
<Filter Include="SMS\Debugger">
<UniqueIdentifier>{21c80d33-0dc1-40df-9182-68fc4454d2f6}</UniqueIdentifier>
</Filter>
<Filter Include="SMS\Carts">
<UniqueIdentifier>{ecb64e96-ce0e-4b2e-a232-61b6c441f72b}</UniqueIdentifier>
</Filter>
<Filter Include="SMS\Input">
<UniqueIdentifier>{29ab9afb-6064-4e72-9652-6a0affa636e1}</UniqueIdentifier>
</Filter>
<Filter Include="Shared\Utilities">
<UniqueIdentifier>{9c5b1b92-fa62-42bf-9102-9cc5d35262b8}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
10 changes: 10 additions & 0 deletions Core/Debugger/AddressInfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once
#include "pch.h"

enum class MemoryType;

struct AddressInfo
{
int32_t Address;
MemoryType Type;
};
7 changes: 4 additions & 3 deletions Core/Debugger/BaseEventManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
enum class EventFlags
{
PreviousFrame = 1,
NesPpuFirstWrite = 2,
NesPpuSecondWrite = 4,
WithTargetMemory = 8
RegFirstWrite = 2,
RegSecondWrite = 4,
WithTargetMemory = 8,
SmsVdpPaletteWrite = 16
};

struct DebugEventInfo
Expand Down
24 changes: 19 additions & 5 deletions Core/Debugger/BaseTraceLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,24 @@ enum class RowDataType
E,
F,
H,
I,
K,
L,
M,
N,
R,
X,
Y,
AltA,
AltB,
AltC,
AltD,
AltE,
AltF,
AltH,
AltL,
IX,
IY,
DB,
SP,
PS,
Expand Down Expand Up @@ -174,25 +186,27 @@ class BaseTraceLogger : public ITraceLogger
void WriteEffectiveAddress(DisassemblyInfo& info, RowPart& rowPart, void* cpuState, string& output, MemoryType cpuMemoryType, CpuType cpuType)
{
EffectiveAddressInfo effectiveAddress = info.GetEffectiveAddress(_debugger, cpuState, cpuType);
if(effectiveAddress.ShowAddress && effectiveAddress.Address >= 0) {
if(effectiveAddress.ShowAddress && effectiveAddress.Address.Address >= 0) {
MemoryType effectiveMemType = effectiveAddress.Address.Type == MemoryType::None ? cpuMemoryType : effectiveAddress.Address.Type;
if(_options.UseLabels) {
AddressInfo addr { effectiveAddress.Address, cpuMemoryType };
AddressInfo addr { effectiveAddress.Address.Address, effectiveMemType };
string label = _labelManager->GetLabel(addr);
if(!label.empty()) {
WriteStringValue(output, " [" + label + "]", rowPart);
return;
}
}

WriteStringValue(output, " [$" + DebugUtilities::AddressToHex(cpuType, effectiveAddress.Address) + "]", rowPart);
WriteStringValue(output, " [$" + DebugUtilities::AddressToHex(cpuType, effectiveAddress.Address.Address) + "]", rowPart);
}
}

void WriteMemoryValue(DisassemblyInfo& info, RowPart& rowPart, void* cpuState, string& output, MemoryType memType, CpuType cpuType)
{
EffectiveAddressInfo effectiveAddress = info.GetEffectiveAddress(_debugger, cpuState, cpuType);
if(effectiveAddress.Address >= 0 && effectiveAddress.ValueSize > 0) {
uint16_t value = info.GetMemoryValue(effectiveAddress, _memoryDumper, memType);
if(effectiveAddress.Address.Address >= 0 && effectiveAddress.ValueSize > 0) {
MemoryType effectiveMemType = effectiveAddress.Address.Type == MemoryType::None ? memType : effectiveAddress.Address.Type;
uint16_t value = info.GetMemoryValue(effectiveAddress, _memoryDumper, effectiveMemType);
if(rowPart.DisplayInHex) {
output += "= $";
if(effectiveAddress.ValueSize == 2) {
Expand Down
Loading

0 comments on commit 5308983

Please sign in to comment.