Move 1KiB mem from $0000 to $0400 (WIP - 1.07 OK, but crashes in a2audit 1.06)

Add JSR_ALT (from completeness)
This commit is contained in:
tomcw
2025-03-10 07:40:08 +00:00
parent f087f7152c
commit 24f832a59f
5 changed files with 23 additions and 6 deletions
+3
View File
@@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef CPU_ALT
//#define READ _READ
//#define WRITE(value) _WRITE(value)
#define JSR _JSR
#define POP _POP
#define PUSH(value) _PUSH(value)
#define ABS _ABS
@@ -47,6 +48,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#else
//#define READ _READ_ALT
//#define WRITE(value) _WRITE_ALT(value)
#define JSR _JSR_ALT
#define POP _POP_ALT
#define PUSH(value) _PUSH_ALT(value)
#define ABS _ABS_ALT
@@ -391,6 +393,7 @@ static uint32_t Cpu6502(uint32_t uTotalCycles, const bool bVideoUpdate)
#undef READ
#undef WRITE
#undef JSR
#undef POP
#undef PUSH
#undef ABS
+3
View File
@@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef CPU_ALT
//#define READ _READ
//#define WRITE(value) _WRITE(value)
#define JSR _JSR
#define POP _POP
#define PUSH(value) _PUSH(value)
#define ABS _ABS
@@ -47,6 +48,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#else
//#define READ _READ_ALT
//#define WRITE(value) _WRITE_ALT(value)
#define JSR _JSR_ALT
#define POP _POP_ALT
#define PUSH(value) _PUSH_ALT(value)
#define ABS _ABS_ALT
@@ -391,6 +393,7 @@ static uint32_t Cpu65C02(uint32_t uTotalCycles, const bool bVideoUpdate)
#undef READ
#undef WRITE
#undef JSR
#undef POP
#undef PUSH
#undef ABS
+2 -2
View File
@@ -81,7 +81,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(memreadPageType[addr >> 8] == MEM_Normal) \
? *(mem+addr) \
: (memreadPageType[addr >> 8] == MEM_Aux1K) \
? *(memaux+(addr&(TEXT_PAGE1_SIZE-1))) \
? *(memaux+TEXT_PAGE1_BEGIN+(addr&(TEXT_PAGE1_SIZE-1))) \
: (memreadPageType[addr >> 8] == MEM_IORead) \
? IORead[(addr >> 4) & 0xFF](regs.pc, addr, 0, 0, uExecutedCycles) \
: MemReadFloatingBus(uExecutedCycles) \
@@ -161,7 +161,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define CHECK_PAGE_CHANGE if ((base ^ addr) & 0xFF00) \
uExtraCycles=1;
#define READ_AUX1K_BYTE(pc) (*(memaux+(pc&(TEXT_PAGE1_SIZE-1))))
#define READ_AUX1K_BYTE(pc) (*(memaux+TEXT_PAGE1_BEGIN+(pc&(TEXT_PAGE1_SIZE-1))))
#define READ_AUX1K_WORD(pc) (READ_AUX1K_BYTE(pc) | (READ_AUX1K_BYTE(pc+1)<<8))
/****************************************************************************
+12 -1
View File
@@ -400,10 +400,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define INY ++regs.y; \
SETNZ(regs.y)
#define JMP regs.pc = addr;
#define JSR addr = *(LPBYTE)(mem+regs.pc); regs.pc++; \
#define _JSR addr = *(LPBYTE)(mem+regs.pc); regs.pc++; \
PUSH(regs.pc >> 8) \
PUSH(regs.pc & 0xFF) \
regs.pc = addr | (*(LPBYTE)(mem+regs.pc)) << 8; /* GH#1257 */
#define _JSR_ALT \
if (memreadPageType[regs.pc >> 8] != MEM_Aux1K) { \
_JSR; \
} \
else { \
addr = READ_AUX1K_BYTE(regs.pc); \
regs.pc++; \
PUSH(regs.pc >> 8) \
PUSH(regs.pc & 0xFF) \
regs.pc = addr | READ_AUX1K_BYTE(regs.pc) << 8; /* GH#1257 */\
}
#define LAS /*bSlowerOnPagecross = 1*/; \
val = (BYTE)(READ & regs.sp); \
regs.a = regs.x = (BYTE) val; \
+3 -3
View File
@@ -1369,7 +1369,7 @@ static void UpdatePagingForAltRW(void)
{
// Map all aux writes into the 1K memory
const uint32_t kBase = 0x0000;
const uint32_t kBase = TEXT_PAGE1_BEGIN;
if (SW_ALTZP)
for (loop = 0x00; loop < 0x02; loop++)
@@ -1483,8 +1483,8 @@ LPBYTE MemGetAuxPtr(const WORD offset)
{
// For the 1KiB 80-col card, the 1KiB is at offset 0x0000 - so mask offset for 80COL video
// But for this card, SHR video still starts at offset 0x2000
if (GetCardMgr().QueryAux() == CT_80Col && !GetVideo().VideoGetSWSHR())
return memaux + (offset&(TEXT_PAGE1_SIZE-1));
// if (GetCardMgr().QueryAux() == CT_80Col && !GetVideo().VideoGetSWSHR())
// return memaux + (offset&(TEXT_PAGE1_SIZE-1));
LPBYTE lpMem = (memshadow[(offset >> 8)] == (memaux+(offset & 0xFF00)))
? mem+offset // Return 'mem' copy if possible, as page could be dirty