From: <tu...@us...> - 2008-09-25 20:56:07
|
Revision: 8270 http://openmsx.svn.sourceforge.net/openmsx/?rev=8270&view=rev Author: turbor Date: 2008-09-25 20:55:58 +0000 (Thu, 25 Sep 2008) Log Message: ----------- First coding steps towards a more intuitive VRAM debuggable. Code now acts as if in constant "high-bandwidth display mode", simply to display the two different behaviors. Modified Paths: -------------- openmsx/trunk/ChangeLog openmsx/trunk/src/video/VDPVRAM.cc openmsx/trunk/src/video/VDPVRAM.hh Modified: openmsx/trunk/ChangeLog =================================================================== --- openmsx/trunk/ChangeLog 2008-09-24 21:00:08 UTC (rev 8269) +++ openmsx/trunk/ChangeLog 2008-09-25 20:55:58 UTC (rev 8270) @@ -1,5 +1,13 @@ $Id$ +2008-09-25 David Heremans <dav...@gn...> + * Vram debuggable changed: + First step towards creating a debuggable that provides a logical + view upon the VRAM based upon the current videomode. This is the + behavior an ML-coder expects when dealing with the VDP. + The old chipbased view upon the vram is now called "physical VRAM" + instead. + 2008-09-21 Manuel Bilderbeek <ma...@ms...> * Added Brazillian OPL3Cartridge (MoonSound without wavetable). Still mostly untested, although MSX-Audio games (e.g. from Compile) Modified: openmsx/trunk/src/video/VDPVRAM.cc =================================================================== --- openmsx/trunk/src/video/VDPVRAM.cc 2008-09-24 21:00:08 UTC (rev 8269) +++ openmsx/trunk/src/video/VDPVRAM.cc 2008-09-25 20:55:58 UTC (rev 8270) @@ -4,6 +4,7 @@ #include "SpriteChecker.hh" #include "Renderer.hh" #include "Math.hh" +#include "SimpleDebuggable.hh" #include "serialize.hh" #include <cstring> @@ -25,6 +26,61 @@ } +// class logicalVRAMDebuggable: + +class logicalVRAMDebuggable : public SimpleDebuggable +{ +public: + /*TODO actually I'm just typing away here: + don't know if 'friend' is needed :-\ + what does explicit mean? + */ + friend class VDPVRAM; + + + explicit logicalVRAMDebuggable(MSXMotherBoard& motherBoard, Ram& vram); + virtual byte read(unsigned address); + virtual void write(unsigned address, byte value); + void setPlanar(bool planar=true); +private: + bool isPlanar; + byte* data; +}; + +logicalVRAMDebuggable::logicalVRAMDebuggable(MSXMotherBoard& motherBoard, Ram& vram) + : SimpleDebuggable(motherBoard, "VRAM", "CPU view on video RAM given the current display mode.", vram.getSize()) + ,data(&vram[0]) +{ + isPlanar = true ; +} + +/** This function will be called when the VDP registers are changed which affect this setting + */ +void logicalVRAMDebuggable::setPlanar(bool planar) +{ + isPlanar = planar; +} + +byte logicalVRAMDebuggable::read(unsigned address) +{ + //assert(address < getSize()); + if (isPlanar){ + address = ((address << 16) | (address >> 1)) & 0x1FFFF; + } + return data[address]; +} + +void logicalVRAMDebuggable::write(unsigned address, byte value) +{ + //assert(address < getSize()); + if (isPlanar){ + address = ((address << 16) | (address >> 1)) & 0x1FFFF; + } + data[address] = value; +} + + + // class VDPVRAM: static unsigned bufferSize(unsigned size) @@ -36,7 +92,7 @@ VDPVRAM::VDPVRAM(VDP& vdp_, unsigned size, const EmuTime& time) : vdp(vdp_) - , data(vdp.getMotherBoard(), "VRAM", "Video RAM.", bufferSize(size)) + , data(vdp.getMotherBoard(), "physical VRAM", "VDP independend view on the video RAM.", bufferSize(size)) #ifdef DEBUG , vramTime(time) #endif @@ -51,6 +107,7 @@ , bitmapCacheWindow(data) , spriteAttribTable(data) , spritePatternTable(data) + , logicalVRAMDebug( new logicalVRAMDebuggable(vdp.getMotherBoard(), data)) { (void)time; @@ -68,6 +125,7 @@ // Because this window has no observer, any EmuTime can be passed. // TODO: Move this to cache registration. bitmapCacheWindow.setMask(0x1FFFF, -1 << 17, EmuTime::zero); + } void VDPVRAM::updateDisplayMode(DisplayMode mode, const EmuTime& time) Modified: openmsx/trunk/src/video/VDPVRAM.hh =================================================================== --- openmsx/trunk/src/video/VDPVRAM.hh 2008-09-24 21:00:08 UTC (rev 8269) +++ openmsx/trunk/src/video/VDPVRAM.hh 2008-09-25 20:55:58 UTC (rev 8270) @@ -19,6 +19,7 @@ class EmuTime; class SpriteChecker; class Renderer; +class logicalVRAMDebuggable; /* Note: The way VRAM is accessed depends a lot on who is doing the accessing. @@ -581,6 +582,12 @@ VRAMWindow bitmapCacheWindow; VRAMWindow spriteAttribTable; VRAMWindow spritePatternTable; + + /** Debuger with mode dependend view on the vram + */ + friend class logicalVRAMDebuggable; + const std::auto_ptr<logicalVRAMDebuggable> logicalVRAMDebug; + }; } // namespace openmsx This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |