openMSX
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
openmsx::VDP Class Referencefinal

Unified implementation of MSX Video Display Processors (VDPs). More...

#include <VDP.hh>

Inheritance diagram for openmsx::VDP:
Inheritance graph
[legend]
Collaboration diagram for openmsx::VDP:
Collaboration graph
[legend]

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. More...
 
void reset (EmuTime::param time) override
 This method is called on reset. More...
 
byte readIO (word port, EmuTime::param time) override
 Read a byte from an IO port at a certain time from this device. More...
 
byte peekIO (word port, EmuTime::param time) const override
 Read a byte from a given IO port. More...
 
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. More...
 
PostProcessorgetPostProcessor () const
 Used by Video9000 to be able to couple the VDP and V9990 output. More...
 
bool isMSX1VDP () const
 Is this an MSX1 VDP? More...
 
bool isVDPwithPALonly () const
 Is this a VDP only capable of PAL? More...
 
bool vdpLacksMirroring () const
 Is this a VDP that lacks mirroring? More...
 
bool vdpHasPatColMirroring () const
 Is this a VDP that has pattern/colortable mirroring? More...
 
bool isVDPwithVRAMremapping () const
 Does this VDP have VRAM remapping when switching from 4k to 8/16k mode? More...
 
bool hasYJK () const
 Does this VDP support YJK display? More...
 
std::array< std::array< uint8_t, 3 >, 16 > getMSX1Palette () const
 Get the (fixed) palette for this MSX1 VDP. More...
 
DisplayMode getDisplayMode () const
 Get the display mode the VDP is in. More...
 
VDPVRAMgetVRAM ()
 Get the VRAM object for this VDP. More...
 
const RawFrameisSuperimposing () const
 Are we currently superimposing? In case of superimpose, returns a pointer to the to-be-superimposed frame. More...
 
SpriteCheckergetSpriteChecker ()
 Get the sprite checker for this VDP. More...
 
bool getTransparency () const
 Gets the current transparency setting. More...
 
int getForegroundColor () const
 Gets the current foreground color. More...
 
int getBackgroundColor () const
 Gets the current background color. More...
 
int getBlinkForegroundColor () const
 Gets the current blinking color for blinking text. More...
 
int getBlinkBackgroundColor () const
 Gets the current blinking color for blinking text. More...
 
bool getBlinkState () const
 Gets the current blink state. More...
 
word getPalette (int index) const
 Gets a palette entry. More...
 
bool isDisplayEnabled () const
 Is the display enabled? Both the regular border and forced blanking by clearing the display enable bit are considered disabled display. More...
 
bool spritesEnabled () const
 Are sprites enabled? More...
 
bool spritesEnabledFast () const
 Same as spritesEnabled(), but may only be called in sprite mode 1 or 2. More...
 
bool spritesEnabledRegister () const
 Still faster variant (just looks at the sprite-enabled-bit). More...
 
byte getVerticalScroll () const
 Gets the current vertical scroll (line displayed at Y=0). More...
 
byte getHorizontalScrollLow () const
 Gets the current horizontal scroll lower bits. More...
 
byte getHorizontalScrollHigh () const
 Gets the current horizontal scroll higher bits. More...
 
bool isBorderMasked () const
 Gets the current border mask setting. More...
 
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. More...
 
int getLineZero () const
 Get the absolute line number of display line zero. More...
 
bool isPalTiming () const
 Is PAL timing active? This setting is fixed at start of frame. More...
 
bool isInterlaced () const
 Get interlace status. More...
 
bool isFastBlinkEnabled () const
 Get 'fast-blink' status. More...
 
bool isEvenOddEnabled () const
 Get even/odd page alternation status. More...
 
bool getEvenOdd () const
 Is the even or odd field being displayed? More...
 
int getEvenOddMask () const
 Expresses the state of even/odd page interchange in a mask on the line number. More...
 
int getEvenOddMask (int line) const
 Similar to the above getEvenOddMask() method, but can also be called when 'isFastBlinkEnabled() == true'. More...
 
std::pair< bool, int > calculateLineBlinkState (unsigned line) const
 Calculates what 'blinkState' and 'blinkCount' would be at a specific line. More...
 
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. More...
 
