Fix for step in debugger from reset (1st step would just do the CPU reset):

. Removed CPU reset processing from InternalCpuExecute(). This is now done in CpuReset(). Removed the now redundant regs.bRESET member.
. CpuReset() now also clears regs.bJammed.
This commit is contained in:
tomch 2006-07-02 17:52:23 +00:00
parent b0ac17c8b9
commit 2985943f5d
2 changed files with 7 additions and 27 deletions

View File

@ -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;
}
//===========================================================================

View File

@ -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;