diff --git a/stella/src/emucore/Cart3E.cxx b/stella/src/emucore/Cart3E.cxx index e7c23159d..df334b102 100644 --- a/stella/src/emucore/Cart3E.cxx +++ b/stella/src/emucore/Cart3E.cxx @@ -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.3 2005-07-08 12:16:01 urchlay Exp $ +// $Id: Cart3E.cxx,v 1.4 2005-07-09 00:59:12 urchlay Exp $ //============================================================================ #include @@ -122,7 +122,8 @@ void Cartridge3E::poke(uInt16 address, uInt8 value) { address = address & 0x0FFF; - // Switch banks if necessary + // Switch banks if necessary. Armin (Kroko) says there are no mirrored + // hotspots. if(address == 0x003F) { bank(value); @@ -132,8 +133,12 @@ void Cartridge3E::poke(uInt16 address, uInt8 value) bank(value + 256); } - // TODO: Ask Kroko whether addresses 0-0x3d do anything (on 3F, they - // cause a bankswitch) + // Dirty hack alert! + // 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->tiaPoke(address, value); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/Cart3F.cxx b/stella/src/emucore/Cart3F.cxx index 1f6338980..caf85bd12 100644 --- a/stella/src/emucore/Cart3F.cxx +++ b/stella/src/emucore/Cart3F.cxx @@ -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: Cart3F.cxx,v 1.7 2005-06-27 23:40:35 urchlay Exp $ +// $Id: Cart3F.cxx,v 1.8 2005-07-09 00:59:12 urchlay Exp $ //============================================================================ #include @@ -67,8 +67,9 @@ void Cartridge3F::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)) { @@ -116,6 +117,10 @@ void Cartridge3F::poke(uInt16 address, uInt8 value) { bank(value); } + + // pass pokes through to the TIA. This uses a DIRTY HACK which will + // (probably) go away in the future. See System.cxx for details. + mySystem->tiaPoke(address, value); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/m6502/src/System.cxx b/stella/src/emucore/m6502/src/System.cxx index 120ee06e5..9c3d8c3a2 100644 --- a/stella/src/emucore/m6502/src/System.cxx +++ b/stella/src/emucore/m6502/src/System.cxx @@ -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: System.cxx,v 1.10 2005-06-21 05:00:46 urchlay Exp $ +// $Id: System.cxx,v 1.11 2005-07-09 00:59:13 urchlay Exp $ //============================================================================ #include @@ -21,6 +21,7 @@ #include "Device.hxx" #include "M6502.hxx" +#include "TIA.hxx" // FIXME: this is a hack #include "System.hxx" #include "Serializer.hxx" #include "Deserializer.hxx" @@ -349,3 +350,23 @@ void System::poke(uInt16 addr, uInt8 value) myDataBusState = value; } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// FIXME: dirty hack! This only exists for Cart3E and Cart3F to use, and +// then only until I come up a cleaner way to implement it. Call this method +// at your own peril! + +// Note that in some compilers (VC++?) you need to enable RTTI to make the +// dynamic_cast work. In g++, RTTI seems to be on by default. Do not +// compile Stella with -fno-rtti! + +// Sorry about the mess. -- B. +void System::tiaPoke(uInt16 addr, uInt8 value) +{ + TIA *t; + for(uInt32 i = 0; i < myNumberOfDevices; ++i) + { + if( (t = dynamic_cast(myDevices[i])) ) + t->poke(addr, value); + } +} diff --git a/stella/src/emucore/m6502/src/System.hxx b/stella/src/emucore/m6502/src/System.hxx index 33edb4bbb..a9be3b29f 100644 --- a/stella/src/emucore/m6502/src/System.hxx +++ b/stella/src/emucore/m6502/src/System.hxx @@ -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: System.hxx,v 1.7 2005-06-21 05:00:46 urchlay Exp $ +// $Id: System.hxx,v 1.8 2005-07-09 00:59:13 urchlay Exp $ //============================================================================ #ifndef SYSTEM_HXX @@ -47,7 +47,7 @@ class Deserializer; dynamic code for that page of memory. @author Bradford W. Mott - @version $Id: System.hxx,v 1.7 2005-06-21 05:00:46 urchlay Exp $ + @version $Id: System.hxx,v 1.8 2005-07-09 00:59:13 urchlay Exp $ */ class System { @@ -242,6 +242,18 @@ class System */ void poke(uInt16 address, uInt8 value); + /** + Force a poke to the TIA, bypassing the normal device selection. + This is used by the 3E and 3F bankswitch schemes, which attach + themselves to the address space at $00-$3F and need a way to + pass a poke there through to the TIA. + + I don't know what the correct way to do this is, but I'm pretty + certain this ain't it. As soon as I do know, this method goes away. + -- B. + */ + void System::tiaPoke(uInt16 addr, uInt8 value); + public: /** Structure used to specify access methods for a page diff --git a/stella/src/emucore/stella.pro b/stella/src/emucore/stella.pro index 81c0053d9..f65531c96 100644 --- a/stella/src/emucore/stella.pro +++ b/stella/src/emucore/stella.pro @@ -3,6 +3,20 @@ "Cartridge.Type" "3E" "" +"Cartridge.MD5" "9b150a42fc788960fbb4cbe250259ee2" +"Cartridge.Name" "3E Bankswitch Test (TIA @ $40)" +"Cartridge.Manufacturer" "Kroko" +"Cartridge.Type" "3E" +"Display.Format" "PAL" +"" + +"Cartridge.MD5" "792b1d93eb1d8045260c840b0688ec8f" +"Cartridge.Name" "3E Bankswitch Test (TIA @ $00)" +"Cartridge.Manufacturer" "Kroko" +"Cartridge.Type" "3E" +"Display.Format" "PAL" +"" + "Cartridge.MD5" "0685bd0bcb975ceef7041749a5454a48" "Cartridge.Name" "11 Sprite Demo (Piero Cavina) (PD)" "Cartridge.Manufacturer" "Piero Cavina"