mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-03-30 16:34:33 +00:00
Extend LBR so that it includes the control-flow on a taken interrupt Add a new command 'brkint <0|1>' to support Break on Interrupt Internal: in core emulation loop, moved IRQ/NMI check to start of loop so that just the "interrupt vectoring" case can be single-stepped (instead of previously opcode + interrupt vector). Debugger help chm: update Breakpoints section to include BRK, BRKOP and BRKINT
This commit is contained in:
parent
4f8b30506d
commit
9553106f4e
@ -51,13 +51,9 @@ BPX address[,len]<br>
|
||||
BPX [op] symbol</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add
|
||||
Breakpoint trigger to stop executing when the PC is within the range of
|
||||
the Address, Symbol, or Expression. i.e. Range is: [addr,addr+len)<br>
|
||||
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add Breakpoint trigger to stop executing when the PC is within the range of the Address, Symbol, or Expression. i.e. Range is: [addr,addr+len)<br>
|
||||
Default length is 1.<br>
|
||||
|
||||
Default comparision operator is equal ‘=’</span></i></p>
|
||||
Default comparison operator is equal ‘=’</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#cccccc">
|
||||
@ -65,52 +61,40 @@ Default comparision operator is equal
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BP</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Currently
|
||||
an Alias for BPX.<br>
|
||||
|
||||
(In a future version, will also support Loading and Saving of
|
||||
breakpoints.)</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Currently an Alias for BPX.<br>
|
||||
(In a future version, will also support Loading and Saving of breakpoints.)</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#999999">
|
||||
<td width="25%">
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPM
|
||||
address[,len]</span></b></font></font></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPM address[,len]</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add
|
||||
Breakpoint trigger when memory is accessed by 6502.</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add Breakpoint trigger when memory is accessed by 6502.</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#cccccc">
|
||||
<td width="25%">
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPMR
|
||||
address[,len]</span></b></font></font></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPMR address[,len]</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add
|
||||
Breakpoint trigger when memory is read by 6502.</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add Breakpoint trigger when memory is read by 6502.</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#999999">
|
||||
<td width="25%">
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPMW
|
||||
address[,len]</span></b></font></font></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPMW address[,len]</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add
|
||||
Breakpoint trigger when memory is written by 6502.</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add Breakpoint trigger when memory is written by 6502.</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#cccccc">
|
||||
<td width="25%">
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPR
|
||||
reg [op] value</span></b></font></font></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPR reg [op] value</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add
|
||||
Breakpoint trigger when Register’s ‘reg’
|
||||
value is compared to the Value.</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add Breakpoint trigger when Register’s ‘reg’ value is compared to the Value.</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#999999">
|
||||
@ -118,8 +102,7 @@ value is compared to the Value.</span></i></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPD</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Disable
|
||||
Breakpoint (grayed out).</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Disable Breakpoint (grayed out).</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#cccccc">
|
||||
@ -127,21 +110,16 @@ Breakpoint (grayed out).</span></i></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPE</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Enable
|
||||
Breakpoint (colored red).</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Enable Breakpoint (colored red).</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#999999">
|
||||
<td width="25%">
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPC
|
||||
#</span></b></font></font></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPC #</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Clear
|
||||
specified Breakpoint.<br>
|
||||
|
||||
Note: The asterisk ‘*’ may be used to clear all
|
||||
breakpoints.</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Clear specified Breakpoint.<br>
|
||||
Note: The asterisk ‘*’ may be used to clear all breakpoints.</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#cccccc">
|
||||
@ -149,8 +127,7 @@ breakpoints.</span></i></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPL</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">List
|
||||
Breakpoints.</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">List Breakpoints.</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#999999">
|
||||
@ -158,8 +135,7 @@ Breakpoints.</span></i></p>
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPIO</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">(In
|
||||
a future version, will add Breakpoint trigger on memory read or write.)</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">(In a future version, will add Breakpoint trigger on memory read or write.)</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#cccccc">
|
||||
@ -167,9 +143,31 @@ a future version, will add Breakpoint trigger on memory read or write.)</span></
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPP</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">(In
|
||||
a future version, will add Breakpoint trigger on specific flag cleared
|
||||
or set.)</span></i></p>
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">(In a future version, will add Breakpoint trigger on specific flag cleared or set.)</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#999999">
|
||||
<td width="25%">
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRK [1|2|3] [on|off]</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Break on BRK or Invalid 1-3 byte opcodes</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#cccccc">
|
||||
<td width="25%">
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRKOP [opcode]</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Break on Opcode</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#999999">
|
||||
<td width="25%">
|
||||
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRKINT [0|1]</span></b></font></font></p>
|
||||
</td>
|
||||
<td width="75%">
|
||||
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Break on Interrupt</span></i></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -379,8 +377,7 @@ or set.)</span></i></p>
|
||||
</tr>
|
||||
<tr bgcolor="#000000">
|
||||
<td bgcolor="#000000" width="25%">
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPR
|
||||
A 0</span></b></font></font></p>
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPR A 0</span></b></font></font></p>
|
||||
</td>
|
||||
<td bgcolor="#000000" width="75%">
|
||||
<p><font color="#ffffff"><i>Adds Breakpoint when Accumulator is zero.</i></font></p>
|
||||
@ -388,8 +385,7 @@ A 0</span></b></font></font></p>
|
||||
</tr>
|
||||
<tr bgcolor="#000000">
|
||||
<td bgcolor="#000000" width="25%">
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPR
|
||||
A ! 0</span></b></font></font></p>
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPR A ! 0</span></b></font></font></p>
|
||||
</td>
|
||||
<td bgcolor="#000000" width="75%">
|
||||
<p><font color="#ffffff"><i>Adds Breakpoint when Accumulator is <b>not</b> zero.</i></font></p>
|
||||
@ -397,13 +393,36 @@ A ! 0</span></b></font></font></p>
|
||||
</tr>
|
||||
<tr bgcolor="#000000">
|
||||
<td bgcolor="#000000" width="25%">
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPR
|
||||
S < 1FF</span></b></font></font></p>
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPR S < 1FF</span></b></font></font></p>
|
||||
</td>
|
||||
<td bgcolor="#000000" width="75%">
|
||||
<p><font color="#ffffff"><i>Adds Breakpoint when Stack has had something pushed onto it.</i></font></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#000000">
|
||||
<td bgcolor="#000000" width="25%">
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRK ON</span></b></font></font></p>
|
||||
</td>
|
||||
<td bgcolor="#000000" width="75%">
|
||||
<p><font color="#ffffff"><i>Adds Breakpoint to break when the opcode to be executed is $00 or BRK.</i></font></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#000000">
|
||||
<td bgcolor="#000000" width="25%">
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRKOP 6C</span></b></font></font></p>
|
||||
</td>
|
||||
<td bgcolor="#000000" width="75%">
|
||||
<p><font color="#ffffff"><i>Adds Breakpoint to break when the opcode to be executed is $6C or JMP (ABS).</i></font></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr bgcolor="#000000">
|
||||
<td bgcolor="#000000" width="25%">
|
||||
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRKINT 1</span></b></font></font></p>
|
||||
</td>
|
||||
<td bgcolor="#000000" width="75%">
|
||||
<p><font color="#ffffff"><i>Adds Breakpoint to break just after an interrupt occurs.</i></font></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
|
@ -137,6 +137,7 @@ static volatile UINT32 g_bmNMI = 0;
|
||||
static volatile BOOL g_bNmiFlank = FALSE; // Positive going flank on NMI line
|
||||
|
||||
static bool g_irqDefer1Opcode = false;
|
||||
static bool g_interruptInLastExecutionBatch = false; // Last batch of executed cycles included an interrupt (IRQ/NMI)
|
||||
|
||||
//
|
||||
|
||||
@ -198,6 +199,11 @@ void ResetCyclesExecutedForDebugger(void)
|
||||
g_nCyclesExecuted = 0;
|
||||
}
|
||||
|
||||
bool IsInterruptInLastExecution(void)
|
||||
{
|
||||
return g_interruptInLastExecutionBatch;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
#include "CPU/cpu_general.inl"
|
||||
@ -369,25 +375,29 @@ static __forceinline void Fetch(BYTE& iOpcode, ULONG uExecutedCycles)
|
||||
}
|
||||
|
||||
//#define ENABLE_NMI_SUPPORT // Not used - so don't enable
|
||||
static __forceinline void NMI(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
static __forceinline bool NMI(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
{
|
||||
#ifdef ENABLE_NMI_SUPPORT
|
||||
if(g_bNmiFlank)
|
||||
{
|
||||
// NMI signals are only serviced once
|
||||
g_bNmiFlank = FALSE;
|
||||
if (!g_bNmiFlank)
|
||||
return false;
|
||||
|
||||
// NMI signals are only serviced once
|
||||
g_bNmiFlank = FALSE;
|
||||
#ifdef _DEBUG
|
||||
g_nCycleIrqStart = g_nCumulativeCycles + uExecutedCycles;
|
||||
g_nCycleIrqStart = g_nCumulativeCycles + uExecutedCycles;
|
||||
#endif
|
||||
PUSH(regs.pc >> 8)
|
||||
PUSH(regs.pc & 0xFF)
|
||||
EF_TO_AF
|
||||
PUSH(regs.ps & ~AF_BREAK)
|
||||
regs.ps = regs.ps | AF_INTERRUPT & ~AF_DECIMAL;
|
||||
regs.pc = * (WORD*) (mem+0xFFFA);
|
||||
UINT uExtraCycles = 0; // Needed for CYC(a) macro
|
||||
CYC(7)
|
||||
}
|
||||
PUSH(regs.pc >> 8)
|
||||
PUSH(regs.pc & 0xFF)
|
||||
EF_TO_AF
|
||||
PUSH(regs.ps & ~AF_BREAK)
|
||||
regs.ps = regs.ps | AF_INTERRUPT & ~AF_DECIMAL;
|
||||
regs.pc = * (WORD*) (mem+0xFFFA);
|
||||
UINT uExtraCycles = 0; // Needed for CYC(a) macro
|
||||
CYC(7);
|
||||
g_interruptInLastExecutionBatch = true;
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -399,16 +409,18 @@ static __forceinline void CheckSynchronousInterruptSources(UINT cycles, ULONG uE
|
||||
// NB. No need to save to save-state, as IRQ() follows CheckSynchronousInterruptSources(), and IRQ() always sets it to false.
|
||||
bool g_irqOnLastOpcodeCycle = false;
|
||||
|
||||
static __forceinline void IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
static __forceinline bool IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
{
|
||||
if(g_bmIRQ && !(regs.ps & AF_INTERRUPT))
|
||||
bool irqTaken = false;
|
||||
|
||||
if (g_bmIRQ && !(regs.ps & AF_INTERRUPT))
|
||||
{
|
||||
// if 6522 interrupt occurs on opcode's last cycle, then defer IRQ by 1 opcode
|
||||
// if interrupt (eg. from 6522) occurs on opcode's last cycle, then defer IRQ by 1 opcode
|
||||
if (g_irqOnLastOpcodeCycle && !g_irqDefer1Opcode)
|
||||
{
|
||||
g_irqOnLastOpcodeCycle = false;
|
||||
g_irqDefer1Opcode = true; // if INT occurs again on next opcode, then do NOT defer
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
g_irqDefer1Opcode = false;
|
||||
@ -424,7 +436,7 @@ static __forceinline void IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn,
|
||||
regs.ps = (regs.ps | AF_INTERRUPT) & (~AF_DECIMAL);
|
||||
regs.pc = * (WORD*) (mem+0xFFFE);
|
||||
UINT uExtraCycles = 0; // Needed for CYC(a) macro
|
||||
CYC(7)
|
||||
CYC(7);
|
||||
#if defined(_DEBUG) && LOG_IRQ_TAKEN_AND_RTI
|
||||
std::string irq6522;
|
||||
MB_Get6522IrqDescription(irq6522);
|
||||
@ -435,9 +447,12 @@ static __forceinline void IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn,
|
||||
LogOutput("IRQ (%08X) (%s)\n", (UINT)g_nCycleIrqStart, pSrc);
|
||||
#endif
|
||||
CheckSynchronousInterruptSources(7, uExecutedCycles);
|
||||
g_interruptInLastExecutionBatch = true;
|
||||
irqTaken = true;
|
||||
}
|
||||
|
||||
g_irqOnLastOpcodeCycle = false;
|
||||
return irqTaken;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -606,6 +621,7 @@ DWORD CpuExecute(const DWORD uCycles, const bool bVideoUpdate)
|
||||
#endif
|
||||
|
||||
g_nCyclesExecuted = 0;
|
||||
g_interruptInLastExecutionBatch = false;
|
||||
|
||||
#ifdef _DEBUG
|
||||
MB_CheckCumulativeCycles();
|
||||
|
@ -59,3 +59,4 @@ void SetActiveCpu(eCpuType cpu);
|
||||
bool IsIrqAsserted(void);
|
||||
bool Is6502InterruptEnabled(void);
|
||||
void ResetCyclesExecutedForDebugger(void);
|
||||
bool IsInterruptInLastExecution(void);
|
||||
|
@ -52,6 +52,16 @@ static DWORD Cpu6502(DWORD uTotalCycles, const bool bVideoUpdate)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IRQ(uExecutedCycles, flagc, flagn, flagv, flagz) || NMI(uExecutedCycles, flagc, flagn, flagv, flagz))
|
||||
{
|
||||
if (bVideoUpdate)
|
||||
{
|
||||
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
|
||||
NTSC_VideoUpdateCycles(uElapsedCycles);
|
||||
}
|
||||
continue; // Allow AppleWin debugger's single-stepping to just step the pending IRQ
|
||||
}
|
||||
|
||||
HEATMAP_X( regs.pc );
|
||||
Fetch(iOpcode, uExecutedCycles);
|
||||
|
||||
@ -318,8 +328,6 @@ static DWORD Cpu6502(DWORD uTotalCycles, const bool bVideoUpdate)
|
||||
}
|
||||
|
||||
CheckSynchronousInterruptSources(uExecutedCycles - uPreviousCycles, uExecutedCycles);
|
||||
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||
|
||||
// NTSC_BEGIN
|
||||
if (bVideoUpdate)
|
||||
|
@ -52,6 +52,16 @@ static DWORD Cpu65C02(DWORD uTotalCycles, const bool bVideoUpdate)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IRQ(uExecutedCycles, flagc, flagn, flagv, flagz) || NMI(uExecutedCycles, flagc, flagn, flagv, flagz))
|
||||
{
|
||||
if (bVideoUpdate)
|
||||
{
|
||||
ULONG uElapsedCycles = uExecutedCycles - uPreviousCycles;
|
||||
NTSC_VideoUpdateCycles(uElapsedCycles);
|
||||
}
|
||||
continue; // Allow AppleWin debugger's single-stepping to just step the pending IRQ
|
||||
}
|
||||
|
||||
HEATMAP_X( regs.pc );
|
||||
Fetch(iOpcode, uExecutedCycles);
|
||||
|
||||
@ -318,8 +328,6 @@ static DWORD Cpu65C02(DWORD uTotalCycles, const bool bVideoUpdate)
|
||||
}
|
||||
|
||||
CheckSynchronousInterruptSources(uExecutedCycles - uPreviousCycles, uExecutedCycles);
|
||||
NMI(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||
IRQ(uExecutedCycles, flagc, flagn, flagv, flagz);
|
||||
|
||||
// NTSC_BEGIN
|
||||
if ( bVideoUpdate )
|
||||
|
@ -67,6 +67,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// Any Speed Breakpoints
|
||||
int g_nDebugBreakOnInvalid = 0; // Bit Flags of Invalid Opcode to break on: // iOpcodeType = AM_IMPLIED (BRK), AM_1, AM_2, AM_3
|
||||
int g_iDebugBreakOnOpcode = 0;
|
||||
bool g_bDebugBreakOnInterrupt = false;
|
||||
|
||||
static int g_bDebugBreakpointHit = 0; // See: BreakpointHit_t
|
||||
|
||||
@ -989,6 +990,32 @@ Update_t CmdBreakOpcode (int nArgs) // Breakpoint IFF Full-speed!
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
Update_t CmdBreakOnInterrupt(int nArgs)
|
||||
{
|
||||
TCHAR sText[CONSOLE_WIDTH];
|
||||
|
||||
if (nArgs > 1)
|
||||
return HelpLastCommand();
|
||||
|
||||
TCHAR sAction[CONSOLE_WIDTH] = TEXT("Current"); // default to display
|
||||
|
||||
if (nArgs == 1)
|
||||
{
|
||||
g_bDebugBreakOnInterrupt = g_aArgs[1].nValue ? true : false;
|
||||
_tcscpy(sAction, TEXT("Setting"));
|
||||
}
|
||||
|
||||
// Show what the current break opcode is
|
||||
ConsoleBufferPushFormat(sText, TEXT("%s Break on Interrupt: %s")
|
||||
, sAction
|
||||
, g_bDebugBreakOnInterrupt ? "Enabled" : "Disabled"
|
||||
);
|
||||
|
||||
return ConsoleUpdate();
|
||||
}
|
||||
|
||||
|
||||
// bool bBP = g_nBreakpoints && CheckBreakpoint(nOffset,nOffset == regs.pc);
|
||||
//===========================================================================
|
||||
bool GetBreakpointInfo ( WORD nOffset, bool & bBreakpointActive_, bool & bBreakpointEnable_ )
|
||||
@ -8249,10 +8276,18 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
|
||||
if (bDoSingleStep)
|
||||
{
|
||||
UpdateLBR();
|
||||
const WORD oldPC = regs.pc;
|
||||
|
||||
SingleStep(g_bGoCmd_ReinitFlag);
|
||||
g_bGoCmd_ReinitFlag = false;
|
||||
|
||||
if (IsInterruptInLastExecution())
|
||||
{
|
||||
g_LBR = oldPC;
|
||||
if (g_bDebugBreakOnInterrupt)
|
||||
g_bDebugBreakpointHit |= BP_HIT_INTERRUPT;
|
||||
}
|
||||
|
||||
g_bDebugBreakpointHit |= CheckBreakpointsIO() | CheckBreakpointsReg();
|
||||
}
|
||||
|
||||
@ -8278,6 +8313,8 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
|
||||
sprintf_s(szStopMessage, sizeof(szStopMessage), "Read access at $%04X", g_uBreakMemoryAddress);
|
||||
else if (g_bDebugBreakpointHit & BP_HIT_PC_READ_FLOATING_BUS_OR_IO_MEM)
|
||||
pszStopReason = TEXT("PC reads from floating bus or I/O memory");
|
||||
else if (g_bDebugBreakpointHit & BP_HIT_INTERRUPT)
|
||||
sprintf_s(szStopMessage, sizeof(szStopMessage), "Interrupt occurred at $%04X", g_LBR);
|
||||
else
|
||||
pszStopReason = TEXT("Unknown!");
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
, BP_HIT_MEMR = (1 << 4)
|
||||
, BP_HIT_MEMW = (1 << 5)
|
||||
, BP_HIT_PC_READ_FLOATING_BUS_OR_IO_MEM = (1 << 6)
|
||||
, BP_HIT_INTERRUPT = (1 << 7)
|
||||
};
|
||||
|
||||
extern int g_nBreakpoints;
|
||||
|
@ -80,6 +80,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// Breakpoints
|
||||
{TEXT("BRK") , CmdBreakInvalid , CMD_BREAK_INVALID , "Enter debugger on BRK or INVALID" },
|
||||
{TEXT("BRKOP") , CmdBreakOpcode , CMD_BREAK_OPCODE , "Enter debugger on opcode" },
|
||||
{TEXT("BRKINT") , CmdBreakOnInterrupt , CMD_BREAK_ON_INTERRUPT , "Enter debugger on interrupt" },
|
||||
{TEXT("BP") , CmdBreakpoint , CMD_BREAKPOINT , "Alias for BPR (Breakpoint Register Add)" },
|
||||
{TEXT("BPA") , CmdBreakpointAddSmart, CMD_BREAKPOINT_ADD_SMART , "Add (smart) breakpoint" },
|
||||
// {TEXT("BPP") , CmdBreakpointAddFlag , CMD_BREAKPOINT_ADD_FLAG , "Add breakpoint on flags" },
|
||||
|
@ -323,6 +323,7 @@
|
||||
// Breakpoints
|
||||
, CMD_BREAK_INVALID
|
||||
, CMD_BREAK_OPCODE
|
||||
, CMD_BREAK_ON_INTERRUPT
|
||||
, CMD_BREAKPOINT
|
||||
, CMD_BREAKPOINT_ADD_SMART // smart breakpoint
|
||||
, CMD_BREAKPOINT_ADD_REG // break on: PC == Address (fetch/execute)
|
||||
@ -599,6 +600,7 @@
|
||||
Update_t CmdCursorSetPC (int nArgs);
|
||||
Update_t CmdBreakInvalid (int nArgs); // Breakpoint IFF Full-speed!
|
||||
Update_t CmdBreakOpcode (int nArgs); // Breakpoint IFF Full-speed!
|
||||
Update_t CmdBreakOnInterrupt (int nArgs);
|
||||
Update_t CmdGoNormalSpeed (int nArgs);
|
||||
Update_t CmdGoFullSpeed (int nArgs);
|
||||
Update_t CmdIn (int nArgs);
|
||||
|
@ -54,12 +54,14 @@ static __forceinline void CheckSynchronousInterruptSources(UINT cycles, ULONG uE
|
||||
{
|
||||
}
|
||||
|
||||
static __forceinline void NMI(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
static __forceinline bool NMI(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static __forceinline void IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
static __forceinline bool IRQ(ULONG& uExecutedCycles, BOOL& flagc, BOOL& flagn, BOOL& flagv, BOOL& flagz)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// From z80.cpp
|
||||
|
Loading…
x
Reference in New Issue
Block a user