From e8c91c787688e2adbac751d29a12e97d77b04b03 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 11 Oct 2010 23:06:37 +0000 Subject: [PATCH] Fixed infinite loop in Distella; a section of code needed to use 32-bit values instead of 16-bit. Fixed compilation of System class and M6502 disassembly tracking when compiling without debugger support. In this case, the tracking is not done, and all related operations are completely #ifdef'ed out (resulting in no extra speed/memory usage at all). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2152 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/DiStella.cxx | 3 +-- src/emucore/M6502.ins | 26 +++++++++++++++++++------- src/emucore/M6502.m4 | 22 +++++++++++++++++----- src/emucore/System.cxx | 4 +++- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index 9177ae1f3..d8e740abd 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -919,13 +919,12 @@ DONE_WITH_ADD: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DiStella::processDirectives(const CartDebug::DirectiveList& directives) { - for(CartDebug::DirectiveList::const_iterator i = directives.begin(); i != directives.end(); ++i) { const CartDebug::DirectiveTag tag = *i; if(check_range(tag.start, tag.end)) - for(uInt16 k = tag.start; k <= tag.end; ++k) + for(uInt32 k = tag.start; k <= tag.end; ++k) mark(k, tag.type); } } diff --git a/src/emucore/M6502.ins b/src/emucore/M6502.ins index 6a6eddf6a..1391b3c61 100644 --- a/src/emucore/M6502.ins +++ b/src/emucore/M6502.ins @@ -14,7 +14,7 @@ // See the file "License.txt" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502.m4 2150 2010-10-11 14:51:48Z stephena $ +// $Id: M6502.m4 2151 2010-10-11 15:11:10Z stephena $ //============================================================================ /** @@ -24,7 +24,7 @@ 'm4 M6502.m4 > M6502.ins' @author Bradford W. Mott - @version $Id: M6502.m4 2150 2010-10-11 14:51:48Z stephena $ + @version $Id: M6502.m4 2151 2010-10-11 15:11:10Z stephena $ */ #ifndef NOTSAMEPAGE @@ -32,17 +32,29 @@ #endif #ifndef SET_LAST_PEEK - #define SET_LAST_PEEK(_addr) _addr = intermediateAddress; + #ifdef DEBUGGER_SUPPORT + #define SET_LAST_PEEK(_addr) _addr = intermediateAddress; + #else + #define SET_LAST_PEEK(_addr) + #endif #endif #ifndef CLEAR_LAST_PEEK - #define CLEAR_LAST_PEEK(_addr) _addr = 0; + #ifdef DEBUGGER_SUPPORT + #define CLEAR_LAST_PEEK(_addr) _addr = 0; + #else + #define CLEAR_LAST_PEEK(_addr) + #endif #endif #ifndef CHECK_GFX_WRITE - #define CHECK_GFX_WRITE(_addr) \ - if((operandAddress == 0x1B || operandAddress == 0x1C) && _addr) \ - mySystem->setAddressDisasmType(_addr, DISASM_GFX); + #ifdef DEBUGGER_SUPPORT + #define CHECK_GFX_WRITE(_addr) \ + if((operandAddress == 0x1B || operandAddress == 0x1C) && _addr) \ + mySystem->setAddressDisasmType(_addr, DISASM_GFX); + #else + #define CHECK_GFX_WRITE(_addr) + #endif #endif diff --git a/src/emucore/M6502.m4 b/src/emucore/M6502.m4 index 50b7582d7..57202b8ee 100644 --- a/src/emucore/M6502.m4 +++ b/src/emucore/M6502.m4 @@ -32,17 +32,29 @@ #endif #ifndef SET_LAST_PEEK - #define SET_LAST_PEEK(_addr) _addr = intermediateAddress; + #ifdef DEBUGGER_SUPPORT + #define SET_LAST_PEEK(_addr) _addr = intermediateAddress; + #else + #define SET_LAST_PEEK(_addr) + #endif #endif #ifndef CLEAR_LAST_PEEK - #define CLEAR_LAST_PEEK(_addr) _addr = 0; + #ifdef DEBUGGER_SUPPORT + #define CLEAR_LAST_PEEK(_addr) _addr = 0; + #else + #define CLEAR_LAST_PEEK(_addr) + #endif #endif #ifndef CHECK_GFX_WRITE - #define CHECK_GFX_WRITE(_addr) \ - if((operandAddress == 0x1B || operandAddress == 0x1C) && _addr) \ - mySystem->setAddressDisasmType(_addr, DISASM_GFX); + #ifdef DEBUGGER_SUPPORT + #define CHECK_GFX_WRITE(_addr) \ + if((operandAddress == 0x1B || operandAddress == 0x1C) && _addr) \ + mySystem->setAddressDisasmType(_addr, DISASM_GFX); + #else + #define CHECK_GFX_WRITE(_addr) + #endif #endif diff --git a/src/emucore/System.cxx b/src/emucore/System.cxx index 494cacfce..d82216183 100644 --- a/src/emucore/System.cxx +++ b/src/emucore/System.cxx @@ -19,7 +19,7 @@ #include #include -#include "Debugger.hxx" + #include "Device.hxx" #include "M6502.hxx" #include "M6532.hxx" @@ -216,9 +216,11 @@ uInt8 System::peek(uInt16 addr, uInt8 flags) { PageAccess& access = myPageAccessTable[(addr & myAddressMask) >> myPageShift]; +#ifdef DEBUGGER_SUPPORT // Set access type if(access.codeAccessBase) *(access.codeAccessBase + (addr & myPageMask)) |= flags; +#endif // See if this page uses direct accessing or not uInt8 result;