Fix savestates in I8039 core
This commit is contained in:
parent
048e6c39b7
commit
d11e07d0e9
|
@ -94,7 +94,6 @@ typedef struct
|
|||
I8039_PAIR PREVPC; /* previous program counter */
|
||||
I8039_PAIR PC; /* program counter */
|
||||
UINT8 A, SP, PSW;
|
||||
UINT8 RAM[128];
|
||||
UINT8 bus, f1; /* Bus data, and flag1 */
|
||||
UINT8 P1, P2; /* Internal Port 1 and 2 latched outputs */
|
||||
UINT8 EA; /* latched EA input */
|
||||
|
@ -113,6 +112,8 @@ typedef struct
|
|||
static I8039_Regs R;
|
||||
static int i8039_ICount;
|
||||
|
||||
static UINT8 *RAM;
|
||||
|
||||
#define I8039_INLINE static inline
|
||||
#define change_pc(newpc) R.PC.w.l = (newpc)
|
||||
|
||||
|
@ -169,7 +170,7 @@ typedef struct {
|
|||
#define M_By ((R.PSW & B_FLAG))
|
||||
#define M_Bn (!M_By)
|
||||
|
||||
#define intRAM R.RAM
|
||||
#define intRAM RAM
|
||||
#define regPTR R.regPtr
|
||||
|
||||
#define R0 intRAM[regPTR ]
|
||||
|
@ -683,13 +684,15 @@ void I8039Init(int (*irqcallback)(int))
|
|||
{
|
||||
DebugCPU_I8039Initted = 1;
|
||||
|
||||
RAM = (UINT8*)malloc(128 * sizeof(UINT8));
|
||||
|
||||
R.irq_callback = irqcallback;
|
||||
|
||||
R.cpu_feature = 0;
|
||||
R.ram_mask = 0x7F;
|
||||
R.int_rom_size = 0x800;
|
||||
/* not changed on reset*/
|
||||
memset(R.RAM, 0x00, 128);
|
||||
memset(RAM, 0x00, 128);
|
||||
R.timer = 0;
|
||||
|
||||
I8039IORead = I8039DummyReadIo;
|
||||
|
@ -819,6 +822,11 @@ void I8039Exit()
|
|||
if (!DebugCPU_I8039Initted) bprintf(PRINT_ERROR, _T("I8039Exit called without init\n"));
|
||||
#endif
|
||||
|
||||
if (RAM) {
|
||||
free(RAM);
|
||||
RAM = NULL;
|
||||
}
|
||||
|
||||
i8039_ICount = 0;
|
||||
|
||||
DebugCPU_I8039Initted = 0;
|
||||
|
@ -965,22 +973,22 @@ int I8039Scan(int nAction, int *pnMin)
|
|||
struct BurnArea ba;
|
||||
char szName[16];
|
||||
|
||||
if ((nAction & ACB_DRIVER_DATA) == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pnMin != NULL) {
|
||||
*pnMin = 0x029678;
|
||||
*pnMin = 0x029719;
|
||||
}
|
||||
|
||||
sprintf(szName, "I8039");
|
||||
ba.Data = &R;
|
||||
ba.nLen = sizeof(R);
|
||||
ba.nAddress = 0;
|
||||
ba.szName = szName;
|
||||
BurnAcb(&ba);
|
||||
|
||||
SCAN_VAR(i8039_ICount);
|
||||
if (nAction & ACB_DRIVER_DATA) {
|
||||
ScanVar(&R, sizeof(I8039_Regs), "I8039Regs");
|
||||
|
||||
sprintf(szName, "I8039RAM");
|
||||
memset(&ba, 0, sizeof(ba));
|
||||
ba.Data = RAM;
|
||||
ba.nLen = 128;
|
||||
ba.szName = szName;
|
||||
BurnAcb(&ba);
|
||||
|
||||
SCAN_VAR(i8039_ICount);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue