mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-23 00:30:17 +00:00
Debugger: Mute sound when entering debugger from MODE_STEPPING:
. ie: ESC, F7 and Pause key Debugger: Fix for MODE_STEPPING when jump from $C3xx to $C8xx: . Don't break on floating-bus, as Expansion ROM will be switched in on this access. IORead_Cxxx(): Fix the logic for IO_SELECT when not slot-3
This commit is contained in:
parent
3a2313c52e
commit
30d8b7716a
@ -289,28 +289,28 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"AppleWinDebugger.cfg";
|
||||
#endif
|
||||
|
||||
char g_sFileNameTrace [] = "Trace.txt";
|
||||
static char g_sFileNameTrace [] = "Trace.txt";
|
||||
|
||||
bool g_bBenchmarking = false;
|
||||
static bool g_bBenchmarking = false;
|
||||
|
||||
BOOL fulldisp = 0;
|
||||
static BOOL fulldisp = 0;
|
||||
|
||||
BOOL g_bProfiling = 0;
|
||||
int g_nDebugSteps = 0;
|
||||
DWORD g_nDebugStepCycles = 0;
|
||||
int g_nDebugStepStart = 0;
|
||||
int g_nDebugStepUntil = -1; // HACK: MAGIC #
|
||||
static BOOL g_bProfiling = 0;
|
||||
static int g_nDebugSteps = 0;
|
||||
static DWORD g_nDebugStepCycles = 0;
|
||||
static int g_nDebugStepStart = 0;
|
||||
static int g_nDebugStepUntil = -1; // HACK: MAGIC #
|
||||
|
||||
int g_nDebugSkipStart = 0;
|
||||
int g_nDebugSkipLen = 0;
|
||||
static int g_nDebugSkipStart = 0;
|
||||
static int g_nDebugSkipLen = 0;
|
||||
|
||||
FILE *g_hTraceFile = NULL;
|
||||
bool g_bTraceHeader = false; // semaphore, flag header to be printed
|
||||
bool g_bTraceFileWithVideoScanner = false;
|
||||
static FILE *g_hTraceFile = NULL;
|
||||
static bool g_bTraceHeader = false; // semaphore, flag header to be printed
|
||||
static bool g_bTraceFileWithVideoScanner = false;
|
||||
|
||||
DWORD extbench = 0;
|
||||
|
||||
bool g_bIgnoreNextKey = false;
|
||||
static bool g_bIgnoreNextKey = false;
|
||||
|
||||
// Private ________________________________________________________________________________________
|
||||
|
||||
@ -1007,12 +1007,12 @@ Update_t CmdBreakOpcode (int nArgs) // Breakpoint IFF Full-speed!
|
||||
|
||||
if (g_iDebugBreakOnOpcode == 0)
|
||||
// Show what the current break opcode is
|
||||
ConsoleBufferPushFormat( sText, TEXT("%s full speed Break on Opcode: None")
|
||||
ConsoleBufferPushFormat( sText, TEXT("%s Break on Opcode: None")
|
||||
, sAction
|
||||
);
|
||||
else
|
||||
// Show what the current break opcode is
|
||||
ConsoleBufferPushFormat( sText, TEXT("%s full speed Break on Opcode: %02X %s")
|
||||
ConsoleBufferPushFormat( sText, TEXT("%s Break on Opcode: %02X %s")
|
||||
, sAction
|
||||
, g_iDebugBreakOnOpcode
|
||||
, g_aOpcodes65C02[ g_iDebugBreakOnOpcode ].sMnemonic
|
||||
@ -8423,7 +8423,7 @@ void DebugBegin ()
|
||||
g_nAppMode = MODE_DEBUG;
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
|
||||
if (IS_APPLE2 || (g_Apple2Type == A2TYPE_APPLE2E))
|
||||
if (GetMainCpu() == CPU_6502)
|
||||
{
|
||||
g_aOpcodes = & g_aOpcodes6502[ 0 ]; // Apple ][, ][+, //e
|
||||
g_aOpmodes[ AM_2 ].m_nBytes = 1;
|
||||
@ -8505,7 +8505,7 @@ static void CheckBreakOpcode( int iOpcode )
|
||||
|
||||
void DebugContinueStepping ()
|
||||
{
|
||||
static unsigned nStepsTaken = 0;
|
||||
static UINT nStepsTaken = 0;
|
||||
static bool bForceSingleStepNext = false; // Allow at least one instruction to execute so we don't trigger on the same invalid opcode
|
||||
|
||||
if (g_nDebugSkipLen > 0)
|
||||
@ -8568,7 +8568,7 @@ void DebugContinueStepping ()
|
||||
SingleStep(g_bGoCmd_ReinitFlag);
|
||||
g_bGoCmd_ReinitFlag = false;
|
||||
|
||||
g_bDebugBreakpointHit |= CheckBreakpointsIO() || CheckBreakpointsReg();
|
||||
g_bDebugBreakpointHit |= CheckBreakpointsIO() | CheckBreakpointsReg();
|
||||
}
|
||||
|
||||
if (regs.pc == g_nDebugStepUntil || g_bDebugBreakpointHit)
|
||||
@ -8603,6 +8603,8 @@ void DebugContinueStepping ()
|
||||
|
||||
if (!g_nDebugSteps)
|
||||
{
|
||||
SoundCore_SetFade(FADE_OUT); // NB. Call when MODE_STEPPING (not MODE_DEBUG) - see function
|
||||
|
||||
g_nAppMode = MODE_DEBUG;
|
||||
FrameRefreshStatus(DRAW_TITLE);
|
||||
// BUG: PageUp, Trace - doesn't center cursor
|
||||
@ -9011,9 +9013,9 @@ void DebugInitialize ()
|
||||
//===========================================================================
|
||||
void DebuggerInputConsoleChar( TCHAR ch )
|
||||
{
|
||||
if ((g_nAppMode == MODE_STEPPING) && (ch == DEBUG_EXIT_KEY))
|
||||
if ((g_nAppMode == MODE_STEPPING) && (ch == DEBUG_STEPPING_EXIT_KEY))
|
||||
{
|
||||
g_nDebugSteps = 0; // Exit Debugger
|
||||
g_nDebugSteps = 0; // On next DebugContinueStepping(), stop single-stepping and transition to MODE_DEBUG
|
||||
ClearTempBreakpoints();
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@
|
||||
|
||||
enum
|
||||
{
|
||||
DEBUG_EXIT_KEY = 0x1B, // Escape
|
||||
DEBUG_STEPPING_EXIT_KEY = 0x1B, // Escape
|
||||
DEBUG_TOGGLE_KEY = VK_F1 + BTN_DEBUG
|
||||
};
|
||||
|
||||
|
@ -1025,6 +1025,9 @@ LRESULT CALLBACK FrameWndProc (
|
||||
else
|
||||
if ((g_nAppMode == MODE_DEBUG) || (g_nAppMode == MODE_STEPPING))
|
||||
{
|
||||
if (g_nAppMode == MODE_STEPPING && (TCHAR)wparam == DEBUG_STEPPING_EXIT_KEY)
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
|
||||
DebuggerInputConsoleChar((TCHAR)wparam);
|
||||
}
|
||||
break;
|
||||
@ -1299,7 +1302,8 @@ LRESULT CALLBACK FrameWndProc (
|
||||
// Don't call FrameShowCursor(FALSE) else ClipCursor() won't be called
|
||||
break;
|
||||
case MODE_STEPPING:
|
||||
DebuggerInputConsoleChar( DEBUG_EXIT_KEY );
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
DebuggerInputConsoleChar( DEBUG_STEPPING_EXIT_KEY );
|
||||
break;
|
||||
}
|
||||
DrawStatusArea((HDC)0,DRAW_TITLE);
|
||||
@ -1815,6 +1819,7 @@ static bool ConfirmReboot(bool bFromButtonUI)
|
||||
static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
|
||||
{
|
||||
SoundCore_SetFade(FADE_OUT);
|
||||
bool bAllowFadeIn = true;
|
||||
|
||||
#if DEBUG_DD_PALETTE
|
||||
char _text[ 80 ];
|
||||
@ -1890,10 +1895,11 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
|
||||
ResetMachineState();
|
||||
}
|
||||
|
||||
// Allow F7 to enter debugger even though emulator isn't "running"
|
||||
if (g_nAppMode == MODE_STEPPING)
|
||||
{
|
||||
DebuggerInputConsoleChar( DEBUG_EXIT_KEY );
|
||||
// Allow F7 to enter debugger even when not MODE_RUNNING
|
||||
DebuggerInputConsoleChar( DEBUG_STEPPING_EXIT_KEY );
|
||||
bAllowFadeIn = false;
|
||||
}
|
||||
else
|
||||
if (g_nAppMode == MODE_DEBUG)
|
||||
@ -1914,7 +1920,7 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
|
||||
|
||||
}
|
||||
|
||||
if((g_nAppMode != MODE_DEBUG) && (g_nAppMode != MODE_PAUSED))
|
||||
if((g_nAppMode != MODE_DEBUG) && (g_nAppMode != MODE_PAUSED) && bAllowFadeIn)
|
||||
{
|
||||
SoundCore_SetFade(FADE_IN);
|
||||
}
|
||||
|
@ -524,6 +524,12 @@ static bool IsCardInSlot(const UINT uSlot);
|
||||
// - Reset when 6502 accesses $CFFF
|
||||
// . Enable2 = I/O STROBE' (6502 accesses [$C800..$CFFF])
|
||||
|
||||
// TODO:
|
||||
// . IO_SELECT and IO_SELECT_InternalROM are sticky - they only getting reset by $CFFF and MemReset()
|
||||
// . Check Sather UAIIe, but I assume that a 6502 access to a non-$Csxx (and non-expansion ROM) location will clear IO_SELECT
|
||||
|
||||
// NB. ProDOS boot sets IO_SELECT=0x04 (its scan for boot devices?), as slot2 contains a card (ie. SSC) with an expansion ROM.
|
||||
|
||||
BYTE __stdcall IORead_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE value, ULONG nCyclesLeft)
|
||||
{
|
||||
if (address == 0xCFFF)
|
||||
@ -553,13 +559,19 @@ BYTE __stdcall IORead_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE v
|
||||
{
|
||||
if ((address >= APPLE_SLOT_BEGIN) && (address <= APPLE_SLOT_END))
|
||||
{
|
||||
const UINT uSlot = (address >> 8) & 0xF;
|
||||
if ((uSlot != 3) && ExpansionRom[uSlot])
|
||||
IO_SELECT |= 1<<uSlot;
|
||||
else if ((SW_SLOTC3ROM) && ExpansionRom[uSlot])
|
||||
IO_SELECT |= 1<<uSlot; // Slot3 & Peripheral ROM
|
||||
else if (!SW_SLOTC3ROM)
|
||||
IO_SELECT_InternalROM = 1; // Slot3 & Internal ROM
|
||||
const UINT uSlot = (address>>8)&0x7;
|
||||
if (uSlot != 3)
|
||||
{
|
||||
if (ExpansionRom[uSlot])
|
||||
IO_SELECT |= 1<<uSlot;
|
||||
}
|
||||
else // slot3
|
||||
{
|
||||
if ((SW_SLOTC3ROM) && ExpansionRom[uSlot])
|
||||
IO_SELECT |= 1<<uSlot; // Slot3 & Peripheral ROM
|
||||
else if (!SW_SLOTC3ROM)
|
||||
IO_SELECT_InternalROM = 1; // Slot3 & Internal ROM
|
||||
}
|
||||
}
|
||||
else if ((address >= FIRMWARE_EXPANSION_BEGIN) && (address <= FIRMWARE_EXPANSION_END))
|
||||
{
|
||||
@ -634,7 +646,7 @@ BYTE __stdcall IORead_Cxxx(WORD programcounter, WORD address, BYTE write, BYTE v
|
||||
( (SW_SLOTCXROM) && // Peripheral (card) ROMs enabled in $C100..$C7FF
|
||||
!(!SW_SLOTC3ROM && uSlot == 3) ); // Internal C3 ROM disabled in $C300 when slot == 3
|
||||
|
||||
// Fix for bug 18643 and bug 18886
|
||||
// Fix for GH#149 and GH#164
|
||||
if (bPeripheralSlotRomEnabled && !IsCardInSlot(uSlot)) // Slot is empty
|
||||
{
|
||||
return IO_Null(programcounter, address, write, value, nCyclesLeft);
|
||||
@ -1120,7 +1132,7 @@ bool MemIsAddrCodeMemory(const USHORT addr)
|
||||
if (addr < APPLE_SLOT_BEGIN) // [$C000..C0FF]
|
||||
return false;
|
||||
|
||||
if (!IS_APPLE2 && !SW_SLOTCXROM) // [$C100..CFFF] //e or Enhanced //e internal ROM
|
||||
if (!IS_APPLE2 && !SW_SLOTCXROM) // [$C100..C7FF] //e or Enhanced //e internal ROM
|
||||
return true;
|
||||
|
||||
if (!IS_APPLE2 && !SW_SLOTC3ROM && (addr >> 8) == 0xC3) // [$C300..C3FF] //e or Enhanced //e internal ROM
|
||||
@ -1136,7 +1148,12 @@ bool MemIsAddrCodeMemory(const USHORT addr)
|
||||
// [$C800..CFFF]
|
||||
|
||||
if (g_eExpansionRomType == eExpRomNull)
|
||||
{
|
||||
if (IO_SELECT || IO_SELECT_InternalROM) // Was at $Csxx and now in [$C800..$CFFF]
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user