EmuTime::param getFrameStartTime () const
 
int getSpriteSize () const
 Gets the sprite size in pixels (8/16). More...
 
bool isSpriteMag () const
 Are sprites magnified? More...
 
bool getCmdBit () const
 Are commands possible in non Graphic modes? (V9958 only) More...
 
int getLinesPerFrame () const
 Gets the number of lines per frame. More...
 
int getTicksPerFrame () const
 Gets the number of VDP clockticks (21MHz) per frame. More...
 
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. More...
 
int getHorizontalAdjust () const
 This is a combination of the (horizontal) set adjust register and the YJK-mode bit. More...
 
int getLeftSprites () const
 Gets the number of VDP clockticks between start of line and the start of the sprite plane. More...
 
int getLeftBorder () const
 Gets the number of VDP clockticks between start of line and the end of the left border. More...
 
int getRightBorder () const
 Gets the number of VDP clockticks between start of line and the start of the right border. More...
 
int getLeftBackground () const
 Gets the number of VDP clockticks between start of line and the time when the background pixel with X coordinate 0 would be drawn. More...
 
byte getStatusReg0 () const
 Should only be used by SpriteChecker. More...
 
void setSpriteStatus (byte value)
 Should only be used by SpriteChecker. More...
 
bool getVRMode () const
 Returns current VR mode. More...
 
void setExternalVideoSource (const RawFrame *externalSource)
 Enable superimposing. More...
 
bool getBrokenCmdTiming () const
 Value of the cmdTiming setting, true means commands have infinite speed. More...
 
EmuTime getAccessSlot (EmuTime::param time, VDPAccessSlots::Delta delta) const
 Get the earliest access slot that is at least 'delta' cycles in the future. More...
 
VDPAccessSlots::Calculator getAccessSlotCalculator (EmuTime::param time, EmuTime::param limit) const
 Same as getAccessSlot(), but it can be much faster for repeated calls, e.g. More...
 
void scheduleCmdSync (EmuTime t)
 Only used when there are commandExecuting-probe listeners. More...
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 
- Public Member Functions inherited from openmsx::MSXDevice
 MSXDevice (const MSXDevice &)=delete
 
MSXDeviceoperator= (const MSXDevice &)=delete
 
virtual ~MSXDevice ()=0
 
const HardwareConfiggetHardwareConfig () const
 Returns the hardwareconfig this device belongs to. More...
 
void testRemove (Devices alreadyRemoved) const
 Checks whether this device can be removed (no other device has a reference to it). More...
 
virtual byte readIRQVector ()
 Gets IRQ vector used in IM2. More...
 
virtual void powerDown (EmuTime::param time)
 This method is called when MSX is powered down. More...
 
virtual std::string getName () const
 Returns a human-readable name for this device. More...
 
virtual void getNameList (TclObject &result) const
 Returns list of name(s) of this device. More...
 
void getDeviceInfo (TclObject &result) const
 Get device info. More...
 
void getVisibleMemRegion (unsigned &base, unsigned &size) const
 Returns the range where this device is visible in memory. More...
 
virtual byte readMem (word address, EmuTime::param time)
 Read a byte from a location at a certain time from this device. More...
 
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. More...
 
virtual const bytegetReadCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for reading. More...
 
virtual bytegetWriteCacheLine (word start) const
 Test that the memory in the interval [start, start + CacheLine::SIZE) is cacheable for writing. More...
 
virtual byte peekMem (word address, EmuTime::param time) const
 Read a byte from a given memory location. More...
 
virtual void globalWrite (word address, byte value, EmuTime::param time)
 Global writes. More...
 
virtual void globalRead (word address, EmuTime::param time)
 Global reads. More...
 
void invalidateMemCache (word start, unsigned size)
 Invalidate CPU memory-mapping cache. More...
 
MSXMotherBoardgetMotherBoard () const
 Get the mother board this device belongs to. More...
 
const XMLElementgetDeviceConfig () const
 Get the configuration section for this device. More...
 
const DeviceConfiggetDeviceConfig2 () const
 
const DevicesgetReferences () const
 Get the device references that are specified for this device. More...
 
EmuTime::param getCurrentTime () const
 
