It doesn't look like there is really much hooked up in the save states for m62. Give this a shot. There is still stuff to be hooked up (bank switches), but it's a start at least.
static INT32 M62Scan(INT32 nAction, INT32 *pnMin)
{
struct BurnArea ba;
if (pnMin != NULL) {
*pnMin = 0x029709;
}
if (nAction & ACB_MEMORY_RAM) {
memset(&ba, 0, sizeof(ba));
ba.Data = RamStart;
ba.nLen = RamEnd-RamStart;
ba.szName = "All Ram";
BurnAcb(&ba);
}
if (nAction & ACB_DRIVER_DATA) {
ZetScan(nAction);
M6803Scan(nAction);
AY8910Scan(nAction, pnMin);
MSM5205Scan(nAction, pnMin));
SCAN_VAR(M62BackgroundHScroll);
SCAN_VAR(M62BackgroundVScroll);
SCAN_VAR(M62CharHScroll);
SCAN_VAR(M62CharVScroll);
SCAN_VAR(M62FlipScreen);
SCAN_VAR(M62SoundLatch);
SCAN_VAR(M62Port1);
SCAN_VAR(M62Port2);
SCAN_VAR(M62SlaveMSM5205VClckReset);
SCAN_VAR(M62BankControl[0]);
SCAN_VAR(M62BankControl[1]);
SCAN_VAR(Ldrun2BankSwap);
SCAN_VAR(Ldrun3TopBottomMask);
SCAN_VAR(KidnikiBackgroundBank);
SCAN_VAR(SpelunkrPaletteBank);
}
return 0;
}
I would start moving the bank switches to be routines rather than built in to the writes.
case 0x85: {
INT32 BankAddress = 0x8000 + ((d & 0x0f) * 0x2000);
ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + BankAddress);
ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + BankAddress);
return;
}
to something more like this
static void KidnikiBankswitch(int bank)
{
M62BankAddress0 = 0x8000 + ((bank & 0x0f) * 0x2000);
ZetMapArea(0x8000, 0x9fff, 0, M62Z80Rom + M62BankAddress0);
ZetMapArea(0x8000, 0x9fff, 2, M62Z80Rom + M62BankAddress0);
}
...
case 0x85: {
KidnikiBankswitch(d);
return;
}
that way you can call it later in the scan function