diff --git a/source/CPU.cpp b/source/CPU.cpp index 1ebede06..07bfd728 100644 --- a/source/CPU.cpp +++ b/source/CPU.cpp @@ -855,17 +855,6 @@ static DWORD InternalCpuExecute (DWORD totalcycles) nInternalCyclesLeft = (totalcycles<<8) - (cycles<<8); USHORT uExtraCycles = 0; - if (regs.bRESET) - { - regs.bRESET = 0; - EF_TO_AF - regs.ps = (regs.ps | AF_INTERRUPT) & ~AF_DECIMAL; - regs.pc = * (WORD*) (mem+0xFFFC); - regs.sp = 0x0100 | ((regs.sp - 3) & 0xFF); - CYC(7); - continue; - } - BYTE iOpcode = *(mem+regs.pc); if (CheckDebugBreak( iOpcode )) break; @@ -1172,17 +1161,6 @@ static DWORD InternalCpuExecute (DWORD totalcycles) nInternalCyclesLeft = (totalcycles<<8) - (cycles<<8); USHORT uExtraCycles = 0; - if (regs.bRESET) - { - regs.bRESET = 0; - EF_TO_AF - regs.ps = regs.ps | AF_INTERRUPT; - regs.pc = * (WORD*) (mem+0xFFFC); - regs.sp = 0x0100 | ((regs.sp - 3) & 0xFF); - CYC(7); - continue; - } - BYTE iOpcode = *(mem+regs.pc); if (CheckDebugBreak( iOpcode )) break; @@ -1614,9 +1592,7 @@ void CpuInitialize () { CpuDestroy(); regs.a = regs.x = regs.y = regs.ps = 0xFF; regs.sp = 0x01FF; - regs.pc=*(LPWORD)(mem+0xFFFC); - regs.bRESET = 1; - regs.bJammed = 0; + CpuReset(); // Init's ps & pc. Updates sp InitializeCriticalSection(&g_CriticalSection); g_bCritSectionValid = true; @@ -1776,7 +1752,12 @@ void CpuNmiDeassert(eIRQSRC Device) //=========================================================================== void CpuReset() { - regs.bRESET = 1; + // 7 cycles + regs.ps = (regs.ps | AF_INTERRUPT) & ~AF_DECIMAL; + regs.pc = * (WORD*) (mem+0xFFFC); + regs.sp = 0x0100 | ((regs.sp - 3) & 0xFF); + + regs.bJammed = 0; } //=========================================================================== diff --git a/source/CPU.h b/source/CPU.h index 89df0b25..159d1773 100644 --- a/source/CPU.h +++ b/source/CPU.h @@ -11,7 +11,6 @@ typedef struct _regsrec { BYTE ps; // processor status WORD pc; // program counter WORD sp; // stack pointer - BYTE bRESET; // RESET asserted flag BYTE bJammed; // CPU has crashed (NMOS 6502 only) } regsrec, *regsptr;