3E and 3F bankswitching now pass pokes to addresses $00-$3F through to

the TIA. For 3E, this means game authors don't need to access the TIA
through a mirror (and there's no reason they should on real hardware,
either). It also means Armin's test cart image works.

3F ROMs still need to use a mirror: poking to $00-$2C writes to the
TIA *and* switches banks, which is not that you'd want to do. Stella's
behaviour now matches a real Tigervision 3F cart, for what it's worth.

Unfortunately I had to do something nasty to allow the Cart classes to
directly access the TIA: see System.hxx and System.cxx (search for
the tiaPoke() method.)


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@627 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-09 00:59:13 +00:00
parent 090bf3dc3e
commit 9f354edb8a
5 changed files with 67 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: 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 <assert.h>
@ -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);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: 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 <assert.h>
@ -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);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: 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 <assert.h>
@ -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<TIA*>(myDevices[i])) )
t->poke(addr, value);
}
}

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: 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

View File

@ -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"