Support debugger bankswitching in almost all cart types.

Support patching ROM in almost all cart types.

The ones that aren't supported are going to take a bit more thought.

Still TODO is to support the extra RAM in carts that have it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@572 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-06-28 01:15:17 +00:00
parent 8aeb65d4b7
commit 32e1296946
28 changed files with 294 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: Cart.cxx,v 1.11 2005-06-27 15:07:46 urchlay Exp $
// $Id: Cart.cxx,v 1.12 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -271,13 +271,13 @@ Cartridge& Cartridge::operator = (const Cartridge&)
// doesn't support bankswitching at all.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Cartridge::bank() {
return 0;
void Cartridge::bank(uInt16 b) {
// do nothing.
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge::bank(uInt16 b) {
// do nothing.
int Cartridge::bank() {
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: Cart.hxx,v 1.5 2005-06-27 15:07:54 urchlay Exp $
// $Id: Cart.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGE_HXX
@ -31,7 +31,7 @@ class System;
game and handles any bankswitching performed by the cartridge.
@author Bradford W. Mott
@version $Id: Cart.hxx,v 1.5 2005-06-27 15:07:54 urchlay Exp $
@version $Id: Cart.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
*/
class Cartridge : public Device
{
@ -59,8 +59,8 @@ class Cartridge : public Device
*/
virtual ~Cartridge();
virtual int bank(); // get current bank (-1 if no bankswitching supported)
virtual void bank(uInt16 b); // set bank
virtual int bank(); // get current bank (-1 if no bankswitching supported)
virtual int bankCount(); // count # of banks
virtual bool patch(uInt16 address, uInt8 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: CartDPC.cxx,v 1.10 2005-06-16 00:55:57 stephena Exp $
// $Id: CartDPC.cxx,v 1.11 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -422,6 +422,14 @@ void CartridgeDPC::poke(uInt16 address, uInt8 value)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPC::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
myProgramImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDPC::bank(uInt16 bank)
{
@ -445,6 +453,17 @@ void CartridgeDPC::bank(uInt16 bank)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeDPC::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeDPC::bankCount() {
return 2; // TODO: support the display ROM somehow
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeDPC::save(Serializer& out)
{

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: CartDPC.hxx,v 1.5 2005-06-16 00:55:57 stephena Exp $
// $Id: CartDPC.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEDCP_HXX
@ -32,7 +32,7 @@ class Deserializer;
see David P. Crane's United States Patent Number 4,644,495.
@author Bradford W. Mott
@version $Id: CartDPC.hxx,v 1.5 2005-06-16 00:55:57 stephena Exp $
@version $Id: CartDPC.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeDPC : public Cartridge
{
@ -109,13 +109,17 @@ class CartridgeDPC : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
private:
/**
Install pages for the specified bank in the system
@param bank The bank that should be installed in the system
*/
void bank(uInt16 bank);
int bank(); // get current bank (-1 if no bankswitching supported)
int bankCount(); // count # of banks
bool patch(uInt16 address, uInt8 value);
private:
/**
Clocks the random number generator to move it to its next state

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: CartE0.cxx,v 1.5 2005-06-16 00:55:57 stephena Exp $
// $Id: CartE0.cxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -132,6 +132,13 @@ void CartridgeE0::poke(uInt16 address, uInt8)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE0::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentSlice[address >> 10] << 10) + (address & 0x03FF)] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE0::segmentZero(uInt16 slice)
{

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: CartE0.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
// $Id: CartE0.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEE0_HXX
@ -36,7 +36,7 @@ class Deserializer;
always points to the last 1K of the ROM image.
@author Bradford W. Mott
@version $Id: CartE0.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
@version $Id: CartE0.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeE0 : public Cartridge
{
@ -106,6 +106,8 @@ class CartridgeE0 : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
private:
/**
Install the specified slice for segment zero

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: CartE7.cxx,v 1.7 2005-06-27 12:43:49 urchlay Exp $
// $Id: CartE7.cxx,v 1.8 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -137,6 +137,13 @@ void CartridgeE7::poke(uInt16 address, uInt8)
// way page accessing has been setup
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeE7::patch(uInt16 address, uInt8 value)
{
myImage[(myCurrentSlice[address >> 11] << 11) + (address & 0x07FF)] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7::bank(uInt16 slice)
{

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: CartE7.hxx,v 1.5 2005-06-27 12:43:49 urchlay Exp $
// $Id: CartE7.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEE7_HXX
@ -53,7 +53,7 @@ class Deserializer;
here by accessing 1FF8 to 1FFB.
@author Bradford W. Mott
@version $Id: CartE7.hxx,v 1.5 2005-06-27 12:43:49 urchlay Exp $
@version $Id: CartE7.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeE7 : public Cartridge
{
@ -123,6 +123,8 @@ class CartridgeE7 : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
/**
Map the specfied bank into the first segment

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: CartF4.cxx,v 1.3 2005-06-16 00:55:57 stephena Exp $
// $Id: CartF4.cxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -102,6 +102,14 @@ void CartridgeF4::poke(uInt16 address, uInt8)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
myImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4::bank(uInt16 bank)
{
@ -125,6 +133,16 @@ void CartridgeF4::bank(uInt16 bank)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF4::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF4::bankCount() {
return 8;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4::save(Serializer& out)
{

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: CartF4.hxx,v 1.3 2005-06-16 00:55:57 stephena Exp $
// $Id: CartF4.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEF4_HXX
@ -31,7 +31,7 @@ class Deserializer;
are eight 4K banks.
@author Bradford W. Mott
@version $Id: CartF4.hxx,v 1.3 2005-06-16 00:55:57 stephena Exp $
@version $Id: CartF4.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeF4 : public Cartridge
{
@ -101,7 +101,8 @@ class CartridgeF4 : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
private:
bool patch(uInt16 address, uInt8 value);
/**
Install pages for the specified bank in the system
@ -109,6 +110,10 @@ class CartridgeF4 : public Cartridge
*/
void bank(uInt16 bank);
int bank();
int bankCount();
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;

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: CartF4SC.cxx,v 1.5 2005-06-16 00:55:57 stephena Exp $
// $Id: CartF4SC.cxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -132,6 +132,14 @@ void CartridgeF4SC::poke(uInt16 address, uInt8)
// has been setup
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4SC::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
myImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF4SC::bank(uInt16 bank)
{
@ -155,6 +163,16 @@ void CartridgeF4SC::bank(uInt16 bank)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF4SC::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF4SC::bankCount() {
return 8;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF4SC::save(Serializer& out)
{

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: CartF4SC.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
// $Id: CartF4SC.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEF4SC_HXX
@ -31,7 +31,7 @@ class Deserializer;
128 bytes of RAM. There are eight 4K banks.
@author Bradford W. Mott
@version $Id: CartF4SC.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
@version $Id: CartF4SC.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeF4SC : public Cartridge
{
@ -101,7 +101,8 @@ class CartridgeF4SC : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
private:
bool patch(uInt16 address, uInt8 value);
/**
Install pages for the specified bank in the system
@ -109,6 +110,9 @@ class CartridgeF4SC : public Cartridge
*/
void bank(uInt16 bank);
int bank();
int bankCount();
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;

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: CartF6.cxx,v 1.6 2005-06-27 23:40:36 urchlay Exp $
// $Id: CartF6.cxx,v 1.7 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -174,6 +174,16 @@ void CartridgeF6::bank(uInt16 bank)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF6::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF6::bankCount() {
return 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6::save(Serializer& out)
{

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: CartF6.hxx,v 1.5 2005-06-27 23:40:36 urchlay Exp $
// $Id: CartF6.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEF6_HXX
@ -31,7 +31,7 @@ class Deserializer;
are four 4K banks.
@author Bradford W. Mott
@version $Id: CartF6.hxx,v 1.5 2005-06-27 23:40:36 urchlay Exp $
@version $Id: CartF6.hxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeF6 : public Cartridge
{
@ -103,7 +103,6 @@ class CartridgeF6 : public Cartridge
bool patch(uInt16 address, uInt8 value);
private:
/**
Install pages for the specified bank in the system
@ -111,6 +110,9 @@ class CartridgeF6 : public Cartridge
*/
void bank(uInt16 bank);
int bank();
int bankCount();
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;

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: CartF6SC.cxx,v 1.5 2005-06-16 00:55:57 stephena Exp $
// $Id: CartF6SC.cxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -176,6 +176,14 @@ void CartridgeF6SC::poke(uInt16 address, uInt8)
// has been setup
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6SC::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
myImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF6SC::bank(uInt16 bank)
{
@ -199,6 +207,16 @@ void CartridgeF6SC::bank(uInt16 bank)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF6SC::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF6SC::bankCount() {
return 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF6SC::save(Serializer& out)
{

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: CartF6SC.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
// $Id: CartF6SC.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEF6SC_HXX
@ -31,7 +31,7 @@ class Deserializer;
128 bytes of RAM. There are four 4K banks.
@author Bradford W. Mott
@version $Id: CartF6SC.hxx,v 1.4 2005-06-16 00:55:57 stephena Exp $
@version $Id: CartF6SC.hxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeF6SC : public Cartridge
{
@ -101,7 +101,8 @@ class CartridgeF6SC : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
private:
bool patch(uInt16 address, uInt8 value);
/**
Install pages for the specified bank in the system
@ -109,6 +110,9 @@ class CartridgeF6SC : public Cartridge
*/
void bank(uInt16 bank);
int bank();
int bankCount();
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;

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: CartF8SC.cxx,v 1.4 2005-06-16 01:11:26 stephena Exp $
// $Id: CartF8SC.cxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -156,6 +156,24 @@ void CartridgeF8SC::poke(uInt16 address, uInt8)
// has been setup
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF8SC::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeF8SC::bankCount() {
return 2;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeF8SC::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
myImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeF8SC::bank(uInt16 bank)
{

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: CartF8SC.hxx,v 1.3 2005-06-16 01:11:26 stephena Exp $
// $Id: CartF8SC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEF8SC_HXX
@ -31,7 +31,7 @@ class Deserializer;
128 bytes of RAM. There are two 4K banks.
@author Bradford W. Mott
@version $Id: CartF8SC.hxx,v 1.3 2005-06-16 01:11:26 stephena Exp $
@version $Id: CartF8SC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeF8SC : public Cartridge
{
@ -101,7 +101,8 @@ class CartridgeF8SC : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
private:
bool patch(uInt16 address, uInt8 value);
/**
Install pages for the specified bank in the system
@ -109,6 +110,10 @@ class CartridgeF8SC : public Cartridge
*/
void bank(uInt16 bank);
int bank();
int bankCount();
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;

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: CartFASC.cxx,v 1.4 2005-06-16 01:11:27 stephena Exp $
// $Id: CartFASC.cxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -166,6 +166,14 @@ void CartridgeFASC::poke(uInt16 address, uInt8)
// has been setup
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFASC::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
myImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeFASC::bank(uInt16 bank)
{
@ -189,6 +197,16 @@ void CartridgeFASC::bank(uInt16 bank)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeFASC::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeFASC::bankCount() {
return 3;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFASC::save(Serializer& out)
{

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: CartFASC.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
// $Id: CartFASC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEFASC_HXX
@ -31,7 +31,7 @@ class Deserializer;
three 4K banks and 256 bytes of RAM.
@author Bradford W. Mott
@version $Id: CartFASC.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
@version $Id: CartFASC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeFASC : public Cartridge
{
@ -101,7 +101,8 @@ class CartridgeFASC : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
private:
bool patch(uInt16 address, uInt8 value);
/**
Install pages for the specified bank in the system
@ -109,6 +110,9 @@ class CartridgeFASC : public Cartridge
*/
void bank(uInt16 bank);
int bank();
int bankCount();
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;

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: CartFE.cxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
// $Id: CartFE.cxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -82,6 +82,13 @@ void CartridgeFE::poke(uInt16, uInt8)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFE::patch(uInt16 address, uInt8 value)
{
myImage[(address & 0x0FFF) + (((address & 0x2000) == 0) ? 4096 : 0)] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeFE::save(Serializer& out)
{

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: CartFE.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
// $Id: CartFE.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEFE_HXX
@ -43,7 +43,7 @@ class Deserializer;
monitoring the bus.
@author Bradford W. Mott
@version $Id: CartFE.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
@version $Id: CartFE.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeFE : public Cartridge
{
@ -113,6 +113,8 @@ class CartridgeFE : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
private:
// The 8K ROM image of the cartridge
uInt8 myImage[8192];

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: CartMB.cxx,v 1.4 2005-06-16 01:11:27 stephena Exp $
// $Id: CartMB.cxx,v 1.5 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -97,6 +97,14 @@ void CartridgeMB::poke(uInt16 address, uInt8)
if(address == 0x0FF0) incbank();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMB::patch(uInt16 address, uInt8 value)
{
address = address & 0x0FFF;
myImage[myCurrentBank * 4096 + address] = value;
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMB::incbank()
{
@ -121,6 +129,22 @@ void CartridgeMB::incbank()
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMB::bank(uInt16 b) {
myCurrentBank = (b - 1);
incbank();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeMB::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeMB::bankCount() {
return 16;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMB::save(Serializer& out)
{

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: CartMB.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
// $Id: CartMB.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEMB_HXX
@ -32,7 +32,7 @@ class Deserializer;
Accessing $1FF0 switches to next bank.
@author Eckhard Stolberg
@version $Id: CartMB.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
@version $Id: CartMB.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeMB : public Cartridge
{
@ -102,6 +102,14 @@ class CartridgeMB : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
void bank(uInt16 b);
int bank();
int bankCount();
private:
/**
Install pages for the next bank in the system

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: CartMC.cxx,v 1.5 2005-06-16 01:11:27 stephena Exp $
// $Id: CartMC.cxx,v 1.6 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <assert.h>
@ -219,6 +219,13 @@ void CartridgeMC::poke(uInt16 address, uInt8 value)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMC::patch(uInt16 address, uInt8 value)
{
// TODO: implement
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeMC::save(Serializer& out)
{

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: CartMC.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
// $Id: CartMC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEMC_HXX
@ -135,7 +135,7 @@ class Deserializer;
@author Bradford W. Mott
@version $Id: CartMC.hxx,v 1.3 2005-06-16 01:11:27 stephena Exp $
@version $Id: CartMC.hxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeMC : public Cartridge
{
@ -208,6 +208,8 @@ class CartridgeMC : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
private:
// Indicates which block is currently active for the four segments
uInt8 myCurrentBlock[4];

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: CartUA.cxx,v 1.3 2005-06-16 00:55:57 stephena Exp $
// $Id: CartUA.cxx,v 1.4 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#include <cassert>
@ -137,6 +137,15 @@ void CartridgeUA::poke(uInt16 address, uInt8 value)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeUA::patch(uInt16 address, uInt8 value)
{
address &= 0x0fff;
myImage[myCurrentBank * 4096] = value;
bank(myCurrentBank); // TODO: see if this is really necessary
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeUA::bank(uInt16 bank)
{
@ -159,6 +168,16 @@ void CartridgeUA::bank(uInt16 bank)
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeUA::bank() {
return myCurrentBank;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartridgeUA::bankCount() {
return 2;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeUA::save(Serializer& out)
{

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: CartUA.hxx,v 1.2 2005-06-16 00:55:57 stephena Exp $
// $Id: CartUA.hxx,v 1.3 2005-06-28 01:15:17 urchlay Exp $
//============================================================================
#ifndef CARTRIDGEUA_HXX
@ -32,7 +32,7 @@ class Deserializer;
are two 4K banks.
@author Bradford W. Mott
@version $Id: CartUA.hxx,v 1.2 2005-06-16 00:55:57 stephena Exp $
@version $Id: CartUA.hxx,v 1.3 2005-06-28 01:15:17 urchlay Exp $
*/
class CartridgeUA : public Cartridge
{
@ -102,7 +102,8 @@ class CartridgeUA : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
private:
bool patch(uInt16 address, uInt8 value);
/**
Install pages for the specified bank in the system
@ -110,6 +111,10 @@ class CartridgeUA : public Cartridge
*/
void bank(uInt16 bank);
int bank();
int bankCount();
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;