mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-21 23:16:39 +00:00
Removed 65d02 and used the regular 65c02/6502 headers instead (PR #825)
Removed 65d02.h and reconstructed this code using a combination of existing 6502.h/65c02.h and extra C Pre-Processor macros to include (or omit) the extra heatmap functionality. We still end up with a normal 65c02 instance and also a debug 65c02 instance, but both will derive from the same 65c02.h file (+ same for the 6502 normal/debug instances). Also: . Added cpu_heatmap.inl for the built-in debugger's read/write operations. . Support CpuRead/Write() from Z80 to hook the heatmap r/w.
This commit is contained in:
+68
-21
@@ -214,13 +214,8 @@ void SetMouseCardInstalled(bool installed)
|
||||
//
|
||||
|
||||
#include "CPU/cpu_general.inl"
|
||||
|
||||
#include "CPU/cpu_instructions.inl"
|
||||
|
||||
// Break into debugger on invalid opcodes
|
||||
//#define INV IsDebugBreakOnInvalid(AM_1);
|
||||
#define INV
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* OPCODE TABLE
|
||||
@@ -275,18 +270,6 @@ static __forceinline void DoIrqProfiling(DWORD uCycles)
|
||||
|
||||
//===========================================================================
|
||||
|
||||
BYTE CpuRead(USHORT addr, ULONG uExecutedCycles)
|
||||
{
|
||||
return READ;
|
||||
}
|
||||
|
||||
void CpuWrite(USHORT addr, BYTE a, ULONG uExecutedCycles)
|
||||
{
|
||||
WRITE(a);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
#ifdef USE_SPEECH_API
|
||||
|
||||
const USHORT COUT = 0xFDED;
|
||||
@@ -487,18 +470,57 @@ void CpuAdjustIrqCheck(UINT uCyclesUntilInterrupt)
|
||||
|
||||
//===========================================================================
|
||||
|
||||
#define READ _READ
|
||||
#define WRITE(value) _WRITE(value)
|
||||
#define HEATMAP_X(address)
|
||||
|
||||
#include "CPU/cpu6502.h" // MOS 6502
|
||||
#include "CPU/cpu65C02.h" // WDC 65C02
|
||||
#include "CPU/cpu65d02.h" // Debug CPU Memory Visualizer
|
||||
|
||||
#undef READ
|
||||
#undef WRITE
|
||||
#undef HEATMAP_X
|
||||
|
||||
//-----------------
|
||||
|
||||
#define READ Heatmap_ReadByte(addr, uExecutedCycles)
|
||||
#define WRITE(value) Heatmap_WriteByte(addr, value, uExecutedCycles);
|
||||
|
||||
#define HEATMAP_X(address) Heatmap_X(address)
|
||||
|
||||
#include "CPU/cpu_heatmap.inl"
|
||||
|
||||
#define Cpu6502 Cpu6502_debug
|
||||
#include "CPU/cpu6502.h" // MOS 6502
|
||||
#undef Cpu6502
|
||||
|
||||
#define Cpu65C02 Cpu65C02_debug
|
||||
#include "CPU/cpu65C02.h" // WDC 65C02
|
||||
#undef Cpu65C02
|
||||
|
||||
#undef READ
|
||||
#undef WRITE
|
||||
#undef HEATMAP_X
|
||||
|
||||
//===========================================================================
|
||||
|
||||
static DWORD InternalCpuExecute(const DWORD uTotalCycles, const bool bVideoUpdate)
|
||||
{
|
||||
if (GetMainCpu() == CPU_6502)
|
||||
return Cpu6502(uTotalCycles, bVideoUpdate); // Apple ][, ][+, //e, Clones
|
||||
if (g_nAppMode == MODE_RUNNING)
|
||||
{
|
||||
if (GetMainCpu() == CPU_6502)
|
||||
return Cpu6502(uTotalCycles, bVideoUpdate); // Apple ][, ][+, //e, Clones
|
||||
else
|
||||
return Cpu65C02(uTotalCycles, bVideoUpdate); // Enhanced Apple //e
|
||||
}
|
||||
else
|
||||
return Cpu65C02(uTotalCycles, bVideoUpdate); // Enhanced Apple //e
|
||||
{
|
||||
_ASSERT(g_nAppMode == MODE_STEPPING || g_nAppMode == MODE_DEBUG);
|
||||
if (GetMainCpu() == CPU_6502)
|
||||
return Cpu6502_debug(uTotalCycles, bVideoUpdate); // Apple ][, ][+, //e, Clones
|
||||
else
|
||||
return Cpu65C02_debug(uTotalCycles, bVideoUpdate); // Enhanced Apple //e
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -507,6 +529,31 @@ static DWORD InternalCpuExecute(const DWORD uTotalCycles, const bool bVideoUpdat
|
||||
|
||||
//===========================================================================
|
||||
|
||||
// Called by z80_RDMEM()
|
||||
BYTE CpuRead(USHORT addr, ULONG uExecutedCycles)
|
||||
{
|
||||
if (g_nAppMode == MODE_RUNNING)
|
||||
{
|
||||
return _READ;
|
||||
}
|
||||
|
||||
return Heatmap_ReadByte(addr, uExecutedCycles);
|
||||
}
|
||||
|
||||
// Called by z80_WRMEM()
|
||||
void CpuWrite(USHORT addr, BYTE value, ULONG uExecutedCycles)
|
||||
{
|
||||
if (g_nAppMode == MODE_RUNNING)
|
||||
{
|
||||
_WRITE(value);
|
||||
return;
|
||||
}
|
||||
|
||||
Heatmap_WriteByte(addr, value, uExecutedCycles);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
void CpuDestroy ()
|
||||
{
|
||||
if (g_bCritSectionValid)
|
||||
|
||||
Reference in New Issue
Block a user