Added skeleton class for CompuMate bankswitching.

Updated all bankswitch schemes for potential buffer overflow
issues.  Copying was being done without regard for the size of the
ROM buffer.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2325 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-01-02 20:31:42 +00:00
parent e7211a821b
commit c1e171ee44
43 changed files with 414 additions and 75 deletions

View File

@ -47,6 +47,7 @@
#include "CartFE.hxx"
#include "CartMC.hxx"
#include "CartCV.hxx"
#include "CartCM.hxx"
#include "CartUA.hxx"
#include "CartSB.hxx"
#include "CartX07.hxx"
@ -145,7 +146,7 @@ Cartridge* Cartridge::create(const uInt8* image, uInt32 size, string& md5,
else if(type == "4A50")
cartridge = new Cartridge4A50(image, size, settings);
else if(type == "4K")
cartridge = new Cartridge4K(image, settings);
cartridge = new Cartridge4K(image, size, settings);
else if(type == "AR")
cartridge = new CartridgeAR(image, size, settings);
else if(type == "DPC")
@ -153,43 +154,45 @@ Cartridge* Cartridge::create(const uInt8* image, uInt32 size, string& md5,
else if(type == "DPC+")
cartridge = new CartridgeDPCPlus(image, size, settings);
else if(type == "E0")
cartridge = new CartridgeE0(image, settings);
cartridge = new CartridgeE0(image, size, settings);
else if(type == "E7")
cartridge = new CartridgeE7(image, settings);
cartridge = new CartridgeE7(image, size, settings);
else if(type == "EF")
cartridge = new CartridgeEF(image, settings);
cartridge = new CartridgeEF(image, size, settings);
else if(type == "EFSC")
cartridge = new CartridgeEFSC(image, settings);
cartridge = new CartridgeEFSC(image, size, settings);
else if(type == "F4")
cartridge = new CartridgeF4(image, settings);
cartridge = new CartridgeF4(image, size, settings);
else if(type == "F4SC")
cartridge = new CartridgeF4SC(image, settings);
cartridge = new CartridgeF4SC(image, size, settings);
else if(type == "F6")
cartridge = new CartridgeF6(image, settings);
cartridge = new CartridgeF6(image, size, settings);
else if(type == "F6SC")
cartridge = new CartridgeF6SC(image, settings);
cartridge = new CartridgeF6SC(image, size, settings);
else if(type == "F8")
cartridge = new CartridgeF8(image, md5, settings);
cartridge = new CartridgeF8(image, size, md5, settings);
else if(type == "F8SC")
cartridge = new CartridgeF8SC(image, settings);
cartridge = new CartridgeF8SC(image, size, settings);
else if(type == "FA" || type == "FASC")
cartridge = new CartridgeFA(image, settings);
cartridge = new CartridgeFA(image, size, settings);
else if(type == "FE")
cartridge = new CartridgeFE(image, settings);
cartridge = new CartridgeFE(image, size, settings);
else if(type == "MC")
cartridge = new CartridgeMC(image, size, settings);
else if(type == "F0" || type == "MB")
cartridge = new CartridgeF0(image, settings);
cartridge = new CartridgeF0(image, size, settings);
else if(type == "CV")
cartridge = new CartridgeCV(image, size, settings);
else if(type == "CM")
cartridge = new CartridgeCM(image, size, settings);
else if(type == "UA")
cartridge = new CartridgeUA(image, settings);
cartridge = new CartridgeUA(image, size, settings);
else if(type == "0840")
cartridge = new Cartridge0840(image, settings);
cartridge = new Cartridge0840(image, size, settings);
else if(type == "SB")
cartridge = new CartridgeSB(image, size, settings);
else if(type == "X07")
cartridge = new CartridgeX07(image, settings);
cartridge = new CartridgeX07(image, size, settings);
else
cerr << "ERROR: Invalid cartridge type " << type << " ..." << endl;

View File

@ -24,11 +24,11 @@
#include "Cart0840.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge0840::Cartridge0840(const uInt8* image, const Settings& settings)
Cartridge0840::Cartridge0840(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
memcpy(myImage, image, BSPF_min(8192u, size));
createCodeAccessBase(8192);
// Remember startup bank

View File

@ -37,9 +37,10 @@ class Cartridge0840 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge0840(const uInt8* image, const Settings& settings);
Cartridge0840(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "Cart4K.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4K::Cartridge4K(const uInt8* image, const Settings& settings)
Cartridge4K::Cartridge4K(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 4096);
memcpy(myImage, image, BSPF_min(4096u, size));
createCodeAccessBase(4096);
}

View File

@ -39,9 +39,10 @@ class Cartridge4K : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge4K(const uInt8* image, const Settings& settings);
Cartridge4K(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

103
src/emucore/CartCM.cxx Normal file
View File

@ -0,0 +1,103 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2012 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#include <cassert>
#include <cstring>
#include "System.hxx"
#include "CartCM.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCM::CartridgeCM(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, BSPF_min(16384u, size));
createCodeAccessBase(16384);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCM::~CartridgeCM()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCM::reset()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCM::install(System& system)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeCM::peek(uInt16 address)
{
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCM::poke(uInt16 address, uInt8)
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCM::bank(uInt16 bank)
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt16 CartridgeCM::bank() const
{
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt16 CartridgeCM::bankCount() const
{
return 4;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCM::patch(uInt16 address, uInt8 value)
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt8* CartridgeCM::getImage(int& size) const
{
size = 16384;
return myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCM::save(Serializer& out) const
{
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeCM::load(Serializer& in)
{
return false;
}

177
src/emucore/CartCM.hxx Normal file
View File

@ -0,0 +1,177 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2012 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#ifndef CARTRIDGECM_HXX
#define CARTRIDGECM_HXX
class System;
#include "bspf.hxx"
#include "Cart.hxx"
/**
Cartridge class used for SpectraVideo CompuMate bankswitched games.
There are 4 4K banks selectable at $1000 - $1FFFF.
Bankswitching is done though the controller ports
INPT0: D7 = CTRL key input (0 on startup / 1 = key pressed)
INPT1: D7 = always HIGH input (tested at startup)
INPT2: D7 = always HIGH input (tested at startup)
INPT3: D7 = SHIFT key input (0 on startup / 1 = key pressed)
INPT4: D7 = keyboard row 1 input (0 = key pressed)
INPT5: D7 = keyboard row 3 input (0 = key pressed)
SWCHA: D7 = tape recorder I/O ?
D6 = 1 -> increase key collumn (0 to 9)
D5 = 1 -> reset key collumn to 0 (if D4 = 0)
D5 = 0 -> enable RAM writing (if D4 = 1)
D4 = 1 -> map 2K of RAM at $1800 - $1fff
D3 = keyboard row 4 input (0 = key pressed)
D2 = keyboard row 2 input (0 = key pressed)
D1 = bank select high bit
D0 = bank select low bit
Keyboard column numbering:
column 0 = 7 U J M
column 1 = 6 Y H N
column 2 = 8 I K ,
column 3 = 2 W S X
column 4 = 3 E D C
column 5 = 0 P ENTER SPACE
column 6 = 9 O L .
column 7 = 5 T G B
column 8 = 1 Q A Z
column 9 = 4 R F V
@author Stephen Anthony & z26 team
@version $Id$
*/
class CartridgeCM : public Cartridge
{
public:
/**
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeCM(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeCM();
public:
/**
Reset device to its power-on state
*/
void reset();
/**
Install cartridge in the specified system. Invoked by the system
when the cartridge is attached to it.
@param system The system the device should install itself in
*/
void install(System& system);
/**
Install pages for the specified bank in the system.
@param bank The bank that should be installed in the system
*/
bool bank(uInt16 bank);
/**
Get the current bank.
*/
uInt16 bank() const;
/**
Query the number of banks supported by the cartridge.
*/
uInt16 bankCount() const;
/**
Patch the cartridge ROM.
@param address The ROM address to patch
@param value The value to place into the address
@return Success or failure of the patch operation
*/
bool patch(uInt16 address, uInt8 value);
/**
Access the internal ROM image for this cartridge.
@param size Set to the size of the internal ROM image data
@return A pointer to the internal ROM image data
*/
const uInt8* getImage(int& size) const;
/**
Save the current state of this cart to the given Serializer.
@param out The Serializer object to use
@return False on any errors, else true
*/
bool save(Serializer& out) const;
/**
Load the current state of this cart from the given Serializer.
@param in The Serializer object to use
@return False on any errors, else true
*/
bool load(Serializer& in);
/**
Get a descriptor for the device name (used in error checking).
@return The name of the object
*/
string name() const { return "CartridgeCM"; }
public:
/**
Get the byte at the specified address.
@return The byte at the specified address
*/
uInt8 peek(uInt16 address);
/**
Change the byte at the specified address to the given value
@param address The address where the value should be stored
@param value The value to be stored at the address
@return True if the poke changed the device address space, else false
*/
bool poke(uInt16 address, uInt8 value);
private:
// Indicates which bank is currently active
uInt16 myCurrentBank;
// The 16K ROM image of the cartridge
uInt8 myImage[16384];
};
#endif

View File

@ -24,11 +24,11 @@
#include "CartE0.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE0::CartridgeE0(const uInt8* image, const Settings& settings)
CartridgeE0::CartridgeE0(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
memcpy(myImage, image, BSPF_min(8192u, size));
createCodeAccessBase(8192);
}

View File

@ -48,9 +48,10 @@ class CartridgeE0 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeE0(const uInt8* image, const Settings& settings);
CartridgeE0(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartE7.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE7::CartridgeE7(const uInt8* image, const Settings& settings)
CartridgeE7::CartridgeE7(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 16384);
memcpy(myImage, image, BSPF_min(16384u, size));
createCodeAccessBase(16384 + 2048);
// This cart can address a 1024 byte bank of RAM @ 0x1000

View File

@ -65,9 +65,10 @@ class CartridgeE7 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeE7(const uInt8* image, const Settings& settings);
CartridgeE7(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartEF.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeEF::CartridgeEF(const uInt8* image, const Settings& settings)
CartridgeEF::CartridgeEF(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 65536);
memcpy(myImage, image, BSPF_min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank

View File

@ -43,9 +43,10 @@ class CartridgeEF : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeEF(const uInt8* image, const Settings& settings);
CartridgeEF(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartEFSC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeEFSC::CartridgeEFSC(const uInt8* image, const Settings& settings)
CartridgeEFSC::CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 65536);
memcpy(myImage, image, BSPF_min(65536u, size));
createCodeAccessBase(65536);
// This cart contains 128 bytes extended RAM @ 0x1000

View File

@ -43,9 +43,10 @@ class CartridgeEFSC : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeEFSC(const uInt8* image, const Settings& settings);
CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartF0.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF0::CartridgeF0(const uInt8* image, const Settings& settings)
CartridgeF0::CartridgeF0(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 65536);
memcpy(myImage, image, BSPF_min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank

View File

@ -40,9 +40,10 @@ class CartridgeF0 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF0(const uInt8* image, const Settings& settings);
CartridgeF0(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -25,11 +25,11 @@
#include "CartF4.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF4::CartridgeF4(const uInt8* image, const Settings& settings)
CartridgeF4::CartridgeF4(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 32768);
memcpy(myImage, image, BSPF_min(32768u, size));
createCodeAccessBase(32768);
// Remember startup bank

View File

@ -39,9 +39,10 @@ class CartridgeF4 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF4(const uInt8* image, const Settings& settings);
CartridgeF4(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartF4SC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF4SC::CartridgeF4SC(const uInt8* image, const Settings& settings)
CartridgeF4SC::CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 32768);
memcpy(myImage, image, BSPF_min(32768u, size));
createCodeAccessBase(32768);
// This cart contains 128 bytes extended RAM @ 0x1000

View File

@ -39,9 +39,10 @@ class CartridgeF4SC : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF4SC(const uInt8* image, const Settings& settings);
CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartF6.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6::CartridgeF6(const uInt8* image, const Settings& settings)
CartridgeF6::CartridgeF6(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 16384);
memcpy(myImage, image, BSPF_min(16384u, size));
createCodeAccessBase(16384);
// Remember startup bank

View File

@ -39,9 +39,10 @@ class CartridgeF6 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF6(const uInt8* image, const Settings& settings);
CartridgeF6(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartF6SC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6SC::CartridgeF6SC(const uInt8* image, const Settings& settings)
CartridgeF6SC::CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 16384);
memcpy(myImage, image, BSPF_min(16384u, size));
createCodeAccessBase(16384);
// This cart contains 128 bytes extended RAM @ 0x1000

View File

@ -39,9 +39,10 @@ class CartridgeF6SC : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF6SC(const uInt8* image, const Settings& settings);
CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,12 +24,12 @@
#include "CartF8.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8::CartridgeF8(const uInt8* image, const string& md5,
CartridgeF8::CartridgeF8(const uInt8* image, uInt32 size, const string& md5,
const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
memcpy(myImage, image, BSPF_min(8192u, size));
createCodeAccessBase(8192);
// Normally bank 1 is the reset bank, unless we're dealing with ROMs

View File

@ -39,11 +39,13 @@ class CartridgeF8 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param md5 MD5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF8(const uInt8* image, const string& md5, const Settings& settings);
CartridgeF8(const uInt8* image, uInt32 size, const string& md5,
const Settings& settings);
/**
Destructor
*/

View File

@ -24,11 +24,11 @@
#include "CartF8SC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8SC::CartridgeF8SC(const uInt8* image, const Settings& settings)
CartridgeF8SC::CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
memcpy(myImage, image, BSPF_min(8192u, size));
createCodeAccessBase(8192);
// This cart contains 128 bytes extended RAM @ 0x1000

View File

@ -39,9 +39,10 @@ class CartridgeF8SC : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF8SC(const uInt8* image, const Settings& settings);
CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartFA.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFA::CartridgeFA(const uInt8* image, const Settings& settings)
CartridgeFA::CartridgeFA(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 12288);
memcpy(myImage, image, BSPF_min(12288u, size));
createCodeAccessBase(12288);
// This cart contains 256 bytes extended RAM @ 0x1000

View File

@ -39,9 +39,10 @@ class CartridgeFA : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeFA(const uInt8* image, const Settings& settings);
CartridgeFA(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,14 +24,14 @@
#include "CartFE.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFE::CartridgeFE(const uInt8* image, const Settings& settings)
CartridgeFE::CartridgeFE(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings),
myLastAddress1(0),
myLastAddress2(0),
myLastAddressChanged(false)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
memcpy(myImage, image, BSPF_min(8192u, size));
// We use System::PageAccess.codeAccessBase, but don't allow its use
// through a pointer, since the address space of FE carts can change

View File

@ -54,9 +54,10 @@ class CartridgeFE : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeFE(const uInt8* image, const Settings& settings);
CartridgeFE(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -24,11 +24,11 @@
#include "CartUA.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeUA::CartridgeUA(const uInt8* image, const Settings& settings)
CartridgeUA::CartridgeUA(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
memcpy(myImage, image, BSPF_min(8192u, size));
createCodeAccessBase(8192);
// Remember startup bank

View File

@ -40,9 +40,10 @@ class CartridgeUA : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeUA(const uInt8* image, const Settings& settings);
CartridgeUA(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -26,11 +26,11 @@
#include "CartX07.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeX07::CartridgeX07(const uInt8* image, const Settings& settings)
CartridgeX07::CartridgeX07(const uInt8* image, uInt32 size, const Settings& settings)
: Cartridge(settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 65536);
memcpy(myImage, image, BSPF_min(65536u, size));
createCodeAccessBase(65536);
// Remember startup bank

View File

@ -49,9 +49,10 @@ class CartridgeX07 : public Cartridge
Create a new cartridge using the specified image
@param image Pointer to the ROM image
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeX07(const uInt8* image, const Settings& settings);
CartridgeX07(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor

View File

@ -37,6 +37,35 @@
The CompuMate was equipped with an audio jack for use with a standard tape
connector as a possibility of permanent data storage.
Bankswitching is done though the controller ports
INPT0: D7 = CTRL key input (0 on startup / 1 = key pressed)
INPT1: D7 = always HIGH input (tested at startup)
INPT2: D7 = always HIGH input (tested at startup)
INPT3: D7 = SHIFT key input (0 on startup / 1 = key pressed)
INPT4: D7 = keyboard row 1 input (0 = key pressed)
INPT5: D7 = keyboard row 3 input (0 = key pressed)
SWCHA: D7 = tape recorder I/O ?
D6 = 1 -> increase key collumn (0 to 9)
D5 = 1 -> reset key collumn to 0 (if D4 = 0)
D5 = 0 -> enable RAM writing (if D4 = 1)
D4 = 1 -> map 2K of RAM at $1800 - $1fff
D3 = keyboard row 4 input (0 = key pressed)
D2 = keyboard row 2 input (0 = key pressed)
D1 = bank select high bit
D0 = bank select low bit
Keyboard column numbering:
column 0 = 7 U J M
column 1 = 6 Y H N
column 2 = 8 I K ,
column 3 = 2 W S X
column 4 = 3 E D C
column 5 = 0 P ENTER SPACE
column 6 = 9 O L .
column 7 = 5 T G B
column 8 = 1 Q A Z
column 9 = 4 R F V
This code was heavily borrowed from z26, and uses conventions defined
there. Specifically, IOPortA is treated as a complete uInt8, whereas
the Stella core actually stores this information in boolean arrays

View File

@ -2063,7 +2063,7 @@ static const char* DefProps[DEF_PROPS_SIZE][20] = {
{ "a1ccf58ca588bd3e0fb35a1e2a41b423", "", "", "Greeting Cart Green Dress (SnailSoft)(PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "a1ead9c181d67859aa93c44e40f1709c", "American Videogame - Dunhill Electronics, Darrell Wagner, Todd Clark Holm, John Simonds", "", "Tax Avoiders (1982) (American Videogame)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "a1f9159121142d42e63e6fb807d337aa", "Quelle", "700.223 1 - 781627", "Der moderne Ritter (1983) (Quelle) (PAL)", "AKA Fast Eddie", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "a204cd4fb1944c86e800120706512a64", "Coleco", "2511", "Smurfs Save the Day (1983) (Coleco)", "Uses the Kid Vid Controller", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "a204cd4fb1944c86e800120706512a64", "Coleco", "2511", "Smurfs Save the Day (1983) (Coleco)", "Uses the Kid Vid Controller", "", "", "", "", "", "", "", "", "KIDVID", "", "", "", "", "", "" },
{ "a20b7abbcdf90fbc29ac0fafa195bd12", "Quelle", "719.383 2 - 649635 - 781393", "Motocross (1983) (Quelle) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "a20d931a8fddcd6f6116ed21ff5c4832", "Apollo - Games by Apollo, Ed Salvo, Byron Parks", "AP-2003", "Racquetball (1981) (Apollo) [a]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "a2170318a8ef4b50a1b1d38567c220d6", "Amiga", "3125", "Surf's Up (1983) (Amiga) (Prototype) [a]", "Uses the Amiga Joyboard", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -2486,7 +2486,7 @@ static const char* DefProps[DEF_PROPS_SIZE][20] = {
{ "c5930d0e8cdae3e037349bfa08e871be", "Atari, Howard Scott Warshaw - Sears", "CX2655 - 49-75167", "Yars' Revenge (1982) (Atari)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "c59633dbebd926c150fb6d30b0576405", "Telegames", "5861 A030", "Bogey Blaster (1989) (Telegames)", "AKA Air Raiders", "Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "c5a76bafc4676edb76e0126fb9f0fb2d", "Charles Morgan", "", "Zero Patrol (Charles Morgan) (Hack)", "Hack of Moon Patrol", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "c5bab953ac13dbb2cba03cd0684fb125", "SpiceWare - Darrell Spice Jr.", "", "Stay Frosty (SpiceWare)", "Part of Stella's Stocking 2007 Xmas compilation", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "c5bab953ac13dbb2cba03cd0684fb125", "SpiceWare - Darrell Spice Jr.", "", "Stay Frosty (SpiceWare)", "Part of Stella's Stocking 2007 Xmas compilation", "Homebrew", "STEREO", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "c5c7cc66febf2d4e743b4459de7ed868", "Atari, Jerome Domurat, Steve Woita", "CX2696", "Asterix (1983) (Atari) (PAL) [a]", "AKA Taz", "Extremely Rare", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "c5d2834bf98e90245e545573eb7e6bbc", "CCE", "", "Snoopy and the Red Baron (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "c5dd8399257d8862f3952be75c23e0eb", "Atari - GCC", "CX2680", "RealSports Tennis (1982) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@ -2946,7 +2946,7 @@ static const char* DefProps[DEF_PROPS_SIZE][20] = {
{ "e7864caaf9ec49ed67b1904ce8602690", "", "", "Donkey Kong 2K3 Pic (PD)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e7a758bb0b43d0f7004e92b9abf4bc83", "", "", "Troll's Adventure (Hack)", "Hack of Adventure", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e7dd8c2e6c100044002c1086d02b366e", "Activision, Steve Cartwright - Ariola", "EAX-013, PAX-013, 711 013-720", "Barnstorming (1982) (Activision) (PAL)", "AKA Die tollkeuhnen Flieger", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e7f005ddb6902c648de098511f6ae2e5", "Spectravideo - Universum", "SV-010", "CompuMate (1983) (Spectravideo) (PAL)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "e7f005ddb6902c648de098511f6ae2e5", "Spectravideo - Universum", "SV-010", "CompuMate (1983) (Spectravideo) (PAL)", "", "", "", "CM", "", "", "", "", "COMPUMATE", "COMPUMATE", "", "", "", "", "YES", "" },
{ "e800e4aec7c6c54c9cf3db0d1d030058", "", "", "Qb (2.06) (Retroactive) (Stella)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "e80a4026d29777c3c7993fbfaee8920f", "", "", "Frisco (Unknown)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "e823b13751e4388f1f2a375d3560a8d7", "Arcadia Corporation, Stephen Harland Landrum", "AR-4105", "Official Frogger (Preview) (1983) (Arcadia) [a]", "", "", "", "", "", "", "", "", "", "", "", "", "32", "", "", "" },
@ -3051,7 +3051,7 @@ static const char* DefProps[DEF_PROPS_SIZE][20] = {
{ "f047df70d3d08e331122cd2de61d6af8", "Dave Neuman", "", "Space Battle (NTSC)", "", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "f04ee80011d95798006378643650aaa7", "Atari, Bill Aspromonte, John Russell, Michael Sierchio, Robert Zdybel", "CX26114", "Pigs in Space (1983) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "f0536303f49006806bac3aec15738336", "Arcadia Corporation, Dennis Caswell", "AR-4200", "Escape from the Mindmaster (4 of 4) (1982) (Arcadia)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "f0541d2f7cda5ec7bab6d62b6128b823", "Atari, Paul Donaldson", "", "Bionic Breakthrough (1984) (Atari) (Prototype)", "Uses Mindlink Controller (left only)", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "f0541d2f7cda5ec7bab6d62b6128b823", "Atari, Paul Donaldson", "", "Bionic Breakthrough (1984) (Atari) (Prototype)", "Uses Mindlink Controller (left only)", "Prototype", "", "", "", "", "", "", "MINDLINK", "", "", "", "", "", "", "" },
{ "f060826626aac9e0d8cda0282f4b7fc3", "Atari, David Crane - Sears", "CX2605 - 6-99822, 49-75109", "Outlaw (1978) (Atari) (4K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "f0631c6675033428238408885d7e4fde", "Paul Slocum", "", "Test Cart (2002) (Paul Slocum)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "" },
{ "f066bea7ab0a37b83c83c924a87c5b67", "", "", "Air Raiders (1982) (Unknown)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

View File

@ -10,6 +10,7 @@ MODULE_OBJS := \
src/emucore/Cart4K.o \
src/emucore/CartAR.o \
src/emucore/CartCV.o \
src/emucore/CartCM.o \
src/emucore/Cart.o \
src/emucore/CartDPC.o \
src/emucore/CartDPCPlus.o \

View File

@ -12103,6 +12103,7 @@
"Cartridge.ModelNo" "2511"
"Cartridge.Name" "Smurfs Save the Day (1983) (Coleco)"
"Cartridge.Note" "Uses the Kid Vid Controller"
"Controller.Right" "KIDVID"
""
"Cartridge.MD5" "a20d931a8fddcd6f6116ed21ff5c4832"
@ -17331,6 +17332,9 @@
"Cartridge.Manufacturer" "Spectravideo - Universum"
"Cartridge.ModelNo" "SV-010"
"Cartridge.Name" "CompuMate (1983) (Spectravideo) (PAL)"
"Cartridge.Type" "CM"
"Controller.Left" "COMPUMATE"
"Controller.Right" "COMPUMATE"
"Display.Phosphor" "YES"
""
@ -17783,6 +17787,7 @@
"Cartridge.Name" "Bionic Breakthrough (1984) (Atari) (Prototype)"
"Cartridge.Note" "Uses Mindlink Controller (left only)"
"Cartridge.Rarity" "Prototype"
"Controller.Left" "MINDLINK"
""
"Cartridge.MD5" "eeb92f3f46df841487d1504f2896d61a"
@ -19320,6 +19325,7 @@
"Cartridge.Name" "Stay Frosty (SpiceWare)"
"Cartridge.Note" "Part of Stella's Stocking 2007 Xmas compilation"
"Cartridge.Rarity" "Homebrew"
"Cartridge.Sound" "STEREO"
"Display.Phosphor" "YES"
""

View File

@ -133,7 +133,7 @@ GameInfoDialog::GameInfoDialog(
ypos += lineHeight + 3;
new StaticTextWidget(myTab, font, xpos, ypos+1, lwidth, fontHeight,
"Type:", kTextAlignLeft);
pwidth = font.getStringWidth("EFSC (64K H. Runner + ram)");
pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)");
items.clear();
items.push_back("Auto-detect", "AUTO-DETECT");
items.push_back("0840 (8K ECONObank)", "0840" );
@ -149,6 +149,7 @@ GameInfoDialog::GameInfoDialog(
items.push_back("4K (4K Atari)", "4K" );
items.push_back("AR (Supercharger)", "AR" );
items.push_back("CV (Commavid extra ram)", "CV" );
items.push_back("CM (SpectraVideo CompuMate)","CM" );
items.push_back("DPC (Pitfall II)", "DPC" );
items.push_back("DPC+ (Enhanced DPC)", "DPC+" );
items.push_back("E0 (8K Parker Bros)", "E0" );

View File

@ -44,7 +44,7 @@ GlobalPropsDialog::
buttonHeight = font.getLineHeight() + 4;
int xpos, ypos;
int lwidth = font.getStringWidth("Right Difficulty: "),
pwidth = font.getStringWidth("EFSC (64K H. Runner + ram)");
pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)");
WidgetArray wid;
StringMap items;
@ -79,6 +79,7 @@ GlobalPropsDialog::
items.push_back("4K (4K Atari)", "4K" );
items.push_back("AR (Supercharger)", "AR" );
items.push_back("CV (Commavid extra ram)", "CV" );
items.push_back("CM (SpectraVideo CompuMate)","CM" );
items.push_back("DPC (Pitfall II)", "DPC" );
items.push_back("DPC+ (Enhanced DPC)", "DPC+" );
items.push_back("E0 (8K Parker Bros)", "E0" );