Checking in WIP for trace functionality, similar to that produced by z26.

Various other minor code cleanups.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1719 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2009-05-10 20:57:18 +00:00
parent ef0646e12a
commit f6deb3bb88
6 changed files with 51 additions and 55 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: Cart3E.cxx,v 1.19 2009-05-01 11:25:07 stephena Exp $
// $Id: Cart3E.cxx,v 1.20 2009-05-10 20:57:18 stephena Exp $
//============================================================================
#include <cassert>
@ -64,14 +64,15 @@ void Cartridge3E::install(System& system)
assert((0x1800 & mask) == 0);
// Set the page accessing methods for the hot spots (for 100% emulation
// I would need to chain any accesses below 0x40 to the TIA but for
// now I'll just forget about them)
// we need to chain any accesses below 0x40 to the TIA. Our poke() method
// does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it).
System::PageAccess access;
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
{
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = 0;
access.device = this;
mySystem->setPageAccess(i >> shift, access);
}
@ -211,7 +212,8 @@ int Cartridge3E::bankCount()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3E::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
address &= 0x0FFF;
if(address < 0x0800)
{
if(myCurrentBank < 256)
@ -220,9 +222,8 @@ bool Cartridge3E::patch(uInt16 address, uInt8 value)
myRam[(address & 0x03FF) + (myCurrentBank - 256) * 1024] = value;
}
else
{
myImage[(address & 0x07FF) + mySize - 2048] = value;
}
return true;
}

View File

@ -13,10 +13,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Cart3F.cxx,v 1.20 2009-05-01 11:25:07 stephena Exp $
// $Id: Cart3F.cxx,v 1.21 2009-05-10 20:57:18 stephena Exp $
//============================================================================
#include <cassert>
#include <cstring>
#include "System.hxx"
#include "TIA.hxx"
@ -30,10 +31,7 @@ Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size)
myImage = new uInt8[mySize];
// Copy the ROM image into my buffer
for(uInt32 addr = 0; addr < mySize; ++addr)
{
myImage[addr] = image[addr];
}
memcpy(myImage, image, mySize);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -62,13 +60,13 @@ void Cartridge3F::install(System& system)
// Set the page accessing methods for the hot spots (for 100% emulation
// we need to chain any accesses below 0x40 to the TIA. Our poke() method
// does this via mySystem->tiaPoke(...), at least until we come up with a
// cleaner way to do it.)
// cleaner way to do it).
System::PageAccess access;
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
{
access.device = this;
access.directPeekBase = 0;
access.directPokeBase = 0;
access.device = this;
mySystem->setPageAccess(i >> shift, access);
}
@ -111,6 +109,10 @@ void Cartridge3F::poke(uInt16 address, uInt8 value)
bank(value);
}
// Pass the poke through to the TIA. In a real Atari, both the cart and the
// TIA see the address lines, and both react accordingly. In Stella, each
// 64-byte chunk of address space is "owned" by only one device. If we
// don't chain the poke to the TIA, then the TIA can't see it...
mySystem->tia().poke(address, value);
}
@ -162,15 +164,13 @@ int Cartridge3F::bankCount()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge3F::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
address &= 0x0FFF;
if(address < 0x0800)
{
myImage[(address & 0x07FF) + myCurrentBank * 2048] = value;
}
else
{
myImage[(address & 0x07FF) + mySize - 2048] = value;
}
return true;
}

View File

@ -13,10 +13,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartE0.cxx,v 1.18 2009-05-01 11:25:07 stephena Exp $
// $Id: CartE0.cxx,v 1.19 2009-05-10 20:57:18 stephena Exp $
//============================================================================
#include <cassert>
#include <cstring>
#include "System.hxx"
#include "CartE0.hxx"
@ -25,10 +26,7 @@
CartridgeE0::CartridgeE0(const uInt8* image)
{
// Copy the ROM image into my buffer
for(uInt32 addr = 0; addr < 8192; ++addr)
{
myImage[addr] = image[addr];
}
memcpy(myImage, image, 8192);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,10 +13,11 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: CartUA.cxx,v 1.15 2009-05-01 11:25:07 stephena Exp $
// $Id: CartUA.cxx,v 1.16 2009-05-10 20:57:18 stephena Exp $
//============================================================================
#include <cassert>
#include <cstring>
#include "System.hxx"
#include "CartUA.hxx"
@ -25,10 +26,7 @@
CartridgeUA::CartridgeUA(const uInt8* image)
{
// Copy the ROM image into my buffer
for(uInt32 addr = 0; addr < 8192; ++addr)
{
myImage[addr] = image[addr];
}
memcpy(myImage, image, 8192);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -72,8 +70,6 @@ void CartridgeUA::install(System& system)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeUA::peek(uInt16 address)
{
address &= 0x1FFF;
// Switch banks if necessary
switch(address)
{
@ -170,7 +166,6 @@ bool CartridgeUA::patch(uInt16 address, uInt8 value)
{
address &= 0x0fff;
myImage[myCurrentBank * 4096] = value;
bank(myCurrentBank); // TODO: see if this is really necessary
return true;
}

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.106 2009-03-16 00:23:42 stephena Exp $
// $Id: TIA.cxx,v 1.107 2009-05-10 20:57:18 stephena Exp $
//============================================================================
//#define DEBUG_HMOVE
@ -274,7 +274,6 @@ void TIA::install(System& system, Device& device)
mySystem->setPageAccess(i >> shift, access);
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,9 +13,11 @@
// 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.24 2009-01-13 14:45:34 stephena Exp $
// $Id: M6502Hi.cxx,v 1.25 2009-05-10 20:57:18 stephena Exp $
//============================================================================
//#define DEBUG_OUTPUT
#include "M6502Hi.hxx"
#include "Serializer.hxx"
#include "Deserializer.hxx"
@ -36,6 +38,12 @@ M6502High::M6502High(uInt32 systemCyclesPerProcessorCycle)
#ifdef DEBUGGER_SUPPORT
myJustHitTrapFlag = false;
#endif
debugStream << "( Fm Ln Cyc Clk) ( P0 P1 M0 M1 BL) "
<< "flags A X Y SP Code Disasm" << endl
<< endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -132,16 +140,24 @@ bool M6502High::execute(uInt32 number)
}
#endif
#ifdef DEBUG
debugStream << "PC=" << hex << setw(4) << PC << " ";
#endif
// Fetch instruction at the program counter
IR = peek(PC++);
#ifdef DEBUG
debugStream << "IR=" << hex << setw(2) << (int)IR << " ";
debugStream << "<" << ourAddressingModeTable[IR] << " ";
#ifdef DEBUG_OUTPUT
debugStream << ::hex << setw(2) << (int)A << " "
<< ::hex << setw(2) << (int)X << " "
<< ::hex << setw(2) << (int)Y << " "
<< ::hex << setw(2) << (int)SP << " "
<< setw(4) << (PC-1) << ": "
<< setw(2) << (int)IR << " "
// << "<" << ourAddressingModeTable[IR] << " ";
// debugStream << hex << setw(4) << operandAddress << " ";
<< setw(3) << ourInstructionMnemonicTable[IR]
// debugStream << "PS=" << ::hex << setw(2) << (int)PS() << " ";
// debugStream << "Cyc=" << dec << mySystem->cycles();
<< endl;
#endif
// Call code to execute the instruction
@ -156,19 +172,6 @@ bool M6502High::execute(uInt32 number)
}
myTotalInstructionCount++;
#ifdef DEBUG
debugStream << hex << setw(4) << operandAddress << " ";
debugStream << setw(4) << ourInstructionMnemonicTable[IR];
debugStream << "> ";
debugStream << "A=" << ::hex << setw(2) << (int)A << " ";
debugStream << "X=" << ::hex << setw(2) << (int)X << " ";
debugStream << "Y=" << ::hex << setw(2) << (int)Y << " ";
debugStream << "PS=" << ::hex << setw(2) << (int)PS() << " ";
debugStream << "SP=" << ::hex << setw(2) << (int)SP << " ";
debugStream << "Cyc=" << dec << mySystem->cycles();
debugStream << endl;
#endif
}
// See if we need to handle an interrupt