m6809 intf, remove readop/readoparg handlers - now points to main handler.

This commit is contained in:
dinkc64 2022-09-17 22:51:41 -04:00
parent e72ea20f53
commit 37546ff0c4
6 changed files with 6 additions and 58 deletions

View File

@ -1117,11 +1117,7 @@ INT32 TUnitInit()
M6809Open(0);
M6809MapMemory(DrvSoundProgRAM, 0x0000, 0x1fff, MAP_RAM);
MKsound_bankswitch(0);
// _all_ ROM is dished out in the handler, had to do it this way
// because of the hidden prot ram. (and the separate op/oparg/read handlers..)
M6809SetReadHandler(MKSoundRead);
M6809SetReadOpHandler(MKSoundRead);
M6809SetReadOpArgHandler(MKSoundRead);
M6809SetWriteHandler(MKSoundWrite);
M6809Close();

View File

@ -203,8 +203,6 @@ void williams_cvsd_init(UINT8 *prgrom, INT32 prot_start, INT32 prot_end, INT32 s
bankswitch(0);
M6809SetWriteHandler(cvsd_write);
M6809SetReadHandler(cvsd_read);
M6809SetReadOpHandler(cvsd_read); // rom dished out in read handler!
M6809SetReadOpArgHandler(cvsd_read); // ""
M6809Close();
pia_init();

View File

@ -1634,16 +1634,12 @@ static INT32 DrvInit()
M6809Open(0);
M6809SetWriteHandler(main_write);
M6809SetReadHandler(main_read);
M6809SetReadOpHandler(main_read);
M6809SetReadOpArgHandler(main_read);
M6809Close();
M6809Init(1);
M6809Open(1);
M6809SetWriteHandler(sub_write);
M6809SetReadHandler(sub_read);
M6809SetReadOpHandler(sub_read);
M6809SetReadOpArgHandler(sub_read);
M6809Close();
M6809Init(2);

View File

@ -922,8 +922,6 @@ static INT32 DrvInit(INT32 game_select)
M6809SetWriteHandler(starwars_main_write);
M6809SetReadHandler(starwars_main_read);
M6809SetReadOpHandler(starwars_main_read);
M6809SetReadOpArgHandler(starwars_main_read);
M6809Close();
M6809Init(1);

View File

@ -37,16 +37,6 @@ static void M6809WriteByteDummyHandler(UINT16, UINT8)
{
}
static UINT8 M6809ReadOpDummyHandler(UINT16)
{
return 0;
}
static UINT8 M6809ReadOpArgDummyHandler(UINT16)
{
return 0;
}
// ## M6809CPUPush() / M6809CPUPop() ## internal helpers for sending signals to other m6809's
struct m6809pstack {
INT32 nHostCPU;
@ -224,8 +214,6 @@ INT32 M6809Init(INT32 cpu)
for (INT32 i = 0; i < MAX_CPU; i++) {
m6809CPUContext[i].ReadByte = M6809ReadByteDummyHandler;
m6809CPUContext[i].WriteByte = M6809WriteByteDummyHandler;
m6809CPUContext[i].ReadOp = M6809ReadOpDummyHandler;
m6809CPUContext[i].ReadOpArg = M6809ReadOpArgDummyHandler;
m6809CPUContext[i].nCyclesTotal = 0;
for (INT32 j = 0; j < (0x0100 * 3); j++) {
@ -238,8 +226,6 @@ INT32 M6809Init(INT32 cpu)
m6809CPUContext[cpu].ReadByte = M6809ReadByteDummyHandler;
m6809CPUContext[cpu].WriteByte = M6809WriteByteDummyHandler;
m6809CPUContext[cpu].ReadOp = M6809ReadOpDummyHandler;
m6809CPUContext[cpu].ReadOpArg = M6809ReadOpArgDummyHandler;
CpuCheatRegister(cpu, &M6809Config);
@ -446,26 +432,6 @@ void M6809SetWriteHandler(void (*pHandler)(UINT16, UINT8))
m6809CPUContext[nActiveCPU].WriteByte = pHandler;
}
void M6809SetReadOpHandler(UINT8 (*pHandler)(UINT16))
{
#if defined FBNEO_DEBUG
if (!DebugCPU_M6809Initted) bprintf(PRINT_ERROR, _T("M6809SetReadOpHandler called without init\n"));
if (nActiveCPU == -1) bprintf(PRINT_ERROR, _T("M6809SetReadOpHandler called when no CPU open\n"));
#endif
m6809CPUContext[nActiveCPU].ReadOp = pHandler;
}
void M6809SetReadOpArgHandler(UINT8 (*pHandler)(UINT16))
{
#if defined FBNEO_DEBUG
if (!DebugCPU_M6809Initted) bprintf(PRINT_ERROR, _T("M6809SetReadOpArgHandler called without init\n"));
if (nActiveCPU == -1) bprintf(PRINT_ERROR, _T("M6809SetReadOpArgHandler called when no CPU open\n"));
#endif
m6809CPUContext[nActiveCPU].ReadOpArg = pHandler;
}
UINT8 M6809ReadByte(UINT16 Address)
{
// check mem map
@ -507,8 +473,8 @@ UINT8 M6809ReadOp(UINT16 Address)
}
// check handler
if (m6809CPUContext[nActiveCPU].ReadOp != NULL) {
return m6809CPUContext[nActiveCPU].ReadOp(Address);
if (m6809CPUContext[nActiveCPU].ReadByte != NULL) {
return m6809CPUContext[nActiveCPU].ReadByte(Address);
}
return 0;
@ -523,8 +489,8 @@ UINT8 M6809ReadOpArg(UINT16 Address)
}
// check handler
if (m6809CPUContext[nActiveCPU].ReadOpArg != NULL) {
return m6809CPUContext[nActiveCPU].ReadOpArg(Address);
if (m6809CPUContext[nActiveCPU].ReadByte != NULL) {
return m6809CPUContext[nActiveCPU].ReadByte(Address);
}
return 0;

View File

@ -2,20 +2,16 @@
typedef UINT8 (*pReadByteHandler)(UINT16 a);
typedef void (*pWriteByteHandler)(UINT16 a, UINT8 d);
typedef UINT8 (*pReadOpHandler)(UINT16 a);
typedef UINT8 (*pReadOpArgHandler)(UINT16 a);
struct M6809Ext {
m6809_Regs reg;
UINT8* pMemMap[0x100 * 3];
pReadByteHandler ReadByte;
pWriteByteHandler WriteByte;
pReadOpHandler ReadOp;
pReadOpArgHandler ReadOpArg;
INT32 nCyclesTotal;
};
@ -42,8 +38,6 @@ INT32 M6809MapMemory(UINT8* pMemory, UINT16 nStart, UINT16 nEnd, INT32 nType);
INT32 M6809UnmapMemory(UINT16 nStart, UINT16 nEnd, INT32 nType);
void M6809SetReadHandler(UINT8 (*pHandler)(UINT16));
void M6809SetWriteHandler(void (*pHandler)(UINT16, UINT8));
void M6809SetReadOpHandler(UINT8 (*pHandler)(UINT16));
void M6809SetReadOpArgHandler(UINT8 (*pHandler)(UINT16));
INT32 M6809Scan(INT32 nAction);
UINT16 M6809GetPC();
UINT16 M6809GetPrevPC();