commodore64: SyncState for MOS 6526

This commit is contained in:
saxxonpike 2012-12-03 07:43:11 +00:00
parent 0191b1e507
commit bb3061baf8
3 changed files with 86 additions and 0 deletions

View File

@ -198,6 +198,11 @@ namespace BizHawk.Emulation.Computers.Commodore64
sid.HardReset();
vic.HardReset();
}
public void SyncState()
{
}
}
static public class C64Util

View File

@ -525,6 +525,72 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
}
}
public void SyncState(Serializer ser)
{
int chipRegionInt = (int)chipRegion;
int timerInModeInt0 = (int)timerInMode[0];
int timerInModeInt1 = (int)timerInMode[1];
int timerOutModeInt0 = (int)timerOutMode[0];
int timerOutModeInt1 = (int)timerOutMode[1];
int timerRunModeInt0 = (int)timerRunMode[0];
int timerRunModeInt1 = (int)timerRunMode[1];
int timerSPModeInt = (int)timerSPMode;
SyncInternal(ser);
ser.Sync("alarmSelect", ref alarmSelect);
ser.Sync("chipRegion", ref chipRegionInt);
ser.Sync("cntPos", ref cntPos);
ser.Sync("enableIntAlarm", ref enableIntAlarm);
ser.Sync("enableIntFlag", ref enableIntFlag);
ser.Sync("enableIntSP", ref enableIntSP);
ser.Sync("enableIntTimer0", ref enableIntTimer[0]);
ser.Sync("enableIntTimer1", ref enableIntTimer[1]);
ser.Sync("intAlarm", ref intAlarm);
ser.Sync("intFlag", ref intFlag);
ser.Sync("intSP", ref intSP);
ser.Sync("intTimer0", ref intTimer[0]);
ser.Sync("intTimer1", ref intTimer[1]);
ser.Sync("pinCnt", ref pinCnt);
ser.Sync("pinFlag", ref pinFlag);
ser.Sync("pinPC", ref pinPC);
ser.Sync("sr", ref sr);
ser.Sync("timerDelay0", ref timerDelay[0]);
ser.Sync("timerDelay1", ref timerDelay[1]);
ser.Sync("timerInMode0", ref timerInModeInt0);
ser.Sync("timerInMode1", ref timerInModeInt1);
ser.Sync("timerOutMode0", ref timerOutModeInt0);
ser.Sync("timerOutMode1", ref timerOutModeInt1);
ser.Sync("timerPortEnable0", ref timerPortEnable[0]);
ser.Sync("timerPortEnable1", ref timerPortEnable[1]);
ser.Sync("timerPulse0", ref timerPulse[0]);
ser.Sync("timerPulse1", ref timerPulse[1]);
ser.Sync("timerRunMode0", ref timerRunModeInt0);
ser.Sync("timerRunMode1", ref timerRunModeInt1);
ser.Sync("timerSPMode", ref timerSPModeInt);
ser.Sync("tod0", ref tod[0]);
ser.Sync("tod1", ref tod[1]);
ser.Sync("tod2", ref tod[2]);
ser.Sync("tod3", ref tod[3]);
ser.Sync("todAlarm0", ref todAlarm[0]);
ser.Sync("todAlarm1", ref todAlarm[1]);
ser.Sync("todAlarm2", ref todAlarm[2]);
ser.Sync("todAlarm3", ref todAlarm[3]);
ser.Sync("todAlarmPM", ref todAlarmPM);
ser.Sync("todCounter", ref todCounter);
ser.Sync("todCounterLatch", ref todCounterLatch);
ser.Sync("todIn", ref todIn);
ser.Sync("todPM", ref todPM);
chipRegion = (Region)chipRegionInt;
timerInMode[0] = (InMode)timerInModeInt0;
timerInMode[1] = (InMode)timerInModeInt1;
timerOutMode[0] = (OutMode)timerOutModeInt0;
timerOutMode[1] = (OutMode)timerOutModeInt1;
timerRunMode[0] = (RunMode)timerRunModeInt0;
timerRunMode[1] = (RunMode)timerRunModeInt1;
timerSPMode = (SPMode)timerSPModeInt;
}
public void Write(ushort addr, byte val)
{
Write(addr, val, 0xFF);

View File

@ -105,6 +105,21 @@ namespace BizHawk.Emulation.Computers.Commodore64.MOS
protected void SyncInternal(Serializer ser)
{
ser.Sync("pinIRQ", ref pinIRQ);
ser.Sync("portData0", ref portData[0]);
ser.Sync("portData1", ref portData[1]);
ser.Sync("portDir0", ref portDir[0]);
ser.Sync("portDir1", ref portDir[1]);
ser.Sync("portMask0", ref portMask[0]);
ser.Sync("portMask1", ref portMask[1]);
ser.Sync("timer0", ref timer[0]);
ser.Sync("timer1", ref timer[1]);
ser.Sync("timerLatch0", ref timerLatch[0]);
ser.Sync("timerLatch1", ref timerLatch[1]);
ser.Sync("timerOn0", ref timerOn[0]);
ser.Sync("timerOn1", ref timerOn[1]);
ser.Sync("underflow0", ref underflow[0]);
ser.Sync("underflow1", ref underflow[1]);
}
private void WritePort(uint index, byte data)