openMSX
|
Unified implementation of MSX Video Display Processors (VDPs). More...
#include <VDP.hh>
Classes | |
struct | BlinkStateCount |
Calculates what 'blinkState' and 'blinkCount' would be at a specific line. More... | |
Public Types | |
using | VDPClock = Clock< TICKS_PER_SECOND > |
Public Types inherited from openmsx::MSXDevice | |
using | Devices = std::vector< MSXDevice * > |
Public Member Functions | |
VDP (const DeviceConfig &config) | |
~VDP () override | |
void | powerUp (EmuTime::param time) override |
This method is called when MSX is powered up. | |
void | reset (EmuTime::param time) override |
This method is called on reset. | |
byte | readIO (word port, EmuTime::param time) override |
Read a byte from an IO port at a certain time from this device. | |
byte | peekIO (word port, EmuTime::param time) const override |
Read a byte from a given IO port. | |
void | writeIO (word port, byte value, EmuTime::param time) override |
Write a byte to a given IO port at a certain time to this device. | |
void | getExtraDeviceInfo (TclObject &result) const override |
std::string_view | getVersionString () const |
byte | peekRegister (unsigned address) const |
byte | peekStatusReg (byte reg, EmuTime::param time) const |
void | changeRegister (byte reg, byte val, EmuTime::param time) |
VDP control register has changed, work out the consequences. | |
PostProcessor * | getPostProcessor () const |
Used by Video9000 to be able to couple the VDP and V9990 output. | |
bool | isMSX1VDP () const |
Is this an MSX1 VDP? | |
bool | isVDPwithPALonly () const |
Is this a VDP only capable of PAL? | |
bool | vdpLacksMirroring () const |
Is this a VDP that lacks mirroring? | |
bool | vdpHasPatColMirroring () const |
Is this a VDP that has pattern/color table mirroring? | |
bool | isVDPwithVRAMremapping () const |
Does this VDP have VRAM remapping when switching from 4k to 8/16k mode? | |
bool | hasYJK () const |
Does this VDP support YJK display? | |
std::array< std::array< uint8_t, 3 >, 16 > | getMSX1Palette () const |
Get the (fixed) palette for this MSX1 VDP. | |
DisplayMode | getDisplayMode () const |
Get the display mode the VDP is in. | |
VDPVRAM & | getVRAM () |
Get the VRAM object for this VDP. | |
const RawFrame * | isSuperimposing () const |
Are we currently superimposing? In case of superimpose, returns a pointer to the to-be-superimposed frame. | |
SpriteChecker & | getSpriteChecker () |
Get the sprite checker for this VDP. | |
bool | getTransparency () const |
Gets the current transparency setting. | |
bool | canSpriteColor0Collide () const |
Can a sprite which has color=0 collide with some other sprite? | |
int | getForegroundColor () const |
Gets the current foreground color. | |
byte | getBackgroundColor () const |
Gets the current background color. | |
int | getBlinkForegroundColor () const |
Gets the current blinking color for blinking text. | |
int | getBlinkBackgroundColor () const |
Gets the current blinking color for blinking text. | |
bool | getBlinkState () const |
Gets the current blink state. | |
int | getPatternTableBase () const |
Get address of pattern table (only for debugger) | |
int | getColorTableBase () const |
Get address of color table (only for debugger) | |
int | getNameTableBase () const |
Get address of name table (only for debugger) | |
int | getSpritePatternTableBase () const |
Get address of pattern table (only for debugger) | |
int | getSpriteAttributeTableBase () const |
Get address of color table (only for debugger) | |
int | getVramPointer () const |
Get vram pointer (14-bit) (only for debugger) | |
uint16_t | getPalette (unsigned index) const |
Gets a palette entry. | |
std::span< const uint16_t, 16 > | getPalette () const |
void | setPalette (unsigned index, word grb, EmuTime::param time) |
Sets a palette entry. | |
bool | isDisplayEnabled () const |
Is the display enabled? Both the regular border and forced blanking by clearing the display enable bit are considered disabled display. | |
bool | spritesEnabled () const |
Are sprites enabled? | |
bool | spritesEnabledFast () const |
Same as spritesEnabled(), but may only be called in sprite mode 1 or 2. | |
bool | spritesEnabledRegister () const |
Still faster variant (just looks at the sprite-enabled-bit). | |
byte | getVerticalScroll () const |
Gets the current vertical scroll (line displayed at Y=0). | |
byte | getHorizontalScrollLow () const |
Gets the current horizontal scroll lower bits. | |
byte | getHorizontalScrollHigh () const |
Gets the current horizontal scroll higher bits. | |
bool | isBorderMasked () const |
Gets the current border mask setting. | |
bool | isMultiPageScrolling () const |
Is multi page scrolling enabled? It is considered enabled if both the multi page scrolling flag is enabled and the current page is odd. | |
int | getDisplayPage () const |
Only used by debugger. | |
int | getLineZero () const |
Get the absolute line number of display line zero. | |
bool | isPalTiming () const |
Is PAL timing active? This setting is fixed at start of frame. | |
bool | isInterlaced () const |
Get interlace status. | |
bool | isFastBlinkEnabled () const |
Get 'fast-blink' status. | |
bool | isEvenOddEnabled () const |
Get even/odd page alternation status. | |
bool | getEvenOdd () const |
Is the even or odd field being displayed? | |
unsigned | getEvenOddMask () const |
Expresses the state of even/odd page interchange in a mask on the line number. | |
unsigned | getEvenOddMask (int line) const |
Similar to the above getEvenOddMask() method, but can also be called when 'isFastBlinkEnabled() == true'. | |
BlinkStateCount | calculateLineBlinkState (unsigned line) const |
int | getTicksThisFrame (EmuTime::param time) const |
Gets the number of VDP clock ticks (21MHz) elapsed between a given time and the start of this frame. | |
EmuTime::param | getFrameStartTime () const |
int | getSpriteSize () const |
Gets the sprite size in pixels (8/16). | |
bool | isSpriteMag () const |
Are sprites magnified? | |
bool | getCmdBit () const |
Are commands possible in non Graphic modes? (V9958 only) | |
int | getLinesPerFrame () const |
Gets the number of lines per frame. | |
int | getNumberOfLines () const |
Gets the number of display lines per screen. | |
int | getTicksPerFrame () const |
Gets the number of VDP clock ticks (21MHz) per frame. | |
bool | isInsideFrame (EmuTime::param time) const |
Is the given timestamp inside the current frame? Mainly useful for debugging, because relevant timestamps should always be inside the current frame. | |
int | getHorizontalAdjust () const |
This is a combination of the (horizontal) set adjust register and the YJK-mode bit. | |
int | getLeftSprites () const |
Gets the number of VDP clock ticks between start of line and the start of the sprite plane. | |
int | getLeftBorder () const |
Gets the number of VDP clock ticks between start of line and the end of the left border. | |
int | getRightBorder () const |
Gets the number of VDP clock ticks between start of line and the start of the right border. | |
int | getLeftBackground () const |
Gets the number of VDP clock ticks between start of line and the time when the background pixel with X coordinate 0 would be drawn. | |
byte | getStatusReg0 () const |
Should only be used by SpriteChecker. | |
void | setSpriteStatus (byte value) |
Should only be used by SpriteChecker. | |
bool | getVRMode () const |
Returns current VR mode. | |
void | setExternalVideoSource (const RawFrame *externalSource) |
Enable superimposing. | |
bool | getBrokenCmdTiming () const |
Value of the cmdTiming setting, true means commands have infinite speed. | |
EmuTime | getAccessSlot (EmuTime::param time, VDPAccessSlots::Delta delta) const |
Get the earliest access slot that is at least 'delta' cycles in the future. | |
VDPAccessSlots::Calculator | getAccessSlotCalculator (EmuTime::param time, EmuTime::param limit) const |
Same as getAccessSlot(), but it can be much faster for repeated calls, e.g. | |
void | scheduleCmdSync (EmuTime t) |
Only used when there are commandExecuting-probe listeners. | |
gl::ivec2 | getMSXPos (EmuTime::param time) const |
Returns the position of the raster beam expressed in 'narrow' MSX screen coordinates (like 'screen 7'). | |
VDPCmdEngine & | getCmdEngine () |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
Public Member Functions inherited from openmsx::MSXDevice | |
MSXDevice (const MSXDevice &)=delete | |
MSXDevice (MSXDevice &&)=delete | |
MSXDevice & | operator= (const MSXDevice &)=delete |
MSXDevice & | operator= (MSXDevice &&)=delete |
virtual | ~MSXDevice ()=0 |
const HardwareConfig & | getHardwareConfig () const |
Returns the hardwareconfig this device belongs to. | |
void | testRemove (std::span< const std::unique_ptr< MSXDevice > > removed) const |
Checks whether this device can be removed (no other device has a reference to it). | |
virtual byte | readIRQVector () |
Gets IRQ vector used in IM2. | |
virtual void | powerDown (EmuTime::param time) |
This method is called when MSX is powered down. | |
virtual const std::string & | getName () const |
Returns a human-readable name for this device. | |
virtual void | getNameList (TclObject &result) const |
Returns list of name(s) of this device. | |
void | getDeviceInfo (TclObject &result) const |
Get device info. | |
void | getVisibleMemRegion (unsigned &base, unsigned &size) const |
Returns the range where this device is visible in memory. | |
virtual byte | readMem (word address, EmuTime::param time) |
Read a byte from a location at a certain time from this device. | |
virtual void | writeMem (word address, byte value, EmuTime::param time) |
Write a given byte to a given location at a certain time to this device. | |
virtual const byte * | getReadCacheLine (word start) const |
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading. | |
virtual byte * | getWriteCacheLine (word start) |
Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing. | |
virtual byte | peekMem (word address, EmuTime::param time) const |
Read a byte from a given memory location. | |
virtual void | globalWrite (word address, byte value, EmuTime::param time) |
Global writes. | |
virtual void | globalRead (word address, EmuTime::param time) |
Global reads. | |
void | invalidateDeviceRWCache () |
Calls MSXCPUInterface::invalidateXXCache() for the specific (part of) the slot that this device is located in. | |
void | invalidateDeviceRCache () |
void | invalidateDeviceWCache () |
void | invalidateDeviceRWCache (unsigned start, unsigned size) |
void | invalidateDeviceRCache (unsigned start, unsigned size) |
void | invalidateDeviceWCache (unsigned start, unsigned size) |
void | fillDeviceRWCache (unsigned start, unsigned size, byte *rwData) |
Calls MSXCPUInterface::fillXXCache() for the specific (part of) the slot that this device is located in. | |
void | fillDeviceRWCache (unsigned start, unsigned size, const byte *rData, byte *wData) |
void | fillDeviceRCache (unsigned start, unsigned size, const byte *rData) |
void | fillDeviceWCache (unsigned start, unsigned size, byte *wData) |
MSXMotherBoard & | getMotherBoard () const |
Get the mother board this device belongs to. | |
const XMLElement & | getDeviceConfig () const |
Get the configuration section for this device. | |
const DeviceConfig & | getDeviceConfig2 () const |
const Devices & | getReferences () const |
Get the device references that are specified for this device. | |
EmuTime::param | getCurrentTime () const |
MSXCPU & | getCPU () const |
MSXCPUInterface & | getCPUInterface () const |
Scheduler & | getScheduler () const |
MSXCliComm & | getCliComm () const |
Reactor & | getReactor () const |
CommandController & | getCommandController () const |
PluggingController & | getPluggingController () const |
LedStatus & | getLedStatus () const |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
Static Public Attributes | |
static constexpr int | TICKS_PER_SECOND = 3579545 * 6 |
Number of VDP clock ticks per second. | |
static constexpr int | TICKS_PER_LINE = 1368 |
Number of VDP clock ticks per line. | |
Static Public Attributes inherited from openmsx::MSXDevice | |
static std::array< byte, 0x10000 > | unmappedRead |
static std::array< byte, 0x10000 > | unmappedWrite |
Additional Inherited Members | |
Protected Member Functions inherited from openmsx::MSXDevice | |
MSXDevice (const DeviceConfig &config, std::string_view name) | |
Every MSXDevice has a config entry; this constructor gets some device properties from that config entry. | |
MSXDevice (const DeviceConfig &config) | |
virtual void | init () |
virtual unsigned | getBaseSizeAlignment () const |
The 'base' and 'size' attribute values need to be at least aligned to CacheLine::SIZE. | |
virtual bool | allowUnaligned () const |
By default we don't allow unaligned <mem> specifications in the config file. | |
byte | getPrimarySlot () const |
Protected Attributes inherited from openmsx::MSXDevice | |
std::string | deviceName |
Unified implementation of MSX Video Display Processors (VDPs).
MSX1 VDP is Texas Instruments TMS9918A or TMS9928A. MSX2 VDP is Yamaha V9938. MSX2+ and turbo R VDP is Yamaha V9958.
Current implementation is written by Maarten ter Huurne, with some contributions from other openMSX developers. The first implementation was based on Sean Young's code from MESS, which was in turn based on code by Mike Balfour. Integration of MESS code into openMSX was done by David Heremans.
All undocumented features as described in the following file should be emulated: http://www.msxnet.org/tech/tms9918a.txt
This class is the VDP core, it uses a separate Renderer to convert the VRAM contents into pixels on the host machine. Communicates with the Renderer through a pull variant of the Observer pattern: a VDP object fires events when its state changes, the Renderer can retrieve the new state if necessary by calling methods on the VDP object.
A note about timing: the start of a frame or line is defined as the starting time of the corresponding sync (vsync, hsync).
using openmsx::VDP::VDPClock = Clock<TICKS_PER_SECOND> |
|
explicit |
Definition at line 65 of file VDP.cc.
References openmsx::Subject< T >::attach(), openmsx::Display::attach(), openmsx::DeviceConfig::findChild(), openmsx::DeviceConfig::getChildData(), openmsx::DeviceConfig::getChildDataAsInt(), openmsx::MSXDevice::getCommandController(), openmsx::MSXDevice::getCurrentTime(), openmsx::Display::getRenderSettings(), isMSX1VDP(), and powerUp().
|
override |
Definition at line 221 of file VDP.cc.
References openmsx::Subject< T >::detach(), and openmsx::Display::detach().
|
inline |
Definition at line 485 of file VDP.hh.
References isFastBlinkEnabled().
Referenced by getEvenOddMask().
|
inline |
Can a sprite which has color=0 collide with some other sprite?
Definition at line 195 of file VDP.hh.
References getTransparency(), and isMSX1VDP().
VDP control register has changed, work out the consequences.
Definition at line 1011 of file VDP.cc.
References openmsx::TclCallback::execute(), openmsx::DisplayMode::getByte(), getDisplayMode(), openmsx::DisplayMode::GRAPHIC7, isVDPwithVRAMremapping(), openmsx::DisplayMode::REG0_MASK, openmsx::DisplayMode::REG1_MASK, openmsx::DisplayMode::REG25_MASK, openmsx::IntHelper< SOURCE >::reset(), openmsx::IntHelper< SOURCE >::set(), and vdpHasPatColMirroring().
Referenced by writeIO().
EmuTime openmsx::VDP::getAccessSlot | ( | EmuTime::param | time, |
VDPAccessSlots::Delta | delta | ||
) | const |
Get the earliest access slot that is at least 'delta' cycles in the future.
Definition at line 890 of file VDP.cc.
References openmsx::VDPAccessSlots::getAccessSlot(), and getFrameStartTime().
VDPAccessSlots::Calculator openmsx::VDP::getAccessSlotCalculator | ( | EmuTime::param | time, |
EmuTime::param | limit | ||
) | const |
Same as getAccessSlot(), but it can be much faster for repeated calls, e.g.
in the implementation of VDP commands. However it does have some limitations:
Definition at line 896 of file VDP.cc.
References openmsx::VDPAccessSlots::getCalculator(), and getFrameStartTime().
|
inline |
Gets the current background color.
Definition at line 219 of file VDP.hh.
References openmsx::DisplayMode::getByte(), and openmsx::DisplayMode::GRAPHIC7.
Referenced by openmsx::SDLRasterizer::setDisplayMode(), openmsx::SDLRasterizer::setPalette(), openmsx::SDLRasterizer::setSuperimposeVideoFrame(), openmsx::SDLRasterizer::setTransparency(), and openmsx::PixelRenderer::updatePalette().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Are commands possible in non Graphic modes? (V9958 only)
Definition at line 547 of file VDP.hh.
Referenced by openmsx::VDPCmdEngine::reset().
|
inline |
|
inline |
|
inline |
Get the display mode the VDP is in.
Definition at line 156 of file VDP.hh.
Referenced by changeRegister(), openmsx::SDLRasterizer::drawBorder(), openmsx::SDLRasterizer::drawDisplay(), openmsx::SDLRasterizer::drawSprites(), openmsx::SDLRasterizer::reset(), openmsx::VDPCmdEngine::reset(), openmsx::SpriteChecker::serialize(), openmsx::SDLRasterizer::setBackgroundColor(), openmsx::SDLRasterizer::setPalette(), openmsx::SDLRasterizer::setSuperimposeVideoFrame(), openmsx::SDLRasterizer::setTransparency(), openmsx::PixelRenderer::updateDisplayMode(), and openmsx::PixelRenderer::updatePalette().
|
inline |
|
inline |
Is the even or odd field being displayed?
Definition at line 439 of file VDP.hh.
Referenced by openmsx::PixelRenderer::frameStart(), and openmsx::SDLRasterizer::frameStart().
|
inline |
Expresses the state of even/odd page interchange in a mask on the line number.
If even/odd interchange is active, for some frames lines 256..511 (page 1) are replaced by 0..255 (page 0) and 768..1023 (page 3, if applicable) by 512..767 (page 2). Together with the interlace setting this can be used to create an interlaced display. Even/odd interchange can also happen because of the 'blink' feature in bitmap modes.
Definition at line 454 of file VDP.hh.
References isFastBlinkEnabled().
Referenced by openmsx::SDLRasterizer::drawDisplay(), and getEvenOddMask().
|
inline |
Similar to the above getEvenOddMask() method, but can also be called when 'isFastBlinkEnabled() == true'.
In the latter case the timing is based on lines instead of frames. This means the result is no longer fixed per frame, and thus this method takes an additional line parameter.
Definition at line 467 of file VDP.hh.
References calculateLineBlinkState(), getEvenOddMask(), and isFastBlinkEnabled().
|
overridevirtual |
Reimplemented from openmsx::MSXDevice.
Definition at line 746 of file VDP.cc.
References openmsx::TclObject::addDictKeyValues(), and getVersionString().
|
inline |
|
inline |
Definition at line 528 of file VDP.hh.
References openmsx::Clock< FREQ_NUM, FREQ_DENOM >::getTime().
Referenced by getAccessSlot(), getAccessSlotCalculator(), and openmsx::SpriteChecker::serialize().
|
inline |
|
inline |
Gets the current horizontal scroll higher bits.
This value determines how many 8-pixel steps the background is rotated to the left.
Definition at line 349 of file VDP.hh.
Referenced by openmsx::SDLRasterizer::drawDisplay().
|
inline |
Gets the current horizontal scroll lower bits.
Rather than actually scrolling the screen, this setting shifts the screen 0..7 bytes to the right.
Definition at line 340 of file VDP.hh.
Referenced by getLeftBackground().
|
inline |
Gets the number of VDP clock ticks between start of line and the time when the background pixel with X coordinate 0 would be drawn.
This includes extra pixels of horizontal scroll low, but disregards border mask.
Definition at line 626 of file VDP.hh.
References getHorizontalScrollLow(), and getLeftSprites().
Referenced by openmsx::SDLRasterizer::drawDisplay().
|
inline |
Gets the number of VDP clock ticks between start of line and the end of the left border.
Does not include extra pixels of horizontal scroll low, since those are not actually border pixels (sprites appear in front of them).
Definition at line 609 of file VDP.hh.
References getLeftSprites(), and isBorderMasked().
|
inline |
Gets the number of VDP clock ticks between start of line and the start of the sprite plane.
The location of the sprite plane is not influenced by horizontal scroll or border mask. TODO: Leave out the text mode case, since there are no sprites in text mode?
Definition at line 598 of file VDP.hh.
References openmsx::DisplayMode::isTextMode().
Referenced by openmsx::SDLRasterizer::drawSprites(), getLeftBackground(), getLeftBorder(), getMSXPos(), and getRightBorder().
|
inline |
Gets the number of lines per frame.
Definition at line 553 of file VDP.hh.
Referenced by getTicksPerFrame().
|
inline |
Get the absolute line number of display line zero.
Usually this is equal to the height of the top border, but not so during overscan.
Definition at line 383 of file VDP.hh.
References TICKS_PER_LINE.
Referenced by getMSXPos().
std::array< std::array< uint8_t, 3 >, 16 > openmsx::VDP::getMSX1Palette | ( | ) | const |
Get the (fixed) palette for this MSX1 VDP.
Don't use this if it's not an MSX1 VDP!
Definition at line 1544 of file VDP.cc.
References openmsx::B, Math::clipIntToByte(), openmsx::MSXDevice::getDeviceConfig(), isMSX1VDP(), and xrange().
|
inline |
Returns the position of the raster beam expressed in 'narrow' MSX screen coordinates (like 'screen 7').
Horizontally: pixels in the left border have a negative coordinate, pixels in the right border have a coordinate bigger than or equal to 512. For MSX screen modes that are 256 pixels wide (e.g. 'screen 5') divide the x-coordinate by 2. For text modes (aka screen 0, width 40/80) subtract 16 from the x-coordinate (= (512-480)/2), and divide by 2 (for width 40).
Vertically: lines in the top border have negative coordinates, lines in the bottom border have coordinates bigger or equal to 192 or 212.
Definition at line 729 of file VDP.hh.
References getLeftSprites(), getLineZero(), getTicksThisFrame(), and TICKS_PER_LINE.
|
inline |
|
inline |
Gets the number of display lines per screen.
Definition at line 560 of file VDP.hh.
Referenced by peekStatusReg().
|
inline |
|
inline |
Gets a palette entry.
index | The index [0..15] in the palette. |
Definition at line 279 of file VDP.hh.
Referenced by openmsx::ImGuiPalette::getPalette(), and openmsx::ImGuiPalette::paint().
|
inline |
PostProcessor * openmsx::VDP::getPostProcessor | ( | ) | const |
|
inline |
Gets the number of VDP clock ticks between start of line and the start of the right border.
Definition at line 616 of file VDP.hh.
References getLeftSprites(), and openmsx::DisplayMode::isTextMode().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Should only be used by SpriteChecker.
Returns the current value of status register 0 (both the F-flag and the sprite related bits).
Definition at line 633 of file VDP.hh.
Referenced by openmsx::SpriteChecker::resetStatus().
|
inline |
Gets the number of VDP clock ticks (21MHz) per frame.
Definition at line 566 of file VDP.hh.
References getLinesPerFrame(), and TICKS_PER_LINE.
Referenced by isInsideFrame(), and peekStatusReg().
|
inline |
Gets the number of VDP clock ticks (21MHz) elapsed between a given time and the start of this frame.
Definition at line 524 of file VDP.hh.
References openmsx::Clock< FREQ_NUM, FREQ_DENOM >::getTicksTill_fast().
Referenced by getMSXPos(), isInsideFrame(), and peekStatusReg().
|
inline |
Gets the current transparency setting.
Definition at line 189 of file VDP.hh.
Referenced by canSpriteColor0Collide(), openmsx::SDLRasterizer::reset(), openmsx::SDLRasterizer::setBackgroundColor(), openmsx::SDLRasterizer::setDisplayMode(), openmsx::SDLRasterizer::setPalette(), and openmsx::SDLRasterizer::setSuperimposeVideoFrame().
std::string_view openmsx::VDP::getVersionString | ( | ) | const |
Definition at line 735 of file VDP.cc.
References openmsx::XMLElement::findChild(), and openmsx::MSXDevice::getDeviceConfig().
Referenced by getExtraDeviceInfo().
|
inline |
|
inline |
|
inline |
|
inline |
Returns current VR mode.
false -> VR=0, true -> VR=1
Definition at line 651 of file VDP.hh.
Referenced by openmsx::VDPVRAM::serialize().
|
inline |
|
inline |
Gets the current border mask setting.
Border mask extends the left border by 8 pixels if enabled. This is a V9958 feature, on older VDPs it always returns false.
Definition at line 358 of file VDP.hh.
Referenced by getLeftBorder().
|
inline |
Is the display enabled? Both the regular border and forced blanking by clearing the display enable bit are considered disabled display.
Definition at line 299 of file VDP.hh.
Referenced by openmsx::PixelRenderer::reInit().
|
inline |
Get even/odd page alternation status.
Interlace means the odd fields are displayed half a line lower than the even fields. Together with even/odd page alternation this can be used to create an interlaced display. This setting is NOT fixed at start of frame. TODO: Find out how real VDP does it. If it fixes it at start of frame, so should we. If it handles it dynamically (my guess), then an update method should be added on the Renderer interface.
Definition at line 431 of file VDP.hh.
References isFastBlinkEnabled().
Referenced by openmsx::PixelRenderer::frameEnd(), and openmsx::PixelRenderer::frameStart().
|
inline |
Get 'fast-blink' status.
Normally blinking timing (alternating between pages) is based on frames. Though the V99x8 has an undocumented feature which changes this timing to lines. Sometimes this is called the "Cadari" feature after Luciano Cadari who discovered it.
See ticket#1091: "Support for undocumented V99x8 register 1 bit 2" https://github.com/openMSX/openMSX/issues/1091 for test cases and links to more information.
Definition at line 416 of file VDP.hh.
Referenced by calculateLineBlinkState(), getEvenOddMask(), getEvenOddMask(), and isEvenOddEnabled().
|
inline |
Is the given timestamp inside the current frame? Mainly useful for debugging, because relevant timestamps should always be inside the current frame.
The end time of a frame is still considered inside, to support the case when the given timestamp is exclusive itself: a typically "limit" variable.
time | Timestamp to check. |
Definition at line 579 of file VDP.hh.
References getTicksPerFrame(), getTicksThisFrame(), and openmsx::Clock< FREQ_NUM, FREQ_DENOM >::getTime().
Referenced by openmsx::VDPVRAM::cmdWrite(), openmsx::VDPVRAM::cpuRead(), openmsx::VDPVRAM::cpuWrite(), readIO(), openmsx::VDPVRAM::sync(), openmsx::VDPVRAM::updateDisplayEnabled(), openmsx::VDPVRAM::updateDisplayMode(), openmsx::VDPVRAM::updateSpritesEnabled(), and writeIO().
|
inline |
Get interlace status.
Interlace means the odd fields are displayed half a line lower than the even fields. Together with even/odd page alternation this can be used to create an interlaced display. This setting is fixed at start of frame.
Definition at line 402 of file VDP.hh.
Referenced by openmsx::PixelRenderer::frameEnd(), openmsx::PixelRenderer::frameStart(), and openmsx::SDLRasterizer::frameStart().
|
inline |
Is this an MSX1 VDP?
Definition at line 108 of file VDP.hh.
Referenced by canSpriteColor0Collide(), openmsx::CharacterConverter::convertLine(), openmsx::SDLRasterizer::drawDisplay(), openmsx::SDLRasterizer::drawSprites(), getMSX1Palette(), openmsx::ImGuiPalette::getPalette(), openmsx::ImGuiPalette::paint(), readIO(), openmsx::SDLRasterizer::SDLRasterizer(), spritesEnabled(), spritesEnabledFast(), VDP(), and writeIO().
|
inline |
Is multi page scrolling enabled? It is considered enabled if both the multi page scrolling flag is enabled and the current page is odd.
Scrolling wraps into the lower even page.
Definition at line 368 of file VDP.hh.
Referenced by openmsx::SDLRasterizer::drawDisplay().
|
inline |
Is PAL timing active? This setting is fixed at start of frame.
Definition at line 391 of file VDP.hh.
Referenced by openmsx::SDLRasterizer::frameStart().
|
inline |
|
inline |
Are we currently superimposing? In case of superimpose, returns a pointer to the to-be-superimposed frame.
Returns nullptr if superimpose is not active.
Definition at line 170 of file VDP.hh.
Referenced by openmsx::SDLRasterizer::setBackgroundColor(), openmsx::SDLRasterizer::setDisplayMode(), openmsx::SDLRasterizer::setPalette(), and openmsx::SDLRasterizer::setTransparency().
|
inline |
|
inline |
Does this VDP have VRAM remapping when switching from 4k to 8/16k mode?
Definition at line 136 of file VDP.hh.
Referenced by changeRegister().
Read a byte from a given IO port.
Reading via this method has no side effects (doesn't change the device status). If safe reading is not possible this method returns 0xFF. This method is not used by the emulation. It can however be used by a debugger. The default implementation just returns 0xFF.
Reimplemented from openmsx::MSXDevice.
Definition at line 1005 of file VDP.cc.
Referenced by openmsx::MSXMatsushita::peekIO().
Definition at line 903 of file VDP.cc.
References getNumberOfLines(), openmsx::IntHelper< SOURCE >::getState(), getTicksPerFrame(), getTicksThisFrame(), openmsx::DisplayMode::isTextMode(), and TICKS_PER_LINE.
|
overridevirtual |
Read a byte from an IO port at a certain time from this device.
The default implementation returns 255.
Reimplemented from openmsx::MSXDevice.
Definition at line 985 of file VDP.cc.
References isInsideFrame(), isMSX1VDP(), and UNREACHABLE.
Referenced by openmsx::MSXMatsushita::readIO().
|
overridevirtual |
This method is called on reset.
Default implementation does nothing.
Reimplemented from openmsx::MSXDevice.
Definition at line 325 of file VDP.cc.
Referenced by powerUp().
|
inline |
Only used when there are commandExecuting-probe listeners.
Call to announce a (lower-bound) estimate for when the VDP command will finish executing. In response the VDP will schedule a synchronization point to sync with VDPCmdEngine emulation.
Normally it's not required to pro-actively sync with the end of a VDP command. Instead these sync happen reactively on VDP status reads (e.g. polling the CE bit) or on VRAM reads (rendering or CPU VRAM read). This is in contrast with the V9990 where we DO need an active sync because the V9990 can generate an IRQ on command end.
Though when the VDP.commandExecuting probe is in use we do want a reasonably timing accurate reaction of that probe. So (only) then we do add the extra syncs (thus with extra emulation overhead when you use that probe).
Definition at line 700 of file VDP.hh.
References openmsx::Clock< TICKS_PER_SECOND >::duration(), openmsx::MSXDevice::getCurrentTime(), and t.
void openmsx::VDP::serialize | ( | Archive & | ar, |
unsigned | version | ||
) |
Definition at line 1905 of file VDP.cc.
References openmsx::DisplayMode::getByte(), openmsx::Schedulable::restoreOld(), and openmsx::DisplayMode::setByte().
|
inline |
void openmsx::VDP::setPalette | ( | unsigned | index, |
word | grb, | ||
EmuTime::param | time | ||
) |
Sets a palette entry.
index | The index [0..15] in the palette. |
grb | value in the format of the palette registers: bit 10..8 is green, bit 6..4 is red and bit 2..0 is blue. |
time | Moment in time palette change occurs. |
Definition at line 762 of file VDP.cc.
Referenced by openmsx::ImGuiPalette::paint(), and writeIO().
|
inline |
Should only be used by SpriteChecker.
Change the sprite related bits of status register 0 (leaves the F-flag unchanged). Bit 6 (5S) is set when more than 4 (sprite mode 1) or 8 (sprite mode 2) sprites occur on the same line. Bit 5 (C) is set when sprites collide. Bit 4..0 (5th sprite number) contains the number of the first sprite to exceed the limit per line.
Definition at line 643 of file VDP.hh.
Referenced by openmsx::SpriteChecker::reset(), and openmsx::SpriteChecker::resetStatus().
|
inline |
Are sprites enabled?
Definition at line 307 of file VDP.hh.
References openmsx::DisplayMode::getSpriteMode(), and isMSX1VDP().
|
inline |
Same as spritesEnabled(), but may only be called in sprite mode 1 or 2.
Is a tiny bit faster.
Definition at line 316 of file VDP.hh.
References openmsx::DisplayMode::getSpriteMode(), and isMSX1VDP().
|
inline |
|
inline |
Is this a VDP that has pattern/color table mirroring?
Definition at line 129 of file VDP.hh.
Referenced by changeRegister().
|
inline |
Write a byte to a given IO port at a certain time to this device.
The default implementation ignores the write (does nothing)
Reimplemented from openmsx::MSXDevice.
Definition at line 645 of file VDP.cc.
References changeRegister(), isInsideFrame(), isMSX1VDP(), setPalette(), and openmsx::MSXCPU::waitCyclesZ80().
Referenced by openmsx::MSXMatsushita::writeIO().
|
staticconstexpr |
Number of VDP clock ticks per line.
Definition at line 76 of file VDP.hh.
Referenced by openmsx::SpriteChecker::checkUntil(), openmsx::SDLRasterizer::drawBorder(), getLineZero(), getMSXPos(), getTicksPerFrame(), peekStatusReg(), and openmsx::SpriteChecker::updateDisplayMode().
|
staticconstexpr |