MSXCPUgetCPU () const
 
MSXCPUInterfacegetCPUInterface () const
 
SchedulergetScheduler () const
 
CliCommgetCliComm () const
 
ReactorgetReactor () const
 
CommandControllergetCommandController () const
 
PluggingControllergetPluggingController () const
 
LedStatusgetLedStatus () 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. More...
 
static constexpr int TICKS_PER_LINE = 1368
 Number of VDP clock ticks per line. More...
 
- Static Public Attributes inherited from openmsx::MSXDevice
static byte unmappedRead [0x10000]
 
static byte unmappedWrite [0x10000]
 

Additional Inherited Members

- Protected Member Functions inherited from openmsx::MSXDevice
 MSXDevice (const DeviceConfig &config, const std::string &name)
 Every MSXDevice has a config entry; this constructor gets some device properties from that config entry. More...
 
 MSXDevice (const DeviceConfig &config)
 
virtual void init ()
 
virtual void getExtraDeviceInfo (TclObject &result) const
 

Detailed Description

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).

Definition at line 61 of file VDP.hh.

Member Typedef Documentation

◆ VDPClock

Definition at line 68 of file VDP.hh.

Constructor & Destructor Documentation

◆ VDP()

openmsx::VDP::VDP ( const DeviceConfig config)
explicit

◆ ~VDP()

openmsx::VDP::~VDP ( )
override

Member Function Documentation

◆ calculateLineBlinkState()

std::pair<bool, int> openmsx::VDP::calculateLineBlinkState ( unsigned  line) const
inline

Calculates what 'blinkState' and 'blinkCount' would be at a specific line.

