Added a flag to the 6502 code to track if the last memory access was a

read or not.  Also modified the TIA code so that if the last access
wasn't a read then it does not do a WSYNC operation.  This allows the
emubug.bin ROM to execute and report "2600" instead of "EMU".


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1123 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
bwmott 2006-08-31 02:31:29 +00:00
parent ce28361930
commit ca78e39ca8
5 changed files with 40 additions and 10 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TIA.cxx,v 1.68 2006-08-12 02:42:09 bwmott Exp $
// $Id: TIA.cxx,v 1.69 2006-08-31 02:31:28 bwmott Exp $
//============================================================================
#include <cassert>
@ -2211,8 +2211,18 @@ void TIA::poke(uInt16 addr, uInt8 value)
case 0x02: // Wait for leading edge of HBLANK
{
// Tell the cpu to waste the necessary amount of time
waitHorizontalSync();
// It appears that the 6507 only halts during a read cycle so
// we test here for follow-on writes which should be ignored as
// far as halting the processor is concerned.
//
// TODO - 08-30-2006: This halting isn't correct since it's
// still halting on the original write. The 6507 emulation
// should be expanded to include a READY line.
if(mySystem->m6502().lastAccessWasRead())
{
// Tell the cpu to waste the necessary amount of time
waitHorizontalSync();
}
break;
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502.cxx,v 1.16 2006-06-09 02:45:11 urchlay Exp $
// $Id: M6502.cxx,v 1.17 2006-08-31 02:31:29 bwmott Exp $
//============================================================================
#include "M6502.hxx"
@ -80,6 +80,9 @@ void M6502::reset()
SP = 0xff;
PS(0x20);
// Reset access flag
myLastAccessWasRead = true;
// Load PC from the reset vector
PC = (uInt16)mySystem->peek(0xfffc) | ((uInt16)mySystem->peek(0xfffd) << 8);
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502.hxx,v 1.16 2005-12-09 01:16:13 stephena Exp $
// $Id: M6502.hxx,v 1.17 2006-08-31 02:31:29 bwmott Exp $
//============================================================================
#ifndef M6502_HXX
@ -41,7 +41,7 @@ typedef Common::Array<Expression*> ExpressionList;
has a 64K addressing space.
@author Bradford W. Mott
@version $Id: M6502.hxx,v 1.16 2005-12-09 01:16:13 stephena Exp $
@version $Id: M6502.hxx,v 1.17 2006-08-31 02:31:29 bwmott Exp $
*/
class M6502
{
@ -171,6 +171,13 @@ class M6502
*/
uInt16 getPC() const { return PC; }
/**
Answer true iff the last memory access was a read.
@return true iff last access was a read.
*/
bool lastAccessWasRead() const { return myLastAccessWasRead; }
public:
/**
Overload the ostream output operator for addressing modes.
@ -279,6 +286,9 @@ class M6502
/// Table of system cycles for each instruction
uInt32 myInstructionSystemCycleTable[256];
/// Indicates if the last memory access was a read or not
bool myLastAccessWasRead;
protected:
/// Addressing mode for each of the 256 opcodes
static AddressingMode ourAddressingModeTable[256];

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502Hi.cxx,v 1.15 2005-12-17 01:23:07 stephena Exp $
// $Id: M6502Hi.cxx,v 1.16 2006-08-31 02:31:29 bwmott Exp $
//============================================================================
#include "M6502Hi.hxx"
@ -62,7 +62,10 @@ inline uInt8 M6502High::peek(uInt16 address)
}
#endif
return mySystem->peek(address);
uInt8 result = mySystem->peek(address);
myLastAccessWasRead = true;
return result;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -85,6 +88,7 @@ inline void M6502High::poke(uInt16 address, uInt8 value)
#endif
mySystem->poke(address, value);
myLastAccessWasRead = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502Low.cxx,v 1.8 2006-02-05 02:49:47 stephena Exp $
// $Id: M6502Low.cxx,v 1.9 2006-08-31 02:31:29 bwmott Exp $
//============================================================================
#include "M6502Low.hxx"
@ -52,7 +52,9 @@ inline uInt8 M6502Low::peek(uInt16 address)
}
#endif
return mySystem->peek(address);
uInt8 result = mySystem->peek(address);
myLastAccessWasRead = true;
return result;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -68,6 +70,7 @@ inline void M6502Low::poke(uInt16 address, uInt8 value)
#endif
mySystem->poke(address, value);
myLastAccessWasRead = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -