2006-02-25 20:50:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-11-11 21:15:27 +00:00
|
|
|
#include "Common.h"
|
2020-11-27 20:57:35 +00:00
|
|
|
#include "Card.h"
|
2020-11-11 21:15:27 +00:00
|
|
|
|
2017-04-27 16:18:37 +00:00
|
|
|
// Memory Flag
|
|
|
|
#define MF_80STORE 0x00000001
|
|
|
|
#define MF_ALTZP 0x00000002
|
|
|
|
#define MF_AUXREAD 0x00000004 // RAMRD
|
|
|
|
#define MF_AUXWRITE 0x00000008 // RAMWRT
|
2017-04-27 19:33:51 +00:00
|
|
|
#define MF_BANK2 0x00000010 // Language Card Bank 2 $D000..$DFFF
|
|
|
|
#define MF_HIGHRAM 0x00000020 // Language Card RAM is active $D000..$DFFF
|
2017-04-27 16:18:37 +00:00
|
|
|
#define MF_HIRES 0x00000040
|
|
|
|
#define MF_PAGE2 0x00000080
|
|
|
|
#define MF_SLOTC3ROM 0x00000100
|
2018-04-06 21:36:54 +00:00
|
|
|
#define MF_INTCXROM 0x00000200
|
2017-04-27 20:36:33 +00:00
|
|
|
#define MF_WRITERAM 0x00000400 // Language Card RAM is Write Enabled
|
2022-01-15 18:01:41 +00:00
|
|
|
#define MF_IOUDIS 0x00000800 // Disable IOU access for addresses $C058 to $C05F; enable access to DHIRES switch (0=on) (//c only)
|
2020-07-06 19:24:16 +00:00
|
|
|
#define MF_ALTROM0 0x00001000 // Use alternate ROM for $D000 to $FFFF. Two bits for up to 4 pages
|
|
|
|
#define MF_ALTROM1 0x00002000 // Use alternate ROM, second bit to have four pages
|
2017-04-27 16:18:37 +00:00
|
|
|
#define MF_IMAGEMASK 0x000003F7
|
2018-10-26 18:23:30 +00:00
|
|
|
#define MF_LANGCARD_MASK (MF_WRITERAM|MF_HIGHRAM|MF_BANK2)
|
|
|
|
|
2017-04-27 16:18:37 +00:00
|
|
|
|
2008-09-04 16:30:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2009-01-09 23:27:29 +00:00
|
|
|
// Note: All are in bytes!
|
2021-12-19 14:17:51 +00:00
|
|
|
TEXT_PAGE1_BEGIN = 0x0400,
|
|
|
|
|
2008-09-04 16:30:34 +00:00
|
|
|
APPLE_SLOT_SIZE = 0x0100, // 1 page = $Cx00 .. $CxFF (slot 1 .. 7)
|
2021-12-10 19:37:58 +00:00
|
|
|
APPLE_IO_BEGIN = 0xC000,
|
2008-09-04 16:30:34 +00:00
|
|
|
APPLE_SLOT_BEGIN = 0xC100, // each slot has 1 page reserved for it
|
|
|
|
APPLE_SLOT_END = 0xC7FF, //
|
|
|
|
|
|
|
|
FIRMWARE_EXPANSION_SIZE = 0x0800, // 8 pages = $C800 .. $CFFF
|
|
|
|
FIRMWARE_EXPANSION_BEGIN = 0xC800, // [C800,CFFF)
|
2021-12-10 19:37:58 +00:00
|
|
|
FIRMWARE_EXPANSION_END = 0xCFFF, //
|
|
|
|
|
|
|
|
MEMORY_LENGTH = 0x10000
|
2008-09-04 16:30:34 +00:00
|
|
|
};
|
|
|
|
|
2006-03-09 21:10:40 +00:00
|
|
|
enum MemoryInitPattern_e
|
|
|
|
{
|
|
|
|
MIP_ZERO
|
2014-07-18 03:18:59 +00:00
|
|
|
, MIP_RANDOM
|
2006-03-09 21:10:40 +00:00
|
|
|
, MIP_FF_FF_00_00
|
2014-07-18 03:18:59 +00:00
|
|
|
, MIP_FF_00_FULL_PAGE
|
|
|
|
, MIP_00_FF_HALF_PAGE
|
|
|
|
, MIP_FF_00_HALF_PAGE
|
2014-07-18 03:42:19 +00:00
|
|
|
, MIP_PAGE_ADDRESS_LOW
|
|
|
|
, MIP_PAGE_ADDRESS_HIGH
|
2006-03-09 21:10:40 +00:00
|
|
|
, NUM_MIP
|
|
|
|
};
|
|
|
|
|
2018-03-03 21:27:50 +00:00
|
|
|
typedef BYTE (__stdcall *iofunction)(WORD nPC, WORD nAddr, BYTE nWriteFlag, BYTE nWriteValue, ULONG nExecutedCycles);
|
2017-05-13 21:07:53 +00:00
|
|
|
|
2007-05-28 11:16:42 +00:00
|
|
|
extern iofunction IORead[256];
|
|
|
|
extern iofunction IOWrite[256];
|
|
|
|
extern LPBYTE memwrite[0x100];
|
2006-02-25 20:50:29 +00:00
|
|
|
extern LPBYTE mem;
|
|
|
|
extern LPBYTE memdirty;
|
2021-12-19 14:17:51 +00:00
|
|
|
extern LPBYTE memVidHD;
|
2006-02-25 20:50:29 +00:00
|
|
|
|
|
|
|
#ifdef RAMWORKS
|
2015-04-12 16:30:16 +00:00
|
|
|
const UINT kMaxExMemoryBanks = 127; // 127 * aux mem(64K) + main mem(64K) = 8MB
|
2006-02-25 20:50:29 +00:00
|
|
|
#endif
|
|
|
|
|
2007-05-28 11:16:42 +00:00
|
|
|
void RegisterIoHandler(UINT uSlot, iofunction IOReadC0, iofunction IOWriteC0, iofunction IOReadCx, iofunction IOWriteCx, LPVOID lpSlotParameter, BYTE* pExpansionRom);
|
2021-11-01 20:12:42 +00:00
|
|
|
void UnregisterIoHandler(UINT uSlot);
|
2007-05-28 11:16:42 +00:00
|
|
|
|
2006-02-25 20:50:29 +00:00
|
|
|
void MemDestroy ();
|
2017-05-13 21:07:53 +00:00
|
|
|
bool MemCheckSLOTC3ROM();
|
2018-04-06 21:36:54 +00:00
|
|
|
bool MemCheckINTCXROM();
|
2013-07-11 21:21:58 +00:00
|
|
|
LPBYTE MemGetAuxPtr(const WORD);
|
|
|
|
LPBYTE MemGetMainPtr(const WORD);
|
2013-04-26 21:55:45 +00:00
|
|
|
LPBYTE MemGetBankPtr(const UINT nBank);
|
2007-08-06 21:38:35 +00:00
|
|
|
LPBYTE MemGetCxRomPeripheral();
|
2018-03-20 01:49:08 +00:00
|
|
|
DWORD GetMemMode(void);
|
2018-10-26 18:23:30 +00:00
|
|
|
void SetMemMode(DWORD memmode);
|
2018-11-10 10:30:19 +00:00
|
|
|
bool MemOptimizeForModeChanging(WORD programcounter, WORD address);
|
2017-03-10 22:00:01 +00:00
|
|
|
bool MemIsAddrCodeMemory(const USHORT addr);
|
2006-02-25 20:50:29 +00:00
|
|
|
void MemInitialize ();
|
2015-02-13 22:40:53 +00:00
|
|
|
void MemInitializeROM(void);
|
2020-03-25 23:05:02 +00:00
|
|
|
void MemInitializeCustomROM(void);
|
2015-02-13 22:40:53 +00:00
|
|
|
void MemInitializeCustomF8ROM(void);
|
|
|
|
void MemInitializeIO(void);
|
2021-12-23 15:56:14 +00:00
|
|
|
void MemInitializeFromSnapshot(void);
|
2007-08-06 21:38:35 +00:00
|
|
|
BYTE MemReadFloatingBus(const ULONG uExecutedCycles);
|
|
|
|
BYTE MemReadFloatingBus(const BYTE highbit, const ULONG uExecutedCycles);
|
2006-02-25 20:50:29 +00:00
|
|
|
void MemReset ();
|
|
|
|
void MemResetPaging ();
|
2013-09-14 21:46:39 +00:00
|
|
|
void MemUpdatePaging(BOOL initialize);
|
2007-05-28 11:16:42 +00:00
|
|
|
LPVOID MemGetSlotParameters (UINT uSlot);
|
2020-07-07 19:54:46 +00:00
|
|
|
void MemAnnunciatorReset(void);
|
2019-04-06 14:17:18 +00:00
|
|
|
bool MemGetAnnunciator(UINT annunciator);
|
2020-06-10 19:56:00 +00:00
|
|
|
bool MemHasNoSlotClock(void);
|
|
|
|
void MemInsertNoSlotClock(void);
|
|
|
|
void MemRemoveNoSlotClock(void);
|
2022-02-28 20:52:18 +00:00
|
|
|
const std::string& MemGetSnapshotUnitAuxSlotName(void);
|
2015-12-05 16:50:27 +00:00
|
|
|
void MemSaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
|
2019-04-06 14:17:18 +00:00
|
|
|
bool MemLoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT unitVersion);
|
2015-12-05 16:50:27 +00:00
|
|
|
void MemSaveSnapshotAux(class YamlSaveHelper& yamlSaveHelper);
|
2019-04-06 14:17:18 +00:00
|
|
|
bool MemLoadSnapshotAux(class YamlLoadHelper& yamlLoadHelper, UINT unitVersion);
|
2020-06-10 19:56:00 +00:00
|
|
|
void NoSlotClockSaveSnapshot(YamlSaveHelper& yamlSaveHelper);
|
|
|
|
void NoSlotClockLoadSnapshot(YamlLoadHelper& yamlLoadHelper);
|
2006-02-25 20:50:29 +00:00
|
|
|
|
2007-05-28 11:16:42 +00:00
|
|
|
BYTE __stdcall IO_Null(WORD programcounter, WORD address, BYTE write, BYTE value, ULONG nCycles);
|
2006-02-25 20:50:29 +00:00
|
|
|
|
2018-03-03 21:27:50 +00:00
|
|
|
BYTE __stdcall MemSetPaging(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nExecutedCycles);
|
2018-10-26 18:23:30 +00:00
|
|
|
|
2020-11-25 21:57:34 +00:00
|
|
|
BYTE __stdcall IO_F8xx(WORD programcounter, WORD address, BYTE write, BYTE value, ULONG nCycles);
|
|
|
|
|
2018-10-26 18:23:30 +00:00
|
|
|
void SetExpansionMemType(const SS_CARDTYPE type);
|
|
|
|
SS_CARDTYPE GetCurrentExpansionMemType(void);
|
|
|
|
|
|
|
|
void SetRamWorksMemorySize(UINT pages);
|
|
|
|
UINT GetRamWorksActiveBank(void);
|
|
|
|
void SetMemMainLanguageCard(LPBYTE ptr, bool bMemMain=false);
|
2020-02-22 11:38:25 +00:00
|
|
|
|
|
|
|
LPBYTE GetCxRomPeripheral(void);
|