diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.Core.cs b/BizHawk.Emulation/Computers/Commodore64/C64.Core.cs index 44cbfbb2a6..2acfcbd8c9 100644 --- a/BizHawk.Emulation/Computers/Commodore64/C64.Core.cs +++ b/BizHawk.Emulation/Computers/Commodore64/C64.Core.cs @@ -198,6 +198,11 @@ namespace BizHawk.Emulation.Computers.Commodore64 sid.HardReset(); vic.HardReset(); } + + public void SyncState() + { + + } } static public class C64Util diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6526.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6526.cs index 6f10f26443..99c59bb0da 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6526.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/MOS6526.cs @@ -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); diff --git a/BizHawk.Emulation/Computers/Commodore64/MOS/Timer.cs b/BizHawk.Emulation/Computers/Commodore64/MOS/Timer.cs index 553a5e96f2..a0d36e8905 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MOS/Timer.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MOS/Timer.cs @@ -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)