Skip to content

Commit

Permalink
Fixed soft reset (#813)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Oct 21, 2024
1 parent c25b27d commit 4061fc5
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Emulator/Components/C64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,16 @@ C64::initialize()
void
C64::operator << (SerResetter &worker)
{
// Remember the current inspection event
auto insEvent = eventid[SLOT_INS];
auto insEventData = data[SLOT_INS];
if (isSoftResetter(worker)) return;

// Reset all items
serialize(worker);

// Initialize all event slots
for (isize i = 0; i < SLOT_COUNT; i++) {

if (i == SLOT_INS) continue;

trigger[i] = NEVER;
eventid[i] = (EventID)0;
data[i] = 0;
Expand All @@ -324,7 +324,6 @@ C64::operator << (SerResetter &worker)
scheduleAbs<SLOT_CIA1>(cpu.clock, CIA_EXECUTE);
scheduleAbs<SLOT_CIA2>(cpu.clock, CIA_EXECUTE);
scheduleRel<SLOT_SRV>(C64::sec(0.5), SRV_LAUNCH_DAEMON);
if (insEvent) scheduleRel <SLOT_INS> (0, insEvent, insEventData);
scheduleNextSNPEvent();

flags = 0;
Expand Down
2 changes: 2 additions & 0 deletions Emulator/Components/C64.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ class C64 final : public CoreComponent, public Inspectable<C64Info> {
template <class T>
void serialize(T& worker)
{
if (isSoftResetter(worker)) return;

worker

<< trigger
Expand Down
3 changes: 3 additions & 0 deletions Emulator/Components/CIA/CIA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ CIA::_didReset(bool hard)

updatePA();
updatePB();

c64.scheduleAbs<SLOT_CIA1>(cpu.clock, CIA_EXECUTE);
c64.scheduleAbs<SLOT_CIA2>(cpu.clock, CIA_EXECUTE);
}

void
Expand Down
2 changes: 2 additions & 0 deletions Emulator/Components/CPU/CPUBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ CPU::cacheInfo(CPUInfo &result) const
void
CPU::_didReset(bool hard)
{
if (!hard) return;

Peddle::reset();

// Enable or disable CPU debugging
Expand Down
2 changes: 2 additions & 0 deletions Emulator/Components/SID/SID.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ class SID final : public SubComponent, public Inspectable<SIDInfo>
template <class T>
void serialize(T& worker)
{
if (isSoftResetter(worker)) return;

worker

<< sidreg
Expand Down
2 changes: 2 additions & 0 deletions Emulator/Components/VICII/VICII.h
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,8 @@ class VICII final : public SubComponent, public Inspectable<VICIIInfo, VICIIStat
template <class T>
void serialize(T& worker)
{
if (isSoftResetter(worker)) return;

worker

<< reg.current
Expand Down
2 changes: 2 additions & 0 deletions Emulator/Peripherals/Drive/PIA.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class PIA6821 : public SubComponent {
template <class T>
void serialize(T& worker)
{
if (isSoftResetter(worker)) return;

worker

<< pa
Expand Down

0 comments on commit 4061fc5

Please sign in to comment.