(The actual 'blinkState' and 'blinkCount' variables represent the values for line 0 and remain fixed for the duration of the frame.

Definition at line 412 of file VDP.hh.

Referenced by reset().

◆ getAccessSlot()

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 854 of file VDP.cc.

References openmsx::VDPAccessSlots::getAccessSlot(), and getFrameStartTime().

Referenced by openmsx::VDPCmdEngine::getBorderX().

◆ getAccessSlotCalculator()

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:

  • The returned calculator only remains valid for as long as the VDP access timing remains the same (display/sprite enable).
  • The calculator needs to see all time changes. (So this means that in every VDPCmd::execute() method you need to construct a new calculator).

Definition at line 860 of file VDP.cc.

References openmsx::VDPAccessSlots::getCalculator(), getFrameStartTime(), openmsx::IntHelper< SOURCE >::getState(), getTicksPerFrame(), getTicksThisFrame(), openmsx::DisplayMode::isTextMode(), openmsx::IntHelper< SOURCE >::reset(), and TICKS_PER_LINE.

Referenced by openmsx::VDPCmdEngine::getBorderX().

◆ getBackgroundColor()

int openmsx::VDP::getBackgroundColor ( ) const
inline

Gets the current background color.

Returns
Color index. In Graphic5 mode, the range is [0..15]; bits 3-2 contains the color for even pixels, bits 1-0 contains the color for odd pixels. In Graphic7 mode with YJK off, the range is [0..255]. In other modes, the range is [0..15].

Definition at line 193 of file VDP.hh.

References openmsx::DisplayMode::GRAPHIC7.

Referenced by openmsx::CharacterConverter< Pixel >::convertLine(), openmsx::SDLRasterizer< Pixel >::setDisplayMode(), openmsx::SDLRasterizer< Pixel >::setPalette(), openmsx::SDLRasterizer< Pixel >::setSuperimposeVideoFrame(), openmsx::SDLRasterizer< Pixel >::setTransparency(), and openmsx::PixelRenderer::updatePalette().

◆ getBlinkBackgroundColor()

int openmsx::VDP::getBlinkBackgroundColor ( ) const
inline

Gets the current blinking color for blinking text.

Returns
Color index [0..15].

Definition at line 212 of file VDP.hh.

Referenced by openmsx::CharacterConverter< Pixel >::convertLine().

◆ getBlinkForegroundColor()

int openmsx::VDP::getBlinkForegroundColor ( ) const
inline

Gets the current blinking color for blinking text.

Returns
Color index [0..15].

Definition at line 205 of file VDP.hh.

Referenced by openmsx::CharacterConverter< Pixel >::convertLine().

◆ getBlinkState()

bool openmsx::VDP::getBlinkState ( ) const
inline

Gets the current blink state.

Returns
True iff alternate colors / page should be displayed.

Definition at line 219 of file VDP.hh.

Referenced by openmsx::CharacterConverter< Pixel >::convertLine().

◆ getBrokenCmdTiming()

bool openmsx::VDP::getBrokenCmdTiming ( ) const
inline

Value of the cmdTiming setting, true means commands have infinite speed.

Definition at line 583 of file VDP.hh.

References openmsx::VDPAccessSlots::getAccessSlot().

◆ getCmdBit()

bool openmsx::VDP::getCmdBit ( ) const
inline

Are commands possible in non Graphic modes? (V9958 only)

Returns
True iff CMD bit set.

Definition at line 474 of file VDP.hh.

Referenced by openmsx::VDPCmdEngine::reset(), and reset().

◆ getDisplayMode()

DisplayMode openmsx::VDP::getDisplayMode ( ) const
inline

◆ getEvenOdd()

bool openmsx::VDP::getEvenOdd ( ) const
inline

Is the even or odd field being displayed?

Returns
True iff this field should be displayed half a line lower.

Definition at line 370 of file VDP.hh.

Referenced by openmsx::PixelRenderer::frameStart(), and openmsx::SDLRasterizer< Pixel >::frameStart().

◆ getEvenOddMask() [1/2]

int openmsx::VDP::getEvenOddMask ( ) const
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.

Precondition
!isFastBlinkEnabled()
Returns
Line number mask that expressed even/odd state.

Definition at line 385 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::drawDisplay(), and openmsx::PixelRenderer::updateSpritesEnabled().

◆ getEvenOddMask() [2/2]

int openmsx::VDP::getEvenOddMask ( int  line) const
inline

Similar to the above getEvenOddMask() method, but can also be called when 'isFastBlinkEnabled() == true'.

In the latter case the timinig 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 398 of file VDP.hh.

◆ getForegroundColor()

int openmsx::VDP::getForegroundColor ( ) const
inline

Gets the current foreground color.

Returns
Color index [0..15].

Definition at line 181 of file VDP.hh.

Referenced by openmsx::CharacterConverter< Pixel >::convertLine().

◆ getFrameStartTime()

EmuTime::param openmsx::VDP::getFrameStartTime ( ) const
inline

◆ getHorizontalAdjust()

int openmsx::VDP::getHorizontalAdjust ( ) const
inline

This is a combination of the (horizontal) set adjust register and the YJK-mode bit.

Definition at line 507 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::frameEnd(), and openmsx::SDLRasterizer< Pixel >::frameStart().

◆ getHorizontalScrollHigh()

byte openmsx::VDP::getHorizontalScrollHigh ( ) const
inline

Gets the current horizontal scroll higher bits.

This value determines how many 8-pixel steps the background is rotated to the left.

Returns
Horizontal scroll high register value.

Definition at line 287 of file VDP.hh.

Referenced by openmsx::CharacterConverter< Pixel >::convertLine(), and openmsx::SDLRasterizer< Pixel >::drawDisplay().

◆ getHorizontalScrollLow()

byte openmsx::VDP::getHorizontalScrollLow ( ) const
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.

Returns
Horizontal scroll low register value.

Definition at line 278 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::frameEnd(), and openmsx::SDLRasterizer< Pixel >::frameStart().

◆ getLeftBackground()

int openmsx::VDP::getLeftBackground ( ) const
inline

Gets the number of VDP clockticks 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 546 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::drawDisplay(), and openmsx::PixelRenderer::updateWindow().

◆ getLeftBorder()

int openmsx::VDP::getLeftBorder ( ) const
inline

Gets the number of VDP clockticks 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 529 of file VDP.hh.

Referenced by openmsx::PixelRenderer::updateWindow().

◆ getLeftSprites()

int openmsx::VDP::getLeftSprites ( ) const
inline

Gets the number of VDP clockticks 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 518 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::drawSprites().

◆ getLinesPerFrame()

int openmsx::VDP::getLinesPerFrame ( ) const
inline

Gets the number of lines per frame.

Definition at line 480 of file VDP.hh.

Referenced by reset().

◆ getLineZero()

int openmsx::VDP::getLineZero ( ) const
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 314 of file VDP.hh.

Referenced by openmsx::SpriteChecker::reset(), and openmsx::PixelRenderer::updateSpritesEnabled().

◆ getMSX1Palette()

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!

Returns
an array of 16 RGB triplets

Definition at line 1482 of file VDP.cc.

References openmsx::B, Math::clipIntToByte(), openmsx::MSXDevice::getDeviceConfig(), openmsx::MSXDevice::getMotherBoard(), openmsx::MSXDevice::getName(), isMSX1VDP(), openmsx::R, openmsx::THREE_BIT_RGB_PALETTE, and openmsx::TOSHIBA_PALETTE.

Referenced by openmsx::SDLRasterizer< Pixel >::setTransparency().

◆ getPalette()

word openmsx::VDP::getPalette ( int  index) const
inline

Gets a palette entry.

Parameters
indexThe index [0..15] in the palette.
Returns
Color value in the format of the palette registers: bit 10..8 is green, bit 6..4 is red and bit 2..0 is blue.

Definition at line 228 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::reset().

◆ getPostProcessor()

PostProcessor * openmsx::VDP::getPostProcessor ( ) const

Used by Video9000 to be able to couple the VDP and V9990 output.

Can return nullptr in case of renderer=none. This value can change over the lifetime of the VDP object (on renderer switch).

Definition at line 242 of file VDP.cc.

References ranges::fill(), isVDPwithPALonly(), openmsx::DisplayMode::reset(), and openmsx::IntHelper< SOURCE >::reset().

Referenced by openmsx::Video9000::writeIO().

◆ getRightBorder()

int openmsx::VDP::getRightBorder ( ) const
inline

Gets the number of VDP clockticks between start of line and the start of the right border.

Definition at line 536 of file VDP.hh.

Referenced by reset(), and openmsx::PixelRenderer::updateWindow().

◆ getSpriteChecker()

SpriteChecker& openmsx::VDP::getSpriteChecker ( )
inline

Get the sprite checker for this VDP.

Definition at line 167 of file VDP.hh.

◆ getSpriteSize()

int openmsx::VDP::getSpriteSize ( ) const
inline

Gets the sprite size in pixels (8/16).

Definition at line 461 of file VDP.hh.

Referenced by openmsx::SpriteChecker::reset().

◆ getStatusReg0()

byte openmsx::VDP::getStatusReg0 ( ) const
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 553 of file VDP.hh.

Referenced by openmsx::SpriteChecker::reset().

◆ getTicksPerFrame()

int openmsx::VDP::getTicksPerFrame ( ) const
inline

Gets the number of VDP clockticks (21MHz) per frame.

Definition at line 486 of file VDP.hh.

Referenced by getAccessSlotCalculator(), reset(), and openmsx::PixelRenderer::updateWindow().

◆ getTicksThisFrame()

int openmsx::VDP::getTicksThisFrame ( EmuTime::param  time) const
inline

Gets the number of VDP clock ticks (21MHz) elapsed between a given time and the start of this frame.

Definition at line 451 of file VDP.hh.

Referenced by getAccessSlotCalculator(), peekIO(), openmsx::PixelRenderer::updateSpritesEnabled(), and openmsx::PixelRenderer::updateWindow().

◆ getTransparency()

bool openmsx::VDP::getTransparency ( ) const
inline

◆ getVerticalScroll()

byte openmsx::VDP::getVerticalScroll ( ) const
inline

Gets the current vertical scroll (line displayed at Y=0).

Returns
Vertical scroll register value.

Definition at line 269 of file VDP.hh.

Referenced by openmsx::CharacterConverter< Pixel >::convertLine(), openmsx::SpriteChecker::reset(), and openmsx::PixelRenderer::updateSpritesEnabled().

◆ getVRAM()

VDPVRAM& openmsx::VDP::getVRAM ( )
inline

Get the VRAM object for this VDP.

Definition at line 147 of file VDP.hh.

Referenced by openmsx::ADVram::ADVram().

◆ getVRMode()

bool openmsx::VDP::getVRMode ( ) const
inline

Returns current VR mode.

false -> VR=0, true -> VR=1

Definition at line 571 of file VDP.hh.

Referenced by openmsx::VDPVRAM::serialize(), and openmsx::VDPVRAM::VDPVRAM().

◆ hasYJK()

bool openmsx::VDP::hasYJK ( ) const
inline

Does this VDP support YJK display?

Returns
True for V9958, false otherwise.

Definition at line 128 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::setTransparency().

◆ isBorderMasked()

bool openmsx::VDP::isBorderMasked ( ) const
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.

Returns
true iff enabled.

Definition at line 296 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::frameEnd(), openmsx::SDLRasterizer< Pixel >::frameStart(), and openmsx::PixelRenderer::updateWindow().

◆ isDisplayEnabled()

bool openmsx::VDP::isDisplayEnabled ( ) const
inline

Is the display enabled? Both the regular border and forced blanking by clearing the display enable bit are considered disabled display.

Returns
true iff enabled.

Definition at line 237 of file VDP.hh.

Referenced by openmsx::PixelRenderer::reInit(), openmsx::SpriteChecker::reset(), and reset().

◆ isEvenOddEnabled()

bool openmsx::VDP::isEvenOddEnabled ( ) const
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.

Returns
True iff even/odd page alternation is enabled.

Definition at line 362 of file VDP.hh.

Referenced by openmsx::PixelRenderer::frameEnd(), and openmsx::PixelRenderer::frameStart().

◆ isFastBlinkEnabled()

bool openmsx::VDP::isFastBlinkEnabled ( ) const
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 testcases and links to more information.

Definition at line 347 of file VDP.hh.

Referenced by reset(), and openmsx::PixelRenderer::updateSpritesEnabled().

◆ isInsideFrame()

bool openmsx::VDP::isInsideFrame ( EmuTime::param  time) const
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.

Parameters
timeTimestamp to check.
Returns
True iff the timestamp is inside the current frame.

Definition at line 499 of file VDP.hh.

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().

◆ isInterlaced()

bool openmsx::VDP::isInterlaced ( ) const
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.

Returns
True iff interlace is enabled.

Definition at line 333 of file VDP.hh.

Referenced by openmsx::PixelRenderer::frameEnd(), openmsx::PixelRenderer::frameStart(), and openmsx::SDLRasterizer< Pixel >::frameStart().

◆ isMSX1VDP()

bool openmsx::VDP::isMSX1VDP ( ) const
inline

◆ isMultiPageScrolling()

bool openmsx::VDP::isMultiPageScrolling ( ) const
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.

Returns
true iff enabled.

Definition at line 306 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::drawDisplay(), and openmsx::PixelRenderer::updateSpritesEnabled().

◆ isPalTiming()

bool openmsx::VDP::isPalTiming ( ) const
inline

Is PAL timing active? This setting is fixed at start of frame.

Returns
True if PAL timing, false if NTSC timing.

Definition at line 322 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::frameStart().

◆ isSpriteMag()

bool openmsx::VDP::isSpriteMag ( ) const
inline

Are sprites magnified?

Definition at line 467 of file VDP.hh.

Referenced by openmsx::SpriteChecker::reset().

◆ isSuperimposing()

const RawFrame* openmsx::VDP::isSuperimposing ( ) const
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 155 of file VDP.hh.

Referenced by openmsx::SDLRasterizer< Pixel >::setBackgroundColor(), openmsx::SDLRasterizer< Pixel >::setDisplayMode(), openmsx::SDLRasterizer< Pixel >::setPalette(), and openmsx::SDLRasterizer< Pixel >::setTransparency().

◆ isVDPwithPALonly()

bool openmsx::VDP::isVDPwithPALonly ( ) const
inline

Is this a VDP only capable of PAL?

Returns
True iff this is a PAL only VDP

Definition at line 100 of file VDP.hh.

Referenced by getPostProcessor().

◆ isVDPwithVRAMremapping()

bool openmsx::VDP::isVDPwithVRAMremapping ( ) const
inline

Does this VDP have VRAM remapping when switching from 4k to 8/16k mode?

Returns
True iff this is a VDP with VRAM remapping

Definition at line 121 of file VDP.hh.

Referenced by peekIO().

◆ peekIO()

byte openmsx::VDP::peekIO ( word  port,
EmuTime::param  time 
) const
overridevirtual

◆ powerUp()

void openmsx::VDP::powerUp ( EmuTime::param  time)
overridevirtual

This method is called when MSX is powered up.

The default implementation calls reset(), this is usually ok.

Parameters
timeThe moment in time the power up occurs.

Reimplemented from openmsx::MSXDevice.

Definition at line 311 of file VDP.cc.

References reset().

Referenced by VDP().

◆ readIO()

byte openmsx::VDP::readIO ( word  port,
EmuTime::param  time 
)
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 949 of file VDP.cc.

References isInsideFrame(), isMSX1VDP(), and UNREACHABLE.

Referenced by openmsx::MSXMatsushita::readIO().

◆ reset()

void openmsx::VDP::reset ( EmuTime::param  time)
overridevirtual

◆ scheduleCmdSync()

void openmsx::VDP::scheduleCmdSync ( EmuTime  t)
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 620 of file VDP.hh.

References openmsx::MSXDevice::getScheduler(), OUTER, openmsx::Schedulable::pendingSyncPoint(), openmsx::Schedulable::removeSyncPoint(), openmsx::Schedulable, openmsx::serialize(), and openmsx::Schedulable::setSyncPoint().

◆ serialize()

template<typename Archive >
void openmsx::VDP::serialize ( Archive &  ar,
unsigned  version 
)

◆ setExternalVideoSource()

void openmsx::VDP::setExternalVideoSource ( const RawFrame externalSource)
inline

Enable superimposing.

Definition at line 577 of file VDP.hh.

Referenced by openmsx::PioneerLDControl::videoIn().

◆ setSpriteStatus()

void openmsx::VDP::setSpriteStatus ( byte  value)
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 563 of file VDP.hh.

Referenced by openmsx::SpriteChecker::reset().

◆ spritesEnabled()

bool openmsx::VDP::spritesEnabled ( ) const
inline

Are sprites enabled?

Returns
True iff blanking is off, the current mode supports sprites and sprites are not disabled.

Definition at line 245 of file VDP.hh.

Referenced by openmsx::PixelRenderer::updateWindow().

◆ spritesEnabledFast()

bool openmsx::VDP::spritesEnabledFast ( ) const
inline

Same as spritesEnabled(), but may only be called in sprite mode 1 or 2.

Is a tiny bit faster.

Definition at line 254 of file VDP.hh.

Referenced by openmsx::SpriteChecker::reset().

◆ spritesEnabledRegister()

bool openmsx::VDP::spritesEnabledRegister ( ) const
inline

Still faster variant (just looks at the sprite-enabled-bit).

But only valid in sprite mode 1/2 with screen enabled.

Definition at line 262 of file VDP.hh.

◆ vdpHasPatColMirroring()

bool openmsx::VDP::vdpHasPatColMirroring ( ) const
inline

Is this a VDP that has pattern/colortable mirroring?

Returns
True iff this VDP has pattern/colortable mirroring

Definition at line 114 of file VDP.hh.

Referenced by peekIO().

◆ vdpLacksMirroring()

bool openmsx::VDP::vdpLacksMirroring ( ) const
inline

Is this a VDP that lacks mirroring?

Returns
True iff this VDP lacks the screen 2 mirrored mode

Definition at line 107 of file VDP.hh.

Referenced by peekIO().

◆ writeIO()

void openmsx::VDP::writeIO ( word  port,
byte  value,
EmuTime::param  time 
)
overridevirtual

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 637 of file VDP.cc.

References isInsideFrame(), isMSX1VDP(), and openmsx::MSXCPU::waitCyclesZ80().

Referenced by openmsx::MSXMatsushita::writeIO().

Member Data Documentation

◆ TICKS_PER_LINE

constexpr int openmsx::VDP::TICKS_PER_LINE = 1368
static

◆ TICKS_PER_SECOND

constexpr int openmsx::VDP::TICKS_PER_SECOND = 3579545 * 6
static

Number of VDP clock ticks per second.

Definition at line 67 of file VDP.hh.


The documentation for this class was generated from the following files: