2006-02-25 20:50:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-11-11 21:15:27 +00:00
|
|
|
#include "Common.h"
|
|
|
|
|
2015-02-13 22:40:53 +00:00
|
|
|
struct regsrec
|
|
|
|
{
|
2006-02-25 20:50:29 +00:00
|
|
|
BYTE a; // accumulator
|
|
|
|
BYTE x; // index X
|
|
|
|
BYTE y; // index Y
|
|
|
|
BYTE ps; // processor status
|
|
|
|
WORD pc; // program counter
|
|
|
|
WORD sp; // stack pointer
|
2006-06-11 15:49:38 +00:00
|
|
|
BYTE bJammed; // CPU has crashed (NMOS 6502 only)
|
2015-02-13 22:40:53 +00:00
|
|
|
};
|
2006-02-25 20:50:29 +00:00
|
|
|
|
2021-10-16 10:58:09 +00:00
|
|
|
// 6502 Processor Status flags
|
|
|
|
enum {
|
|
|
|
AF_SIGN = 0x80,
|
|
|
|
AF_OVERFLOW = 0x40,
|
|
|
|
AF_RESERVED = 0x20,
|
|
|
|
AF_BREAK = 0x10,
|
|
|
|
AF_DECIMAL = 0x08,
|
|
|
|
AF_INTERRUPT = 0x04,
|
|
|
|
AF_ZERO = 0x02,
|
|
|
|
AF_CARRY = 0x01
|
|
|
|
};
|
|
|
|
|
2006-02-25 20:50:29 +00:00
|
|
|
extern regsrec regs;
|
|
|
|
extern unsigned __int64 g_nCumulativeCycles;
|
|
|
|
|
|
|
|
void CpuDestroy ();
|
2007-08-06 21:38:35 +00:00
|
|
|
void CpuCalcCycles(ULONG nExecutedCycles);
|
2017-02-25 22:32:46 +00:00
|
|
|
DWORD CpuExecute(const DWORD uCycles, const bool bVideoUpdate);
|
2010-08-17 07:52:23 +00:00
|
|
|
ULONG CpuGetCyclesThisVideoFrame(ULONG nExecutedCycles);
|
2022-02-12 18:42:58 +00:00
|
|
|
void CpuCreateCriticalSection(void);
|
2022-02-12 19:11:34 +00:00
|
|
|
void CpuInitialize(void);
|
2006-02-25 20:50:29 +00:00
|
|
|
void CpuSetupBenchmark ();
|
2006-05-02 21:56:28 +00:00
|
|
|
void CpuIrqReset();
|
|
|
|
void CpuIrqAssert(eIRQSRC Device);
|
|
|
|
void CpuIrqDeassert(eIRQSRC Device);
|
2006-06-11 15:49:38 +00:00
|
|
|
void CpuNmiReset();
|
|
|
|
void CpuNmiAssert(eIRQSRC Device);
|
|
|
|
void CpuNmiDeassert(eIRQSRC Device);
|
|
|
|
void CpuReset ();
|
2015-12-05 16:50:27 +00:00
|
|
|
void CpuSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
2019-11-18 15:08:59 +00:00
|
|
|
void CpuLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT version);
|
2008-08-19 21:36:31 +00:00
|
|
|
|
|
|
|
BYTE CpuRead(USHORT addr, ULONG uExecutedCycles);
|
2020-08-31 09:03:29 +00:00
|
|
|
void CpuWrite(USHORT addr, BYTE value, ULONG uExecutedCycles);
|
2014-09-14 15:12:55 +00:00
|
|
|
|
2016-10-22 22:20:23 +00:00
|
|
|
enum eCpuType {CPU_UNKNOWN=0, CPU_6502=1, CPU_65C02, CPU_Z80}; // Don't change! Persisted to Registry
|
2016-02-14 16:01:30 +00:00
|
|
|
|
|
|
|
eCpuType GetMainCpu(void);
|
|
|
|
void SetMainCpu(eCpuType cpu);
|
|
|
|
eCpuType ProbeMainCpuDefault(eApple2Type apple2Type);
|
|
|
|
void SetMainCpuDefault(eApple2Type apple2Type);
|
|
|
|
eCpuType GetActiveCpu(void);
|
|
|
|
void SetActiveCpu(eCpuType cpu);
|
2019-09-06 18:59:28 +00:00
|
|
|
|
2021-01-31 19:38:06 +00:00
|
|
|
bool IsIrqAsserted(void);
|
2019-09-06 18:59:28 +00:00
|
|
|
bool Is6502InterruptEnabled(void);
|
2019-09-21 15:37:45 +00:00
|
|
|
void ResetCyclesExecutedForDebugger(void);
|
2021-10-16 15:57:00 +00:00
|
|
|
bool IsInterruptInLastExecution(void);
|
2023-02-05 11:02:56 +00:00
|
|
|
void SetIrqOnLastOpcodeCycle(void);
|