openMSX
Public Member Functions | Static Public Attributes | List of all members
openmsx::VDPCmdEngine Class Reference

VDP command engine by Alex Wulms. More...

#include <VDPCmdEngine.hh>

Public Member Functions

 VDPCmdEngine (VDP &vdp, CommandController &commandController)
 
void reset (EmuTime::param time)
 Reinitialize Renderer state.
 
void sync (EmuTime::param time)
 Synchronizes the command engine with the VDP.
 
void sync2 (EmuTime::param time)
 
void stealAccessSlot (EmuTime::param time)
 Steal a VRAM access slot from the CmdEngine.
 
byte getStatus (EmuTime::param time)
 Gets the command engine status (part of S#2).
 
byte readColor (EmuTime::param time)
 Use this method to transfer pixel(s) from VDP to CPU.
 
void resetColor ()
 
unsigned getBorderX (EmuTime::param time)
 Gets the X coordinate of a border detected by SRCH (intended behaviour, as documented in the V9938 technical data book).
 
void setCmdReg (byte index, byte value, EmuTime::param time)
 Writes to a command register.
 
byte peekCmdReg (byte index) const
 Read the content of a command register.
 
void updateDisplayMode (DisplayMode mode, bool cmdBit, EmuTime::param time)
 Informs the command engine of a VDP display mode change.
 
bool commandInProgress (EmuTime::param time)
 
auto getLastCommand () const
 Get the register-values for the last executed (or still in progress) command.
 
auto getInprogressPosition () const
 Get the (source and destination) X/Y coordinates of the currently executing command.
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 Interface for logical operations.
 

Static Public Attributes

static constexpr byte MXD = 0x20
 
static constexpr byte MXS = 0x10
 
static constexpr byte DIY = 0x08
 
static constexpr byte DIX = 0x04
 
static constexpr byte EQ = 0x02
 
static constexpr byte MAJ = 0x01
 

Detailed Description

VDP command engine by Alex Wulms.

Implements command execution unit of V9938/58.

Definition at line 23 of file VDPCmdEngine.hh.

Constructor & Destructor Documentation

◆ VDPCmdEngine()

openmsx::VDPCmdEngine::VDPCmdEngine ( VDP vdp,
CommandController commandController 
)

Definition at line 1762 of file VDPCmdEngine.cc.

Member Function Documentation

◆ commandInProgress()

bool openmsx::VDPCmdEngine::commandInProgress ( EmuTime::param  time)
inline

Definition at line 129 of file VDPCmdEngine.hh.

References sync().

◆ getBorderX()

unsigned openmsx::VDPCmdEngine::getBorderX ( EmuTime::param  time)
inline

Gets the X coordinate of a border detected by SRCH (intended behaviour, as documented in the V9938 technical data book).

However, real VDP simply returns the current value of the ASX 'temporary source X' counter, regardless of the command that is being executed or was executed most recently

Parameters
timeThe moment in emulated time this get occurs.

Definition at line 101 of file VDPCmdEngine.hh.

References sync().

◆ getInprogressPosition()

auto openmsx::VDPCmdEngine::getInprogressPosition ( ) const
inline

Get the (source and destination) X/Y coordinates of the currently executing command.

For debugging purposes only.

Definition at line 144 of file VDPCmdEngine.hh.

◆ getLastCommand()

auto openmsx::VDPCmdEngine::getLastCommand ( ) const
inline

Get the register-values for the last executed (or still in progress) command.

For debugging purposes only.

Definition at line 136 of file VDPCmdEngine.hh.

◆ getStatus()

byte openmsx::VDPCmdEngine::getStatus ( EmuTime::param  time)
inline

Gets the command engine status (part of S#2).

Bit 7 (TR) is set when the command engine is ready for a pixel transfer. Bit 4 (BD) is set when the boundary color is detected. Bit 0 (CE) is set when a command is in progress.

Definition at line 70 of file VDPCmdEngine.hh.

References sync().

◆ peekCmdReg()

byte openmsx::VDPCmdEngine::peekCmdReg ( byte  index) const

Read the content of a command register.

This method is meant to be used by the debugger, there is no strict guarantee that the returned value is the correct value at exactly this moment in time (IOW this method does not sync the complete CmdEngine)

Parameters
indexThe register [0..14] to read from.

Definition at line 1864 of file VDPCmdEngine.cc.

References UNREACHABLE.

◆ readColor()

byte openmsx::VDPCmdEngine::readColor ( EmuTime::param  time)
inline

Use this method to transfer pixel(s) from VDP to CPU.

This method implements V9938 S#7.

Parameters
timeThe moment in emulated time this read occurs.
Returns
Color value of the pixel.

Definition at line 82 of file VDPCmdEngine.hh.

References sync().

◆ reset()

void openmsx::VDPCmdEngine::reset ( EmuTime::param  time)

Reinitialize Renderer state.

Parameters
timeThe moment in time the reset occurs.

Definition at line 1785 of file VDPCmdEngine.cc.

References openmsx::VDP::getCmdBit(), openmsx::VDP::getDisplayMode(), setCmdReg(), and updateDisplayMode().

◆ resetColor()

void openmsx::VDPCmdEngine::resetColor ( )
inline

Definition at line 86 of file VDPCmdEngine.hh.

◆ serialize()

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

Interface for logical operations.

Definition at line 2617 of file VDPCmdEngine.cc.

References openmsx::Clock< FREQ_NUM, FREQ_DENOM >::getTime().

◆ setCmdReg()

void openmsx::VDPCmdEngine::setCmdReg ( byte  index,
byte  value,
EmuTime::param  time 
)

Writes to a command register.

Parameters
indexThe register [0..14] to write to.
valueThe new value for the specified register.
timeThe moment in emulated time this write occurs.

Definition at line 1796 of file VDPCmdEngine.cc.

References openmsx::TclCallback::execute(), sync(), and UNREACHABLE.

Referenced by reset().

◆ stealAccessSlot()

void openmsx::VDPCmdEngine::stealAccessSlot ( EmuTime::param  time)
inline

Steal a VRAM access slot from the CmdEngine.

Used when the CPU reads/writes VRAM.

Parameters
timeThe moment in time the CPU read/write is performed.

Definition at line 56 of file VDPCmdEngine.hh.

References openmsx::VDPAccessSlots::D1.

Referenced by openmsx::VDPVRAM::cpuRead(), and openmsx::VDPVRAM::cpuWrite().

◆ sync()

void openmsx::VDPCmdEngine::sync ( EmuTime::param  time)
inline

Synchronizes the command engine with the VDP.

Ideally this would be a private method, but the current design doesn't allow that.

Parameters
timeThe moment in emulated time to sync to.

Definition at line 47 of file VDPCmdEngine.hh.

References sync2().

Referenced by commandInProgress(), openmsx::VDPVRAM::cpuRead(), openmsx::VDPVRAM::cpuWrite(), getBorderX(), getStatus(), readColor(), setCmdReg(), openmsx::VDPVRAM::sync(), openmsx::VDPVRAM::updateDisplayEnabled(), updateDisplayMode(), and openmsx::VDPVRAM::updateSpritesEnabled().

◆ sync2()

void openmsx::VDPCmdEngine::sync2 ( EmuTime::param  time)

Definition at line 2018 of file VDPCmdEngine.cc.

References UNREACHABLE.

Referenced by sync().

◆ updateDisplayMode()

void openmsx::VDPCmdEngine::updateDisplayMode ( DisplayMode  mode,
bool  cmdBit,
EmuTime::param  time 
)

Informs the command engine of a VDP display mode change.

Parameters
modeThe new display mode.
cmdBitAre VDP commands allowed in non-bitmap mode.
timeThe moment in emulated time this change occurs.

Definition at line 1889 of file VDPCmdEngine.cc.

References openmsx::DisplayMode::getBase(), openmsx::DisplayMode::GRAPHIC4, openmsx::DisplayMode::GRAPHIC5, openmsx::DisplayMode::GRAPHIC6, openmsx::DisplayMode::GRAPHIC7, and sync().

Referenced by reset(), and openmsx::VDPVRAM::updateDisplayMode().

Member Data Documentation

◆ DIX

constexpr byte openmsx::VDPCmdEngine::DIX = 0x04
staticconstexpr

Definition at line 30 of file VDPCmdEngine.hh.

Referenced by openmsx::ImGuiBitmapViewer::paint().

◆ DIY

constexpr byte openmsx::VDPCmdEngine::DIY = 0x08
staticconstexpr

Definition at line 29 of file VDPCmdEngine.hh.

Referenced by openmsx::ImGuiBitmapViewer::paint().

◆ EQ

constexpr byte openmsx::VDPCmdEngine::EQ = 0x02
staticconstexpr

Definition at line 31 of file VDPCmdEngine.hh.

Referenced by openmsx::ImGuiBitmapViewer::paint().

◆ MAJ

constexpr byte openmsx::VDPCmdEngine::MAJ = 0x01
staticconstexpr

Definition at line 32 of file VDPCmdEngine.hh.

Referenced by openmsx::ImGuiBitmapViewer::paint().

◆ MXD

constexpr byte openmsx::VDPCmdEngine::MXD = 0x20
staticconstexpr

Definition at line 27 of file VDPCmdEngine.hh.

◆ MXS

constexpr byte openmsx::VDPCmdEngine::MXS = 0x10
staticconstexpr

Definition at line 28 of file VDPCmdEngine.hh.


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