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

Command engine. More...

#include <V9990CmdEngine.hh>

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

Public Member Functions

 V9990CmdEngine (V9990 &vdp, EmuTime::param time, RenderSettings &settings)
 Constructor. More...
 
 ~V9990CmdEngine ()
 
void reset (EmuTime::param time)
 Re-initialise the command engine's state. More...
 
void sync (EmuTime::param time)
 Synchronises the command engine with the V9990. More...
 
void sync2 (EmuTime::param time)
 
void setCmdReg (byte reg, byte val, EmuTime::param time)
 Set a value to one of the command registers. More...
 
void setCmdData (byte value, EmuTime::param time)
 set the data byte More...
 
byte getCmdData (EmuTime::param time)
 read the command data byte More...
 
byte peekCmdData (EmuTime::param time)
 read the command data byte (without side-effects) More...
 
byte getStatus (EmuTime::param time)
 Get command engine related status bits. More...
 
word getBorderX (EmuTime::param time)
 
EmuTime estimateCmdEnd () const
 Calculate an (under-)estimation for when the command will finish. More...
 
const V9990getVDP () const
 
bool getBrokenTiming () const
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 

Static Public Attributes

static constexpr byte TR = 0x80
 
static constexpr byte BD = 0x10
 
static constexpr byte CE = 0x01
 

Detailed Description

Command engine.

Definition at line 20 of file V9990CmdEngine.hh.

Constructor & Destructor Documentation

◆ V9990CmdEngine()

openmsx::V9990CmdEngine::V9990CmdEngine ( V9990 vdp,
EmuTime::param  time,
RenderSettings settings 
)

◆ ~V9990CmdEngine()

openmsx::V9990CmdEngine::~V9990CmdEngine ( )

Member Function Documentation

◆ estimateCmdEnd()

EmuTime openmsx::V9990CmdEngine::estimateCmdEnd ( ) const

Calculate an (under-)estimation for when the command will finish.

The main purpose of this function is to insert extra sync points so that the Command-End (CE) interrupt properly synchronizes with CPU emulation. This estimation:

  • Is the current time (engineTime) when no command is executing or the command doesn't require extra syncs.
  • Is allowed to be an underestimation, on the condition that (when that point in time is reached) the new estimation is more accurate and converges to the actual end time.

Definition at line 1773 of file V9990CmdEngine.cc.

References UNREACHABLE, and openmsx::EmuDuration::zero().

Referenced by getBorderX().

◆ getBorderX()

word openmsx::V9990CmdEngine::getBorderX ( EmuTime::param  time)
inline

Definition at line 72 of file V9990CmdEngine.hh.

References estimateCmdEnd(), and sync().

◆ getBrokenTiming()

bool openmsx::V9990CmdEngine::getBrokenTiming ( ) const
inline

◆ getCmdData()

byte openmsx::V9990CmdEngine::getCmdData ( EmuTime::param  time)

read the command data byte

Definition at line 1744 of file V9990CmdEngine.cc.

References sync(), and TR.

Referenced by sync().

◆ getStatus()

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

Get command engine related status bits.

  • TR command data transfer ready (bit 7)
  • BD border color detect (bit 4)
  • CE command being executed (bit 0)

Definition at line 66 of file V9990CmdEngine.hh.

References sync().

◆ getVDP()

const V9990& openmsx::V9990CmdEngine::getVDP ( ) const
inline

Definition at line 91 of file V9990CmdEngine.hh.

◆ peekCmdData()

byte openmsx::V9990CmdEngine::peekCmdData ( EmuTime::param  time)

read the command data byte (without side-effects)

Definition at line 1760 of file V9990CmdEngine.cc.

References CE, openmsx::V9990::cmdReady(), sync(), and TR.

Referenced by sync().

◆ reset()

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

Re-initialise the command engine's state.

Parameters
timeMoment in emulated time the reset occurs

Definition at line 719 of file V9990CmdEngine.cc.

Referenced by V9990CmdEngine().

◆ serialize()

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

Definition at line 1842 of file V9990CmdEngine.cc.

Referenced by getBrokenTiming().

◆ setCmdData()

void openmsx::V9990CmdEngine::setCmdData ( byte  value,
EmuTime::param  time 
)

set the data byte

Definition at line 1737 of file V9990CmdEngine.cc.

References sync(), and TR.

Referenced by sync().

◆ setCmdReg()

void openmsx::V9990CmdEngine::setCmdReg ( byte  reg,
byte  val,
EmuTime::param  time 
)

◆ sync()

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

Synchronises the command engine with the V9990.

Parameters
timeThe moment in emulated time to sync to.

Definition at line 40 of file V9990CmdEngine.hh.

References getCmdData(), peekCmdData(), setCmdData(), setCmdReg(), and sync2().

Referenced by getBorderX(), getCmdData(), getStatus(), peekCmdData(), setCmdData(), setCmdReg(), and openmsx::V9990VRAM::sync().

◆ sync2()

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

Definition at line 1634 of file V9990CmdEngine.cc.

References UNREACHABLE.

Referenced by sync().

Member Data Documentation

◆ BD

constexpr byte openmsx::V9990CmdEngine::BD = 0x10
static

◆ CE

constexpr byte openmsx::V9990CmdEngine::CE = 0x01
static

Definition at line 26 of file V9990CmdEngine.hh.

Referenced by peekCmdData(), and setCmdReg().

◆ TR

constexpr byte openmsx::V9990CmdEngine::TR = 0x80
static

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