More updates for 4A50 bankswitching support; I think it's very close now.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1397 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-02-19 12:33:07 +00:00
parent 242c3b940d
commit 266f02e9d0
16 changed files with 1146 additions and 690 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: FrameBufferGL.cxx,v 1.96 2008-02-06 13:45:19 stephena Exp $
// $Id: FrameBufferGL.cxx,v 1.97 2008-02-19 12:33:02 stephena Exp $
//============================================================================
#ifdef DISPLAY_OPENGL
@ -293,11 +293,6 @@ bool FrameBufferGL::setVidMode(VideoMode mode)
myImageDim.x = (myScreenDim.w - myImageDim.w) / 2;
myImageDim.y = (myScreenDim.h - myImageDim.h) / 2;
GLdouble orthoWidth = (GLdouble)
(myImageDim.w / myWidthScaleFactor);
GLdouble orthoHeight = (GLdouble)
(myImageDim.h / myHeightScaleFactor);
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, myRGB[0] );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, myRGB[1] );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, myRGB[2] );
@ -344,7 +339,7 @@ bool FrameBufferGL::setVidMode(VideoMode mode)
p_glMatrixMode(GL_PROJECTION);
p_glLoadIdentity();
p_glOrtho(0.0, orthoWidth, orthoHeight, 0.0, 0.0, 1.0);
p_glOrtho(0.0, myImageDim.w, myImageDim.h, 0.0, 0.0, 1.0);
p_glMatrixMode(GL_MODELVIEW);
p_glLoadIdentity();
@ -440,7 +435,7 @@ void FrameBufferGL::postFrameUpdate()
{
// Texturemap complete texture to surface so we have free scaling
// and antialiasing
uInt32 w = myBuffer.width, h = myBuffer.height;
uInt32 w = myImageDim.w, h = myImageDim.h;
p_glTexSubImage2D(myBuffer.target, 0, 0, 0,
myBuffer.texture_width, myBuffer.texture_height,
@ -452,6 +447,9 @@ void FrameBufferGL::postFrameUpdate()
p_glTexCoord2f(myBuffer.tex_coord[0], myBuffer.tex_coord[3]); p_glVertex2i(0, h);
p_glEnd();
// Overlay UI dialog boxes
// Now show all changes made to the texture
SDL_GL_SwapBuffers();

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: FrameBufferSoft.cxx,v 1.75 2008-02-06 13:45:19 stephena Exp $
// $Id: FrameBufferSoft.cxx,v 1.76 2008-02-19 12:33:02 stephena Exp $
//============================================================================
#include <sstream>
@ -701,11 +701,17 @@ void FrameBufferSoft::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
// Add a dirty rect to the UI rectangle list
// TODO - intelligent merging of rectangles, to avoid overlap
SDL_Rect temp;
#if 1
temp.x = myImageDim.x + x * myZoomLevel;
temp.y = myImageDim.y + y * myZoomLevel;
temp.w = w * myZoomLevel;
temp.h = h * myZoomLevel;
#else
temp.x = 0;
temp.y = 0;
temp.w = myScreenDim.w;
temp.h = myScreenDim.h;
#endif
myRectList->add(&temp);
// cerr << "addDirtyRect(): "

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.36 2008-02-06 13:45:20 stephena Exp $
// $Id: Cart.cxx,v 1.37 2008-02-19 12:33:03 stephena Exp $
//============================================================================
#include <cassert>
@ -95,7 +95,7 @@ Cartridge* Cartridge::create(const uInt8* image, uInt32 size,
else if(type == "3F")
cartridge = new Cartridge3F(image, size);
else if(type == "4A50")
cartridge = new Cartridge4A50(image);
cartridge = new Cartridge4A50(image, size);
else if(type == "4K")
cartridge = new Cartridge4K(image);
else if(type == "AR")

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Cart3F.hxx,v 1.12 2008-02-06 13:45:20 stephena Exp $
// $Id: Cart3F.hxx,v 1.13 2008-02-19 12:33:03 stephena Exp $
//============================================================================
#ifndef CARTRIDGE3F_HXX
@ -35,7 +35,7 @@ class System;
only used 8K this bankswitching scheme supports up to 512K.
@author Bradford W. Mott
@version $Id: Cart3F.hxx,v 1.12 2008-02-06 13:45:20 stephena Exp $
@version $Id: Cart3F.hxx,v 1.13 2008-02-19 12:33:03 stephena Exp $
*/
class Cartridge3F : public Cartridge
{
@ -44,7 +44,7 @@ class Cartridge3F : public Cartridge
Create a new cartridge using the specified image and size
@param image Pointer to the ROM image
@param size The size of the ROM image
@param size The size of the ROM image
*/
Cartridge3F(const uInt8* image, uInt32 size);

View File

@ -13,24 +13,28 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Cart4A50.cxx,v 1.9 2008-02-06 13:45:20 stephena Exp $
// $Id: Cart4A50.cxx,v 1.10 2008-02-19 12:33:03 stephena Exp $
//============================================================================
#include <cassert>
#include <cstring>
#include "Random.hxx"
#include "System.hxx"
#include "M6532.hxx"
#include "TIA.hxx"
#include "Cart4A50.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4A50::Cartridge4A50(const uInt8* image)
Cartridge4A50::Cartridge4A50(const uInt8* image, uInt32 size)
{
// Copy the ROM image into my buffer
for(uInt32 addr = 0; addr < 65536; ++addr)
{
myImage[addr] = image[addr];
}
// Supported file sizes are 32/64/128K, which are duplicated if necessary
if(size < 65536) size = 32768;
else if(size < 131072) size = 65536;
else size = 131072;
for(uInt32 slice = 0; slice < 131072 / size; ++slice)
memcpy(myImage + (slice*size), image, size);
// Initialize RAM with random values
class Random random;
@ -74,39 +78,48 @@ void Cartridge4A50::install(System& system)
access.device = this;
mySystem->setPageAccess(i >> shift, access);
}
// Mirror all access in TIA and RIOT; by doing so we're taking responsibility
// for that address space in peek and poke below.
mySystem->tia().install(system, *this);
mySystem->m6532().install(system, *this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Cartridge4A50::peek(uInt16 address)
{
uInt8 value = 0;
uInt8 value = 0;//mySystem->getDataBusState();
if(!(address & 0x1000))
if(!(address & 0x1000)) // Hotspots below 0x1000
{
// ReadHardware();
checkBankSwitch(address, 0);
// Check for RAM or TIA mirroring
uInt16 lowAddress = address & 0x3ff;
if(lowAddress & 0x80)
value = mySystem->m6532().peek(address);
else if(!(lowAddress & 0x200))
value = mySystem->tia().peek(address);
checkBankSwitch(address);
}
else
{
if((address & 0x1800) == 0x1000)
if((address & 0x1800) == 0x1000) // 2K region from 0x1000 - 0x17ff
{
value = myIsRomLow ?
myImage[(address & 0x7ff) + mySliceLow] :
myRAM[(address & 0x7ff) + mySliceLow];
value = myIsRomLow ? myImage[(address & 0x7ff) + mySliceLow]
: myRAM[(address & 0x7ff) + mySliceLow];
}
else if(((address & 0x1fff) >= 0x1800) && ((address & 0x1fff) <= 0x1dff))
else if(((address & 0x1fff) >= 0x1800) && // 1.5K region from 0x1800 - 0x1dff
((address & 0x1fff) <= 0x1dff))
{
value = myIsRomMiddle ?
myImage[(address & 0x7ff) + mySliceMiddle] :
myRAM[(address & 0x7ff) + mySliceMiddle];
value = myIsRomMiddle ? myImage[(address & 0x7ff) + mySliceMiddle]
: myRAM[(address & 0x7ff) + mySliceMiddle];
}
else if((address & 0x1f00) == 0x1e00)
else if((address & 0x1f00) == 0x1e00) // 256B region from 0x1e00 - 0x1eff
{
value = myIsRomHigh ?
myImage[(address & 0xff) + mySliceHigh] :
myRAM[(address & 0xff) + mySliceHigh];
value = myIsRomHigh ? myImage[(address & 0xff) + mySliceHigh]
: myRAM[(address & 0xff) + mySliceHigh];
}
else if((address & 0x1f00) == 0x1f00)
else if((address & 0x1f00) == 0x1f00) // 256B region from 0x1f00 - 0x1fff
{
value = myImage[(address & 0xff) + 0xff00];
if(((myLastData & 0xe0) == 0x60) &&
@ -124,33 +137,41 @@ uInt8 Cartridge4A50::peek(uInt16 address)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::poke(uInt16 address, uInt8 value)
{
if(!(address & 0x1000))
if(!(address & 0x1000)) // Hotspots below 0x1000
{
// WriteHardware();
checkBankSwitch(address, value);
// Check for RAM or TIA mirroring
uInt16 lowAddress = address & 0x3ff;
if(lowAddress & 0x80)
mySystem->m6532().poke(address, value);
else if(!(lowAddress & 0x200))
mySystem->tia().poke(address, value);
checkBankSwitch(address);
}
else
{
if((address & 0x1800) == 0x1000)
if((address & 0x1800) == 0x1000) // 2K region at 0x1000 - 0x17ff
{
if(!myIsRomLow)
myRAM[(address & 0x7ff) + mySliceLow] = value;
}
else if(((address & 0x1fff) >= 0x1800) && ((address & 0x1fff) <= 0x1dff))
else if(((address & 0x1fff) >= 0x1800) && // 1.5K region at 0x1800 - 0x1dff
((address & 0x1fff) <= 0x1dff))
{
if(!myIsRomMiddle)
myRAM[(address & 0x7ff) + mySliceMiddle] = value;
}
else if((address & 0x1f00) == 0x1e00)
else if((address & 0x1f00) == 0x1e00) // 256B region at 0x1e00 - 0x1eff
{
if(!myIsRomHigh)
myRAM[(address & 0xff) + mySliceHigh] = value;
}
else if((address & 0x1f00) == 0x1f00)
else if((address & 0x1f00) == 0x1f00) // 256B region at 0x1f00 - 0x1fff
{
if(((myLastData & 0xe0) == 0x60) &&
((myLastAddress >= 0x1000) || (myLastAddress < 0x200)))
mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) | ((address & 0x70) << 4);
mySliceHigh = (mySliceHigh & 0xf0ff) | ((address & 0x8) << 8) |
((address & 0x70) << 4);
}
}
@ -159,93 +180,96 @@ void Cartridge4A50::poke(uInt16 address, uInt8 value)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4A50::checkBankSwitch(uInt16 address, uInt8 value)
void Cartridge4A50::checkBankSwitch(uInt16 address)
{
// Not bankswitching in the normal sense
uInt8 databus = mySystem->getDataBusState();
// This scheme contains so many hotspots that it's easier to just check
// all of them
if(((myLastData & 0xe0) == 0x60) &&
if(((myLastData & 0xe0) == 0x60) && // Switch lower/middle/upper bank
((myLastAddress >= 0x1000) || (myLastAddress < 0x200)))
{
if((address & 0x0f00) == 0x0c00)
if((address & 0x0f00) == 0x0c00) // Enable 256B of ROM at 0x1e00 - 0x1eff
{
myIsRomHigh = true;
mySliceHigh = (address & 0xff) << 8;
}
else if((address & 0x0f00) == 0x0d00)
else if((address & 0x0f00) == 0x0d00) // Enable 256B of RAM at 0x1e00 - 0x1eff
{
myIsRomHigh = false;
mySliceHigh = (address & 0x7f) << 8;
}
else if((address & 0x0f40) == 0x0e00)
else if((address & 0x0f40) == 0x0e00) // Enable 2K of ROM at 0x1000 - 0x17ff
{
myIsRomLow = true;
mySliceLow = (address & 0x1f) << 11;
}
else if((address & 0x0f40) == 0x0e40)
else if((address & 0x0f40) == 0x0e40) // Enable 2K of RAM at 0x1000 - 0x17ff
{
myIsRomLow = false;
mySliceLow = (address & 0xf) << 11;
}
else if((address & 0x0f40) == 0x0f00)
else if((address & 0x0f40) == 0x0f00) // Enable 1.5K of ROM at 0x1800 - 0x1dff
{
myIsRomMiddle = true;
mySliceMiddle = (address & 0x1f) << 11;
}
else if((address & 0x0f50) == 0x0f40)
else if((address & 0x0f50) == 0x0f40) // Enable 1.5K of RAM at 0x1800 - 0x1dff
{
myIsRomMiddle = false;
mySliceMiddle = (address & 0xf) << 11;
}
else if((address & 0x0f00) == 0x0400)
// Stella helper functions
else if((address & 0x0f00) == 0x0400) // Toggle bit A11 of lower block address
{
mySliceLow = mySliceLow ^ 0x800;
}
else if((address & 0x0f00) == 0x0500)
else if((address & 0x0f00) == 0x0500) // Toggle bit A12 of lower block address
{
mySliceLow = mySliceLow ^ 0x1000;
}
else if((address & 0x0f00) == 0x0800)
else if((address & 0x0f00) == 0x0800) // Toggle bit A11 of middle block address
{
mySliceMiddle = mySliceMiddle ^ 0x800;
}
else if((address & 0x0f00) == 0x0900)
else if((address & 0x0f00) == 0x0900) // Toggle bit A12 of middle block address
{
mySliceMiddle = mySliceMiddle ^ 0x1000;
}
}
if((address & 0xf75) == 0x74)
if((address & 0xf75) == 0x74) //
{
myIsRomHigh = true;
mySliceHigh = value << 8;
mySliceHigh = databus << 8;
}
else if((address & 0xf75) == 0x75)
else if((address & 0xf75) == 0x75) //
{
myIsRomHigh = false;
mySliceHigh = (value & 0x7f) << 8;
mySliceHigh = (databus & 0x7f) << 8;
}
else if((address & 0xf7c) == 0x78)
else if((address & 0xf7c) == 0x78)
{
if((value & 0xf0) == 0)
if((databus & 0xf0) == 0) // Zero page 0xf8 (lower block address of ROM)
{
myIsRomLow = true;
mySliceLow = (value & 0xf) << 11;
mySliceLow = (databus & 0xf) << 11;
}
else if((value & 0xf0) == 0x40)
else if((databus & 0xf0) == 0x40) // Zero page 0xf9 (lower block address of RAM)
{
myIsRomLow = false;
mySliceLow = (value & 0xf) << 11;
mySliceLow = (databus & 0xf) << 11;
}
else if((value & 0xf0) == 0x90)
else if((databus & 0xf0) == 0x90) // Zero page 0xfa (middle block address of ROM)
{
myIsRomMiddle = true;
mySliceMiddle = ((value & 0xf) | 0x10) << 11;
mySliceMiddle = ((databus & 0xf) | 0x10) << 11;
}
else if((value & 0xf0) == 0xc0)
else if((databus & 0xf0) == 0xc0) // Zero page 0xfb (middle block address of RAM)
{
myIsRomMiddle = false;
mySliceMiddle = (value & 0xf) << 11;
mySliceMiddle = (databus & 0xf) << 11;
}
}
}

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: Cart4A50.hxx,v 1.10 2008-02-06 13:45:20 stephena Exp $
// $Id: Cart4A50.hxx,v 1.11 2008-02-19 12:33:03 stephena Exp $
//============================================================================
#ifndef CARTRIDGE4A50_HXX
@ -36,8 +36,8 @@ class System;
RAM or ROM. The last 256 byte segment always points to the last 256
bytes of ROM.
@author Stephen Anthony
@version $Id: Cart4A50.hxx,v 1.10 2008-02-06 13:45:20 stephena Exp $
@author Stephen Anthony & Eckhard Stolberg
@version $Id: Cart4A50.hxx,v 1.11 2008-02-19 12:33:03 stephena Exp $
*/
class Cartridge4A50 : public Cartridge
{
@ -46,8 +46,9 @@ class Cartridge4A50 : 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
*/
Cartridge4A50(const uInt8* image);
Cartridge4A50(const uInt8* image, uInt32 size);
/**
Destructor
@ -147,11 +148,11 @@ class Cartridge4A50 : public Cartridge
/**
Check all possible hotspots
*/
void checkBankSwitch(uInt16 address, uInt8 value);
void checkBankSwitch(uInt16 address);
private:
// The 64K ROM image of the cartridge
uInt8 myImage[65536];
// The 128K ROM image of the cartridge
uInt8 myImage[128*1024];
// The 32K of RAM on the cartridge
uInt8 myRAM[32768];

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: Cart4K.cxx,v 1.12 2008-02-06 13:45:20 stephena Exp $
// $Id: Cart4K.cxx,v 1.13 2008-02-19 12:33:03 stephena Exp $
//============================================================================
#include <cassert>
@ -76,7 +76,7 @@ void Cartridge4K::poke(uInt16, uInt8)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge4K::bank(uInt16 bank)
void Cartridge4K::bank(uInt16)
{
// Doesn't support bankswitching
}

File diff suppressed because it is too large Load Diff

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: M6532.cxx,v 1.12 2008-02-06 13:45:21 stephena Exp $
// $Id: M6532.cxx,v 1.13 2008-02-19 12:33:05 stephena Exp $
//============================================================================
#include <assert.h>
@ -74,6 +74,12 @@ void M6532::systemCyclesReset()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6532::install(System& system)
{
install(system, *this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6532::install(System& system, Device& device)
{
// Remember which system I'm installed in
mySystem = &system;
@ -84,27 +90,18 @@ void M6532::install(System& system)
// Make sure the system we're being installed in has a page size that'll work
assert((0x1080 & mask) == 0);
// All accesses are to this device
// All accesses are to the given device
System::PageAccess access;
access.device = this;
access.device = &device;
// We're installing in a 2600 system
for(int address = 0; address < 8192; address += (1 << shift))
{
if((address & 0x1080) == 0x0080)
{
if((address & 0x0200) == 0x0000)
{
access.directPeekBase = &myRAM[address & 0x007f];
access.directPokeBase = &myRAM[address & 0x007f];
mySystem->setPageAccess(address >> shift, access);
}
else
{
access.directPeekBase = 0;
access.directPokeBase = 0;
mySystem->setPageAccess(address >> shift, access);
}
access.directPeekBase = 0;
access.directPokeBase = 0;
mySystem->setPageAccess(address >> shift, access);
}
}
}
@ -112,6 +109,15 @@ void M6532::install(System& system)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 M6532::peek(uInt16 addr)
{
// Access RAM directly. Originally, accesses to RAM could bypass
// this method and its pages could be installed directly into the
// system. However, certain cartridges (notably 4A50) can mirror
// the RAM address space, making it necessary to chain accesses.
if((addr & 0x1080) == 0x0080 && (addr & 0x0200) == 0x0000)
{
return myRAM[addr & 0x007f];
}
switch(addr & 0x07)
{
case 0x00: // Port A I/O Register (Joystick)
@ -215,7 +221,15 @@ uInt8 M6532::peek(uInt16 addr)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6532::poke(uInt16 addr, uInt8 value)
{
if((addr & 0x07) == 0x00) // Port A I/O Register (Joystick)
// Access RAM directly. Originally, accesses to RAM could bypass
// this method and its pages could be installed directly into the
// system. However, certain cartridges (notably 4A50) can mirror
// the RAM address space, making it necessary to chain accesses.
if((addr & 0x1080) == 0x0080 && (addr & 0x0200) == 0x0000)
{
myRAM[addr & 0x007f] = value;
}
else if((addr & 0x07) == 0x00) // Port A I/O Register (Joystick)
{
uInt8 a = value & myDDRA;
@ -251,12 +265,13 @@ void M6532::poke(uInt16 addr, uInt8 value)
work on real hardware.
*/
Controller &c = myConsole.controller(Controller::Right);
if(c.type() == Controller::AtariVox) {
if(c.type() == Controller::AtariVox)
{
c.write(Controller::One, !(value & 0x01));
c.write(Controller::Two, !(value & 0x02));
c.write(Controller::Three, !(value & 0x04));
c.write(Controller::Four, !(value & 0x08));
}
}
#endif
}
else if((addr & 0x07) == 0x02) // Port B I/O Register (Console switches)

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: M6532.hxx,v 1.7 2008-02-06 13:45:22 stephena Exp $
// $Id: M6532.hxx,v 1.8 2008-02-19 12:33:05 stephena Exp $
//============================================================================
#ifndef M6532_HXX
@ -31,7 +31,7 @@ class Deserializer;
RIOT
@author Bradford W. Mott
@version $Id: M6532.hxx,v 1.7 2008-02-06 13:45:22 stephena Exp $
@version $Id: M6532.hxx,v 1.8 2008-02-19 12:33:05 stephena Exp $
*/
class M6532 : public Device
{
@ -69,6 +69,17 @@ class M6532 : public Device
*/
virtual void install(System& system);
/**
Install 6532 in the specified system and device. Invoked by
the system when the 6532 is attached to it. All devices
which invoke this method take responsibility for chaining
requests back to *this* device.
@param system The system the device should install itself in
@param device The device responsible for this address space
*/
virtual void install(System& system, Device& device);
/**
Save the current state of this device to the given Serializer.

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: TIA.cxx,v 1.83 2008-02-06 13:45:22 stephena Exp $
// $Id: TIA.cxx,v 1.84 2008-02-19 12:33:05 stephena Exp $
//============================================================================
#include <cassert>
@ -272,6 +272,12 @@ void TIA::systemCyclesReset()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::install(System& system)
{
install(system, *this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::install(System& system, Device& device)
{
// Remember which system I'm installed in
mySystem = &system;
@ -279,11 +285,11 @@ void TIA::install(System& system)
uInt16 shift = mySystem->pageShift();
mySystem->resetCycles();
// All accesses are to this device
// All accesses are to the given device
System::PageAccess access;
access.directPeekBase = 0;
access.directPokeBase = 0;
access.device = this;
access.device = &device;
// We're installing in a 2600 system
for(uInt32 i = 0; i < 8192; i += (1 << shift))

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: TIA.hxx,v 1.44 2008-02-06 13:45:22 stephena Exp $
// $Id: TIA.hxx,v 1.45 2008-02-19 12:33:05 stephena Exp $
//============================================================================
#ifndef TIA_HXX
@ -40,7 +40,7 @@ class Settings;
be displayed on screen.
@author Bradford W. Mott
@version $Id: TIA.hxx,v 1.44 2008-02-06 13:45:22 stephena Exp $
@version $Id: TIA.hxx,v 1.45 2008-02-19 12:33:05 stephena Exp $
*/
class TIA : public Device , public MediaSource
{
@ -86,6 +86,17 @@ class TIA : public Device , public MediaSource
*/
virtual void install(System& system);
/**
Install TIA in the specified system and device. Invoked by
the system when the TIA is attached to it. All devices
which invoke this method take responsibility for chaining
requests back to *this* device.
@param system The system the device should install itself in
@param device The device responsible for this address space
*/
virtual void install(System& system, Device& device);
/**
Save the current state of this device to the given Serializer.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: System.cxx,v 1.24 2008-02-06 13:45:22 stephena Exp $
// $Id: System.cxx,v 1.25 2008-02-19 12:33:07 stephena Exp $
//============================================================================
#include <assert.h>
@ -21,6 +21,7 @@
#include "Device.hxx"
#include "M6502.hxx"
#include "M6532.hxx"
#include "TIA.hxx"
#include "System.hxx"
@ -113,6 +114,16 @@ void System::attach(M6502* m6502)
myM6502->install(*this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void System::attach(M6532* m6532)
{
// Remember the processor
myM6532 = m6532;
// Attach it as a normal device
attach((Device*) m6532);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void System::attach(TIA* tia)
{

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: System.hxx,v 1.18 2008-02-06 13:45:22 stephena Exp $
// $Id: System.hxx,v 1.19 2008-02-19 12:33:07 stephena Exp $
//============================================================================
#ifndef SYSTEM_HXX
@ -21,6 +21,7 @@
class Device;
class M6502;
class M6532;
class TIA;
class NullDevice;
@ -46,7 +47,7 @@ class NullDevice;
dynamic code for that page of memory.
@author Bradford W. Mott
@version $Id: System.hxx,v 1.18 2008-02-06 13:45:22 stephena Exp $
@version $Id: System.hxx,v 1.19 2008-02-19 12:33:07 stephena Exp $
*/
class System : public Serializable
{
@ -88,6 +89,14 @@ class System : public Serializable
*/
void attach(M6502* m6502);
/**
Attach the specified processor and claim ownership of it. The
processor will be asked to install itself.
@param m6532 The 6532 microprocessor to attach to the system
*/
void attach(M6532* m6532);
/**
Attach the specified TIA device and claim ownership of it. The device
will be asked to install itself.
@ -108,6 +117,17 @@ class System : public Serializable
return *myM6502;
}
/**
Answer the 6532 processor attached to the system. If a
processor has not been attached calling this function will fail.
@return The attached 6532 microprocessor
*/
M6532& m6532()
{
return *myM6532;
}
/**
Answer the TIA device attached to the system.
@ -326,6 +346,9 @@ class System : public Serializable
// 6502 processor attached to the system or the null pointer
M6502* myM6502;
// 6532 processor attached to the system or the null pointer
M6532* myM6532;
// TIA device attached to the system or the null pointer
TIA* myTIA;

File diff suppressed because it is too large Load Diff

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: Dialog.cxx,v 1.57 2008-02-06 13:45:23 stephena Exp $
// $Id: Dialog.cxx,v 1.58 2008-02-19 12:33:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -250,6 +250,7 @@ void Dialog::drawDialog()
// Tell the framebuffer this area is dirty
fb.addDirtyRect(_x, _y, _w, _h);
//cerr << "dirty: x = " << _x << ", y = " << _y << ", w = " << _w << ", h = " << _h << endl;
_dirty = false;
}