mirror of https://github.com/stella-emu/stella.git
Fixed INTIM/TIMINT multiple reads in the debugger, which changed the
state of the registers and messed up further emulation. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2614 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
6279c24b57
commit
4610fd608d
|
@ -53,6 +53,10 @@
|
|||
* Fixed regression in RIOT INTIM reads; at least one known ROM
|
||||
(Mr. Roboto Berzerk hack) wasn't working properly.
|
||||
|
||||
* Fixed bug in the debugger with RIOT INTIM/TIMINT display; reads
|
||||
were being done multiple times, changing the state of the
|
||||
registers and resulting in incorrect emulation.
|
||||
|
||||
* Added support for different directories for saving/loading PNG
|
||||
files. These are set with the 'snapsavedir' and 'snaploaddir'
|
||||
commandline arguments (which replace the old 'snapdir'), and are
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <sstream>
|
||||
|
||||
#include "System.hxx"
|
||||
#include "M6532.hxx"
|
||||
#include "TIA.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "Switches.hxx"
|
||||
|
@ -129,7 +128,7 @@ uInt8 RiotDebug::swacnt(int newVal)
|
|||
if(newVal > -1)
|
||||
mySystem.poke(0x281, newVal);
|
||||
|
||||
return mySystem.peek(0x281);
|
||||
return mySystem.m6532().myDDRA;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -138,7 +137,7 @@ uInt8 RiotDebug::swbcnt(int newVal)
|
|||
if(newVal > -1)
|
||||
mySystem.poke(0x283, newVal);
|
||||
|
||||
return mySystem.peek(0x283);
|
||||
return mySystem.m6532().myDDRB;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -196,24 +195,6 @@ uInt8 RiotDebug::tim1024T(int newVal)
|
|||
return mySystem.m6532().myOutTimer[3];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 RiotDebug::intim()
|
||||
{
|
||||
return mySystem.peek(0x284);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 RiotDebug::timint()
|
||||
{
|
||||
return mySystem.peek(0x285);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int32 RiotDebug::timClocks()
|
||||
{
|
||||
return mySystem.m6532().timerClocks();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Controller& RiotDebug::controller(Controller::Jack jack) const
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ class Debugger;
|
|||
class RiotDebug;
|
||||
|
||||
#include "Array.hxx"
|
||||
#include "M6532.hxx"
|
||||
#include "DebuggerSystem.hxx"
|
||||
|
||||
class RiotState : public DebuggerState
|
||||
|
@ -71,9 +72,9 @@ class RiotDebug : public DebuggerSystem
|
|||
uInt8 tim8T(int newVal = -1);
|
||||
uInt8 tim64T(int newVal = -1);
|
||||
uInt8 tim1024T(int newVal = -1);
|
||||
uInt8 intim();
|
||||
uInt8 timint();
|
||||
Int32 timClocks();
|
||||
uInt8 intim() const { return mySystem.m6532().intim(); }
|
||||
uInt8 timint() const { return mySystem.m6532().timint(); }
|
||||
Int32 timClocks() const { return mySystem.m6532().timerClocks(); }
|
||||
|
||||
/* Controller ports */
|
||||
Controller& controller(Controller::Jack jack) const;
|
||||
|
|
|
@ -401,6 +401,34 @@ bool M6532::load(Serializer& in)
|
|||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 M6532::intim() const
|
||||
{
|
||||
// This method is documented in ::peek(0x284), and exists so that the
|
||||
// debugger can read INTIM without changing the state of the system
|
||||
|
||||
// Get number of clocks since timer was set
|
||||
Int32 timer = timerClocks();
|
||||
if(!(timer & 0x40000))
|
||||
return (timer >> myIntervalShift) & 0xff;
|
||||
else
|
||||
return timer & 0xff;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 M6532::timint() const
|
||||
{
|
||||
// This method is documented in ::peek(0x285), and exists so that the
|
||||
// debugger can read TIMINT without changing the state of the system
|
||||
|
||||
// Update timer flag if it is invalid and timer has expired
|
||||
uInt8 interrupt = myInterruptFlag;
|
||||
if(timerClocks() < 0)
|
||||
interrupt |= TimerBit;
|
||||
|
||||
return interrupt;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
M6532::M6532(const M6532& c)
|
||||
: myConsole(c.myConsole),
|
||||
|
|
|
@ -140,12 +140,18 @@ class M6532 : public Device
|
|||
bool poke(uInt16 address, uInt8 value);
|
||||
|
||||
private:
|
||||
Int32 timerClocks()
|
||||
Int32 timerClocks() const
|
||||
{ return myTimer - (mySystem->cycles() - myCyclesWhenTimerSet); }
|
||||
|
||||
void setTimerRegister(uInt8 data, uInt8 interval);
|
||||
void setPinState(bool shcha);
|
||||
|
||||
// The following are used by the debugger to read INTIM/TIMINT
|
||||
// We need separate methods to do this, so the state of the system
|
||||
// isn't changed
|
||||
uInt8 intim() const;
|
||||
uInt8 timint() const;
|
||||
|
||||
private:
|
||||
// Accessible bits in the interrupt flag register
|
||||
// All other bits are always zeroed
|
||||
|
|
Loading…
Reference in New Issue