openMSX
|
Specifies an address range in the VRAM. More...
#include <VDPVRAM.hh>
Public Member Functions | |
VRAMWindow (const VRAMWindow &)=delete | |
VRAMWindow (VRAMWindow &&)=delete | |
VRAMWindow & | operator= (const VRAMWindow &)=delete |
VRAMWindow & | operator= (VRAMWindow &&)=delete |
unsigned | getMask () const |
Gets the mask for this window. | |
void | setMask (unsigned newBaseMask, unsigned newIndexMask, unsigned newSizeMask, EmuTime::param time) |
Sets the mask and enables this window. | |
void | setMask (unsigned newBaseMask, unsigned newIndexMask, EmuTime::param time) |
Same as above, but 'sizeMask' doesn't change. | |
void | disable (EmuTime::param time) |
Disable this window: no address will be considered inside. | |
bool | isContinuous (unsigned index, unsigned size) const |
Is the given index range continuous in VRAM (iow there's no mirroring) Only if the range is continuous it's allowed to call getReadArea(). | |
bool | isContinuous (unsigned mask) const |
Alternative version to check whether a region is continuous in VRAM. | |
template<size_t size> | |
std::span< const byte, size > | getReadArea (unsigned index) const |
Gets a span of a contiguous part of the VRAM. | |
template<size_t size> | |
std::pair< std::span< const byte, size/2 >, std::span< const byte, size/2 > > | getReadAreaPlanar (unsigned index) const |
Similar to getReadArea(), but now with planar addressing mode. | |
byte | readNP (unsigned index) const |
Reads a byte from VRAM in its current state. | |
byte | readPlanar (unsigned index) const |
Similar to readNP, but now with planar addressing. | |
bool | hasObserver () const |
Is there an observer registered for this window? | |
void | setObserver (VRAMObserver *newObserver) |
Register an observer on this VRAM window. | |
void | resetObserver () |
Unregister the observer of this VRAM window. | |
bool | isInside (unsigned address) const |
Test whether an address is inside this window. | |
void | notify (unsigned address, EmuTime::param time) |
Notifies the observer of this window of a VRAM change, if the changes address is inside this window. | |
void | setSizeMask (unsigned newSizeMask, EmuTime::param time) |
Inform VRAMWindow of changed sizeMask. | |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
Friends | |
class | VDPVRAM |
Only VDPVRAM may construct VRAMWindow objects. | |
Specifies an address range in the VRAM.
A VDP subsystem can use this to put a claim on a certain area. For example, the owner of a read window will be notified before writes to the corresponding area are commited. The address range is specified by a mask and is not necessarily continuous. See "doc/vram-addressing.txt" for details. TODO: Rename to "Table"? That's the term the VDP data book uses. Maybe have two classes: "Table" for tables, using a mask, and "Window" for the command engine, using an interval.
Definition at line 134 of file VDPVRAM.hh.
|
delete |
|
delete |
|
inline |
Disable this window: no address will be considered inside.
time | The moment in emulated time this change occurs. |
Definition at line 192 of file VDPVRAM.hh.
References openmsx::VRAMObserver::updateWindow().
|
inline |
Gets the mask for this window.
Should only be called if the window is enabled. TODO: Only used by dirty checking. Maybe a new dirty checking approach can obsolete this method?
Definition at line 147 of file VDPVRAM.hh.
Referenced by openmsx::SDLRasterizer::drawDisplay().
|
inline |
Gets a span of a contiguous part of the VRAM.
The region is [index, index + size) inside the current window.
index | Index in window |
Definition at line 228 of file VDPVRAM.hh.
References isContinuous().
|
inline |
Similar to getReadArea(), but now with planar addressing mode.
This means the region is split in two: one region for the even bytes (span0) and another for the odd bytes (span1).
index | Index in window |
Definition at line 245 of file VDPVRAM.hh.
References Math::floodRight().
|
inline |
Is there an observer registered for this window?
Definition at line 282 of file VDPVRAM.hh.
|
inline |
Is the given index range continuous in VRAM (iow there's no mirroring) Only if the range is continuous it's allowed to call getReadArea().
Definition at line 200 of file VDPVRAM.hh.
References Math::floodRight().
Referenced by getReadArea().
|
inline |
Alternative version to check whether a region is continuous in VRAM.
This tests whether all addresses in the range 0bCCCCCCCCCCXXXXXXXX (with C constant and X varying) are continuous. The input must be a value 1-less-than-a-power-of-2 (so a binary value containing zeros on the left ones on the right) 1-bits in the parameter correspond with 'X' in the pattern above. Or IOW it tests an aligned-power-of-2-sized region.
Definition at line 217 of file VDPVRAM.hh.
|
inline |
Test whether an address is inside this window.
"Inside" is defined as: there is at least one index in this window, which is mapped to the given address. TODO: Might be replaced by notify().
address | The address to test. |
Definition at line 308 of file VDPVRAM.hh.
Referenced by openmsx::VDPVRAM::cpuRead(), openmsx::VDPVRAM::cpuWrite(), and notify().
|
inline |
Notifies the observer of this window of a VRAM change, if the changes address is inside this window.
address | The address to test. |
time | The moment in emulated time the change occurs. |
Definition at line 317 of file VDPVRAM.hh.
References isInside(), and openmsx::VRAMObserver::updateVRAM().
|
delete |
|
delete |
|
inline |
Reads a byte from VRAM in its current state.
index | Index in table, with unused bits set to 1. |
Definition at line 265 of file VDPVRAM.hh.
Referenced by openmsx::Graphic4Mode::point(), openmsx::Graphic5Mode::point(), openmsx::Graphic6Mode::point(), openmsx::Graphic7Mode::point(), and openmsx::NonBitmapMode::point().
|
inline |
Similar to readNP, but now with planar addressing.
index | Index in table, with unused bits set to 1. |
Definition at line 273 of file VDPVRAM.hh.
|
inline |
Unregister the observer of this VRAM window.
Definition at line 297 of file VDPVRAM.hh.
Referenced by openmsx::VDPVRAM::setRenderer().
void openmsx::VRAMWindow::serialize | ( | Archive & | ar, |
unsigned | version | ||
) |
Definition at line 301 of file VDPVRAM.cc.
|
inline |
Same as above, but 'sizeMask' doesn't change.
This is a useful shortcut, because 'sizeMask' rarely changes.
Definition at line 184 of file VDPVRAM.hh.
References setMask().
|
inline |
Sets the mask and enables this window.
newBaseMask | The table base register, with the unused bits all ones. |
newIndexMask | The table index mask, with the unused bits all ones. |
newSizeMask | |
time | The moment in emulated time this change occurs. TODO: In planar mode, the index bits are rotated one to the right. Solution: have the caller pass index mask instead of the number of bits. For many tables the number of index bits depends on the display mode anyway. |
Definition at line 165 of file VDPVRAM.hh.
References openmsx::VRAMObserver::updateWindow().
Referenced by setMask(), openmsx::VDPVRAM::setRenderer(), setSizeMask(), and openmsx::VDPVRAM::VDPVRAM().
|
inline |
Register an observer on this VRAM window.
It will be called when changes occur within the window. There can be only one observer per window at any given time.
newObserver | The observer to register. |
Definition at line 291 of file VDPVRAM.hh.
Referenced by openmsx::VDPVRAM::setRenderer(), and openmsx::SpriteChecker::SpriteChecker().
|
inline |
Inform VRAMWindow of changed sizeMask.
For the moment this only happens when switching the VR bit in VDP register 8 (in VR=0 mode only 32kB VRAM is addressable).
Definition at line 327 of file VDPVRAM.hh.
References setMask().
|
friend |
Only VDPVRAM may construct VRAMWindow objects.
Definition at line 346 of file VDPVRAM.hh.