2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//
|
2010-04-10 21:37:23 +00:00
|
|
|
// Copyright (c) 1995-2010 by Bradford W. Mott, Stephen Anthony
|
|
|
|
// and the Stella Team
|
2001-12-27 19:54:36 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2001-12-27 19:54:36 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2001-12-27 19:54:36 +00:00
|
|
|
//============================================================================
|
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
#include <cassert>
|
2008-08-25 23:22:22 +00:00
|
|
|
#include <cstring>
|
2007-01-14 16:17:57 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
#include "System.hxx"
|
2007-01-14 16:17:57 +00:00
|
|
|
#include "CartE7.hxx"
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
CartridgeE7::CartridgeE7(const uInt8* image)
|
|
|
|
{
|
|
|
|
// Copy the ROM image into my buffer
|
2008-08-01 12:16:00 +00:00
|
|
|
memcpy(myImage, image, 16384);
|
2009-06-03 14:49:42 +00:00
|
|
|
|
|
|
|
// This cart can address a 1024 byte bank of RAM @ 0x1000
|
|
|
|
// and 256 bytes @ 0x1800
|
|
|
|
// However, it may not be addressable all the time (it may be swapped out)
|
|
|
|
// so probably most of the time, the area will point to ROM instead
|
|
|
|
registerRamArea(0x1000, 1024, 0x400, 0x00); // 1024 bytes RAM @ 0x1000
|
|
|
|
registerRamArea(0x1800, 256, 0x100, 0x00); // 256 bytes RAM @ 0x1800
|
2010-03-05 22:02:12 +00:00
|
|
|
|
|
|
|
// Remember startup bank
|
|
|
|
myStartBank = 0;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
CartridgeE7::~CartridgeE7()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeE7::reset()
|
|
|
|
{
|
2008-08-01 12:16:00 +00:00
|
|
|
// Initialize RAM with random values
|
|
|
|
for(uInt32 i = 0; i < 2048; ++i)
|
2009-11-08 01:39:05 +00:00
|
|
|
myRAM[i] = mySystem->randGenerator().next();
|
2008-08-01 12:16:00 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// Install some default banks for the RAM and first segment
|
|
|
|
bankRAM(0);
|
2010-03-05 22:02:12 +00:00
|
|
|
bank(myStartBank);
|
2010-03-28 03:13:10 +00:00
|
|
|
|
|
|
|
myBankChanged = true;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeE7::install(System& system)
|
|
|
|
{
|
|
|
|
mySystem = &system;
|
|
|
|
uInt16 shift = mySystem->pageShift();
|
|
|
|
uInt16 mask = mySystem->pageMask();
|
|
|
|
|
|
|
|
// Make sure the system we're being installed in has a page size that'll work
|
|
|
|
assert(((0x1400 & mask) == 0) && ((0x1800 & mask) == 0) &&
|
|
|
|
((0x1900 & mask) == 0) && ((0x1A00 & mask) == 0));
|
|
|
|
|
|
|
|
System::PageAccess access;
|
2010-04-12 19:56:14 +00:00
|
|
|
|
|
|
|
// Set the page accessing methods for the hot spots
|
|
|
|
access.directPeekBase = 0;
|
|
|
|
access.directPokeBase = 0;
|
|
|
|
access.device = this;
|
2010-04-14 22:35:46 +00:00
|
|
|
access.type = System::PA_READ;
|
2001-12-27 19:54:36 +00:00
|
|
|
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
|
|
|
|
mySystem->setPageAccess(i >> shift, access);
|
|
|
|
|
|
|
|
// Setup the second segment to always point to the last ROM slice
|
2010-04-12 19:56:14 +00:00
|
|
|
access.directPokeBase = 0;
|
|
|
|
access.device = this;
|
2010-04-14 22:35:46 +00:00
|
|
|
access.type = System::PA_READ;
|
2001-12-27 19:54:36 +00:00
|
|
|
for(uInt32 j = 0x1A00; j < (0x1FE0U & ~mask); j += (1 << shift))
|
|
|
|
{
|
|
|
|
access.directPeekBase = &myImage[7 * 2048 + (j & 0x07FF)];
|
|
|
|
mySystem->setPageAccess(j >> shift, access);
|
|
|
|
}
|
|
|
|
myCurrentSlice[1] = 7;
|
|
|
|
|
|
|
|
// Install some default banks for the RAM and first segment
|
|
|
|
bankRAM(0);
|
2010-03-05 22:02:12 +00:00
|
|
|
bank(myStartBank);
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
uInt8 CartridgeE7::peek(uInt16 address)
|
|
|
|
{
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
uInt16 peekAddress = address;
|
2009-05-01 11:25:07 +00:00
|
|
|
address &= 0x0FFF;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Switch banks if necessary
|
|
|
|
if((address >= 0x0FE0) && (address <= 0x0FE7))
|
|
|
|
{
|
|
|
|
bank(address & 0x0007);
|
|
|
|
}
|
|
|
|
else if((address >= 0x0FE8) && (address <= 0x0FEB))
|
|
|
|
{
|
|
|
|
bankRAM(address & 0x0003);
|
|
|
|
}
|
|
|
|
|
2010-01-09 20:50:38 +00:00
|
|
|
if((myCurrentSlice[0] == 7) && (address < 0x0400))
|
|
|
|
{
|
|
|
|
// Reading from the 1K write port @ $1000 triggers an unwanted write
|
|
|
|
uInt8 value = mySystem->getDataBusState(0xFF);
|
|
|
|
|
2010-03-06 18:56:36 +00:00
|
|
|
if(bankLocked())
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
return value;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
triggerReadFromWritePort(peekAddress);
|
|
|
|
return myRAM[address & 0x03FF] = value;
|
|
|
|
}
|
2010-01-09 20:50:38 +00:00
|
|
|
}
|
|
|
|
else if((address >= 0x0800) && (address <= 0x08FF))
|
2009-11-08 01:39:05 +00:00
|
|
|
{
|
2010-01-09 20:50:38 +00:00
|
|
|
// Reading from the 256B write port @ $1800 triggers an unwanted write
|
2009-11-08 01:39:05 +00:00
|
|
|
uInt8 value = mySystem->getDataBusState(0xFF);
|
|
|
|
|
2010-03-06 18:56:36 +00:00
|
|
|
if(bankLocked())
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
return value;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
triggerReadFromWritePort(peekAddress);
|
|
|
|
return myRAM[1024 + (myCurrentRAM << 8) + (address & 0x00FF)] = value;
|
|
|
|
}
|
2009-11-08 01:39:05 +00:00
|
|
|
}
|
2009-11-05 00:41:44 +00:00
|
|
|
else
|
|
|
|
return myImage[(myCurrentSlice[address >> 11] << 11) + (address & 0x07FF)];
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-03-28 03:13:10 +00:00
|
|
|
bool CartridgeE7::poke(uInt16 address, uInt8)
|
2001-12-27 19:54:36 +00:00
|
|
|
{
|
2009-05-01 11:25:07 +00:00
|
|
|
address &= 0x0FFF;
|
2001-12-27 19:54:36 +00:00
|
|
|
|
|
|
|
// Switch banks if necessary
|
|
|
|
if((address >= 0x0FE0) && (address <= 0x0FE7))
|
|
|
|
{
|
|
|
|
bank(address & 0x0007);
|
|
|
|
}
|
|
|
|
else if((address >= 0x0FE8) && (address <= 0x0FEB))
|
|
|
|
{
|
|
|
|
bankRAM(address & 0x0003);
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE: This does not handle writing to RAM, however, this
|
|
|
|
// function should never be called for RAM because of the
|
|
|
|
// way page accessing has been setup
|
2010-03-28 03:13:10 +00:00
|
|
|
return false;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartridgeE7::bankRAM(uInt16 bank)
|
|
|
|
{
|
2010-03-06 18:56:36 +00:00
|
|
|
if(bankLocked()) return;
|
2009-11-05 00:41:44 +00:00
|
|
|
|
2001-12-27 19:54:36 +00:00
|
|
|
// Remember what bank we're in
|
|
|
|
myCurrentRAM = bank;
|
|
|
|
uInt16 offset = bank << 8;
|
|
|
|
uInt16 shift = mySystem->pageShift();
|
|
|
|
|
|
|
|
// Setup the page access methods for the current bank
|
|
|
|
System::PageAccess access;
|
|
|
|
|
|
|
|
// Set the page accessing method for the 256 bytes of RAM writing pages
|
2010-04-12 19:56:14 +00:00
|
|
|
access.directPeekBase = 0;
|
|
|
|
access.device = this;
|
2010-04-14 22:35:46 +00:00
|
|
|
access.type = System::PA_WRITE;
|
2001-12-27 19:54:36 +00:00
|
|
|
for(uInt32 j = 0x1800; j < 0x1900; j += (1 << shift))
|
|
|
|
{
|
|
|
|
access.directPokeBase = &myRAM[1024 + offset + (j & 0x00FF)];
|
|
|
|
mySystem->setPageAccess(j >> shift, access);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the page accessing method for the 256 bytes of RAM reading pages
|
2010-04-12 19:56:14 +00:00
|
|
|
access.directPokeBase = 0;
|
|
|
|
access.device = this;
|
2010-04-14 22:35:46 +00:00
|
|
|
access.type = System::PA_READ;
|
2001-12-27 19:54:36 +00:00
|
|
|
for(uInt32 k = 0x1900; k < 0x1A00; k += (1 << shift))
|
|
|
|
{
|
|
|
|
access.directPeekBase = &myRAM[1024 + offset + (k & 0x00FF)];
|
|
|
|
mySystem->setPageAccess(k >> shift, access);
|
|
|
|
}
|
2010-03-28 03:13:10 +00:00
|
|
|
myBankChanged = true;
|
2001-12-27 19:54:36 +00:00
|
|
|
}
|
|
|
|
|
2005-07-30 16:58:22 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2007-01-14 16:17:57 +00:00
|
|
|
void CartridgeE7::bank(uInt16 slice)
|
|
|
|
{
|
2010-03-06 18:56:36 +00:00
|
|
|
if(bankLocked()) return;
|
2007-01-14 16:17:57 +00:00
|
|
|
|
|
|
|
// Remember what bank we're in
|
|
|
|
myCurrentSlice[0] = slice;
|
|
|
|
uInt16 offset = slice << 11;
|
|
|
|
uInt16 shift = mySystem->pageShift();
|
|
|
|
|
2009-06-05 14:05:23 +00:00
|
|
|
System::PageAccess access;
|
|
|
|
|
2007-01-14 16:17:57 +00:00
|
|
|
// Setup the page access methods for the current bank
|
|
|
|
if(slice != 7)
|
|
|
|
{
|
|
|
|
// Map ROM image into first segment
|
2010-04-12 19:56:14 +00:00
|
|
|
access.directPokeBase = 0;
|
|
|
|
access.device = this;
|
2010-04-14 22:35:46 +00:00
|
|
|
access.type = System::PA_READ;
|
2007-01-14 16:17:57 +00:00
|
|
|
for(uInt32 address = 0x1000; address < 0x1800; address += (1 << shift))
|
|
|
|
{
|
|
|
|
access.directPeekBase = &myImage[offset + (address & 0x07FF)];
|
|
|
|
mySystem->setPageAccess(address >> shift, access);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Set the page accessing method for the 1K slice of RAM writing pages
|
2010-04-12 19:56:14 +00:00
|
|
|
access.directPeekBase = 0;
|
|
|
|
access.device = this;
|
2010-04-14 22:35:46 +00:00
|
|
|
access.type = System::PA_WRITE;
|
2007-01-14 16:17:57 +00:00
|
|
|
for(uInt32 j = 0x1000; j < 0x1400; j += (1 << shift))
|
|
|
|
{
|
|
|
|
access.directPokeBase = &myRAM[j & 0x03FF];
|
|
|
|
mySystem->setPageAccess(j >> shift, access);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the page accessing method for the 1K slice of RAM reading pages
|
2010-04-12 19:56:14 +00:00
|
|
|
access.directPokeBase = 0;
|
|
|
|
access.device = this;
|
2010-04-14 22:35:46 +00:00
|
|
|
access.type = System::PA_READ;
|
2007-01-14 16:17:57 +00:00
|
|
|
for(uInt32 k = 0x1400; k < 0x1800; k += (1 << shift))
|
|
|
|
{
|
|
|
|
access.directPeekBase = &myRAM[k & 0x03FF];
|
|
|
|
mySystem->setPageAccess(k >> shift, access);
|
|
|
|
}
|
|
|
|
}
|
2010-03-28 03:13:10 +00:00
|
|
|
myBankChanged = true;
|
2007-01-14 16:17:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-02 22:09:31 +00:00
|
|
|
uInt16 CartridgeE7::bank() const
|
2007-01-14 16:17:57 +00:00
|
|
|
{
|
|
|
|
return myCurrentSlice[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-02 22:09:31 +00:00
|
|
|
uInt16 CartridgeE7::bankCount() const
|
2007-01-14 16:17:57 +00:00
|
|
|
{
|
|
|
|
return 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
bool CartridgeE7::patch(uInt16 address, uInt8 value)
|
|
|
|
{
|
|
|
|
address = address & 0x0FFF;
|
2010-03-30 20:36:13 +00:00
|
|
|
|
|
|
|
if(address < 0x0800)
|
|
|
|
{
|
|
|
|
if(myCurrentSlice[0] == 7)
|
|
|
|
{
|
|
|
|
// Normally, a write to the read port won't do anything
|
|
|
|
// However, the patch command is special in that ignores such
|
|
|
|
// cart restrictions
|
|
|
|
myRAM[address & 0x03FF] = value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
myImage[(myCurrentSlice[0] << 11) + (address & 0x07FF)] = value;
|
|
|
|
}
|
|
|
|
else if(address < 0x0900)
|
|
|
|
{
|
|
|
|
// Normally, a write to the read port won't do anything
|
|
|
|
// However, the patch command is special in that ignores such
|
|
|
|
// cart restrictions
|
|
|
|
myRAM[1024 + (myCurrentRAM << 8) + (address & 0x00FF)] = value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
myImage[(myCurrentSlice[address >> 11] << 11) + (address & 0x07FF)] = value;
|
|
|
|
|
|
|
|
return myBankChanged = true;
|
2007-01-14 16:17:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-02 22:09:31 +00:00
|
|
|
const uInt8* CartridgeE7::getImage(int& size) const
|
2007-01-14 16:17:57 +00:00
|
|
|
{
|
2005-07-30 16:58:22 +00:00
|
|
|
size = 16384;
|
2010-03-28 03:13:10 +00:00
|
|
|
return myImage;
|
2005-07-30 16:58:22 +00:00
|
|
|
}
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
bool CartridgeE7::save(Serializer& out) const
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
uInt32 i;
|
|
|
|
|
2010-05-10 00:50:26 +00:00
|
|
|
out.putString(name());
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
|
|
|
|
out.putInt(2);
|
|
|
|
for(i = 0; i < 2; ++i)
|
|
|
|
out.putInt(myCurrentSlice[i]);
|
|
|
|
|
|
|
|
out.putInt(myCurrentRAM);
|
|
|
|
|
|
|
|
// The 2048 bytes of RAM
|
|
|
|
out.putInt(2048);
|
|
|
|
for(i = 0; i < 2048; ++i)
|
|
|
|
out.putByte((char)myRAM[i]);
|
|
|
|
}
|
|
|
|
catch(const char* msg)
|
|
|
|
{
|
2009-08-27 22:59:14 +00:00
|
|
|
cerr << "ERROR: CartridgeE7::save" << endl << " " << msg << endl;
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
OK, this looks like a huge update, but it's only because of some Serializer
class reworking. Serializer class now handles read/write of state from
files as well as in-memory streams. As a result, Deserializer class has
been removed.
Added state rewinding to the debugger. For now, this is limited to 100
levels of undo, with a new state generated each time a step/trace/frame/
scanline advance is performed. The undo level is 'rolling', in that it
remembers the last 100 levels (so you lose the oldest states when you
start adding more than 100). For now, this is tied to the 'Alt-r' key
in the debugger. Still TODO is add a button for it, and clean up some
TIA output issues when rewinding.
Added support for 6K version of Supercharger ROMs (this fixes issues
with the 6K version of Cubis).
Cleaned up the Serializable infrastructure, making sure that all
classes that need to implement it actually do so now.
Fixed issue with editable widgets in the UI, where pressing Enter
on the keypad wasn't actually being registered.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1849 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2009-08-05 16:05:34 +00:00
|
|
|
bool CartridgeE7::load(Serializer& in)
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2010-05-10 00:50:26 +00:00
|
|
|
if(in.getString() != name())
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
uInt32 i, limit;
|
|
|
|
|
|
|
|
limit = (uInt32) in.getInt();
|
|
|
|
for(i = 0; i < limit; ++i)
|
|
|
|
myCurrentSlice[i] = (uInt16) in.getInt();
|
|
|
|
|
|
|
|
myCurrentRAM = (uInt16) in.getInt();
|
|
|
|
|
|
|
|
// The 2048 bytes of RAM
|
|
|
|
limit = (uInt32) in.getInt();
|
|
|
|
for(i = 0; i < limit; ++i)
|
|
|
|
myRAM[i] = (uInt8) in.getByte();
|
|
|
|
}
|
|
|
|
catch(const char* msg)
|
|
|
|
{
|
2009-08-27 22:59:14 +00:00
|
|
|
cerr << "ERROR: CartridgeE7::load" << endl << " " << msg << endl;
|
OK, another huge commit. I need to commit this now, because things are
starting to go out of sync on my development machines. OK, where to
begin ...
Changed state file format, so older state files will no longer work. The
changes aren't finalized yet, so expect more breakage.
Added getByte() and putByte() methods to serialized data, resulting in
smaller state files (previously, 1-byte values were stored as 4-byte ints).
Totally reworked controller handling code. Controller state is now
explicitly set with an ::update() method, making it easier to serialize.
Some work is still required on the serialization stuff for more advanced
controllers.
Added a 'Serializable' interface to all carts, device, controllers, etc
that can be (de)serialized. This fixes a long-standing design issue
which I personally caused many years ago.
Console switches state (SWCHB register) is now saved to state files.
Added beginnings of movie support. Basically, this saves an initial
state file, and thereafter continuously saves controller and console
switches state. Support is still somewhat rough and there's no UI for
it, but it does successfully save and later load/play state movies.
Removed specific events for driving controllers, and have them use
joystick events instead. This has the nice side effect that
joystick direction remapping 'just works' for driving controllers too.
Fixed issues with paddle emulation seen in 'Night Driver' ROM. Related
to this, removed a hack wrt paddles when grabmouse is enabled. There's
still some work to do when using the mouse to emulate paddles, but the
Stelladaptor and real paddles work fine.
Added beginnings of TrackBall CX-22 controller emulation. It doesn't
actually do anything yet, but the class is there :)
Probably some other stuff that I'm forgetting ...
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1385 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2007-10-03 21:41:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set up the previously used banks for the RAM and segment
|
|
|
|
bankRAM(myCurrentRAM);
|
|
|
|
bank(myCurrentSlice[0]);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|