HD6309 - Change so that each cpu is initialized separately. All hd6309 games ahve been tested.
This commit is contained in:
parent
f9fba7e5cf
commit
ef4a814ee2
|
@ -1317,7 +1317,7 @@ static INT32 DrvInit()
|
|||
DrvGfxDecode();
|
||||
}
|
||||
|
||||
HD6309Init(1);
|
||||
HD6309Init(0);
|
||||
HD6309Open(0);
|
||||
HD6309MapMemory(DrvMainRAM, 0x0000, 0x17ff, HD6309_RAM);
|
||||
HD6309MapMemory(DrvVidRAM, 0x1800, 0x1fff, HD6309_RAM);
|
||||
|
@ -3398,7 +3398,7 @@ static INT32 GondoInit()
|
|||
GondoGfxDecode();
|
||||
}
|
||||
|
||||
HD6309Init(1);
|
||||
HD6309Init(0);
|
||||
HD6309Open(0);
|
||||
HD6309MapMemory(DrvMainRAM, 0x0000, 0x17ff, HD6309_RAM);
|
||||
HD6309MapMemory(DrvVidRAM, 0x1800, 0x1fff, HD6309_RAM);
|
||||
|
@ -4002,7 +4002,7 @@ static INT32 OscarInit()
|
|||
OscarGfxDecode();
|
||||
}
|
||||
|
||||
HD6309Init(2);
|
||||
HD6309Init(0);
|
||||
HD6309Open(0);
|
||||
HD6309MapMemory(DrvMainRAM, 0x0000, 0x1fff, HD6309_RAM); // all shared?
|
||||
HD6309MapMemory(DrvVidRAM, 0x2000, 0x28ff, HD6309_RAM);
|
||||
|
@ -4015,6 +4015,7 @@ static INT32 OscarInit()
|
|||
HD6309SetReadHandler(oscar_main_read);
|
||||
HD6309Close();
|
||||
|
||||
HD6309Init(1);
|
||||
HD6309Open(1);
|
||||
HD6309MapMemory(DrvMainRAM, 0x0000, 0x0eff, HD6309_RAM); // all shared? AM_RANGE(0x0f00, 0x0fff) AM_RAM not?
|
||||
HD6309MapMemory(DrvPalRAM + 0x400, 0x0f00, 0x0fff, HD6309_RAM); // not really pal...
|
||||
|
|
|
@ -726,7 +726,7 @@ static INT32 DrvInit(INT32 type)
|
|||
DrvGfxDecode(gfx0_offset * 2);
|
||||
}
|
||||
|
||||
HD6309Init(1);
|
||||
HD6309Init(0);
|
||||
HD6309Open(0);
|
||||
HD6309MapMemory(DrvHD6309RAM, 0x4000, 0x5fff, HD6309_RAM);
|
||||
HD6309MapMemory(DrvHD6309ROM + 0x10000, 0x6000, 0x7fff, HD6309_ROM);
|
||||
|
|
|
@ -1894,13 +1894,8 @@ static INT32 DarktowrLoadRoms()
|
|||
static INT32 DrvMachineInit()
|
||||
{
|
||||
BurnSetRefreshRate(57.444853);
|
||||
|
||||
// Setup the HD6309 emulation
|
||||
if (DrvSubCPUType == DD_CPU_TYPE_HD6309) {
|
||||
HD6309Init(2);
|
||||
} else {
|
||||
HD6309Init(1);
|
||||
}
|
||||
|
||||
HD6309Init(0);
|
||||
HD6309Open(0);
|
||||
HD6309MapMemory(DrvHD6309Ram , 0x0000, 0x0fff, M6809_RAM);
|
||||
HD6309MapMemory(DrvPaletteRam1 , 0x1000, 0x11ff, M6809_RAM);
|
||||
|
@ -1922,6 +1917,7 @@ static INT32 DrvMachineInit()
|
|||
}
|
||||
|
||||
if (DrvSubCPUType == DD_CPU_TYPE_HD6309) {
|
||||
HD6309Init(1);
|
||||
HD6309Open(1);
|
||||
HD6309MapMemory(DrvSubCPURom , 0xc000, 0xffff, HD6309_ROM);
|
||||
HD6309SetReadHandler(DrvDdragonbSubHD6309ReadByte);
|
||||
|
@ -1979,7 +1975,7 @@ static INT32 DrvMachineInit()
|
|||
static INT32 Drv2MachineInit()
|
||||
{
|
||||
// Setup the HD6309 emulation
|
||||
HD6309Init(1);
|
||||
HD6309Init(0);
|
||||
HD6309Open(0);
|
||||
HD6309MapMemory(DrvHD6309Ram , 0x0000, 0x17ff, M6809_RAM);
|
||||
HD6309MapMemory(DrvFgVideoRam , 0x1800, 0x1fff, M6809_RAM);
|
||||
|
|
|
@ -78,39 +78,42 @@ static cpu_core_config HD6309CheatCpuConfig =
|
|||
0
|
||||
};
|
||||
|
||||
INT32 HD6309Init(INT32 num)
|
||||
INT32 HD6309Init(INT32 nCPU)
|
||||
{
|
||||
DebugCPU_HD6309Initted = 1;
|
||||
|
||||
nActiveCPU = -1;
|
||||
nHD6309Count = num % MAX_CPU;
|
||||
|
||||
HD6309CPUContext = (HD6309Ext*)malloc(num * sizeof(HD6309Ext));
|
||||
if ((nCPU+1) > nHD6309Count) nHD6309Count = nCPU+1;
|
||||
|
||||
#if defined FBA_DEBUG
|
||||
if (nCPU >= MAX_CPU) bprintf(PRINT_ERROR, _T("HD6309Init called too many CPUs! %d, %d is MAX\n"), nCPU, MAX_CPU);
|
||||
#endif
|
||||
|
||||
if (HD6309CPUContext == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset(HD6309CPUContext, 0, num * sizeof(HD6309Ext));
|
||||
|
||||
for (INT32 i = 0; i < num; i++) {
|
||||
HD6309CPUContext[i].ReadByte = HD6309ReadByteDummyHandler;
|
||||
HD6309CPUContext[i].WriteByte = HD6309WriteByteDummyHandler;
|
||||
HD6309CPUContext[i].ReadOp = HD6309ReadOpDummyHandler;
|
||||
HD6309CPUContext[i].ReadOpArg = HD6309ReadOpArgDummyHandler;
|
||||
|
||||
nHD6309CyclesDone[i] = 0;
|
||||
|
||||
for (INT32 j = 0; j < (0x0100 * 3); j++) {
|
||||
HD6309CPUContext[i].pMemMap[j] = NULL;
|
||||
HD6309CPUContext = (HD6309Ext*)malloc(MAX_CPU * sizeof(HD6309Ext));
|
||||
if (HD6309CPUContext == NULL) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
nHD6309CyclesTotal = 0;
|
||||
|
||||
hd6309_init();
|
||||
|
||||
for (INT32 i = 0; i < num; i++)
|
||||
CpuCheatRegister(i, &HD6309CheatCpuConfig);
|
||||
memset(HD6309CPUContext, 0, MAX_CPU * sizeof(HD6309Ext));
|
||||
}
|
||||
|
||||
HD6309CPUContext[nCPU].ReadByte = HD6309ReadByteDummyHandler;
|
||||
HD6309CPUContext[nCPU].WriteByte = HD6309WriteByteDummyHandler;
|
||||
HD6309CPUContext[nCPU].ReadOp = HD6309ReadOpDummyHandler;
|
||||
HD6309CPUContext[nCPU].ReadOpArg = HD6309ReadOpArgDummyHandler;
|
||||
|
||||
nHD6309CyclesDone[nCPU] = 0;
|
||||
|
||||
for (INT32 j = 0; j < (0x0100 * 3); j++) {
|
||||
HD6309CPUContext[nCPU].pMemMap[j] = NULL;
|
||||
}
|
||||
|
||||
nHD6309CyclesTotal = 0;
|
||||
|
||||
//hd6309_init(); // does nothing.
|
||||
|
||||
CpuCheatRegister(nCPU, &HD6309CheatCpuConfig);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ extern INT32 nHD6309CyclesTotal;
|
|||
|
||||
void HD6309Reset();
|
||||
void HD6309NewFrame();
|
||||
INT32 HD6309Init(INT32 num);
|
||||
INT32 HD6309Init(INT32 nCPU);
|
||||
void HD6309Exit();
|
||||
void HD6309Open(INT32 num);
|
||||
void HD6309Close();
|
||||
|
|
Loading…
Reference in New Issue