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.
 
 ~V9990CmdEngine ()
 
void reset (EmuTime::param time)
 Re-initialise the command engine's state.
 
void sync (EmuTime::param time)
 Synchronizes the command engine with the V9990.
 
void sync2 (EmuTime::param time)
 
void setCmdReg (byte reg, byte val, EmuTime::param time)
 Set a value to one of the command registers.
 
void setCmdData (byte value, EmuTime::param time)
 set the data byte
 
byte getCmdData (EmuTime::param time)
 read the command data byte
 
byte peekCmdData (EmuTime::param time) const
 read the command data byte (without side-effects)
 
byte getStatus (EmuTime::param time) const
 Get command engine related status bits.
 
word getBorderX (EmuTime::param time) const
 
EmuTime estimateCmdEnd () const
 Calculate an (under-)estimation for when the command will finish.
 
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 19 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 1787 of file V9990CmdEngine.cc.

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

◆ getBorderX()

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

Definition at line 71 of file V9990CmdEngine.hh.

References sync().

◆ getBrokenTiming()

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

Definition at line 91 of file V9990CmdEngine.hh.

◆ getCmdData()

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

read the command data byte

Definition at line 1758 of file V9990CmdEngine.cc.

References sync(), and TR.

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

◆ getStatus()

byte openmsx::V9990CmdEngine::getStatus ( EmuTime::param  time) const
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 65 of file V9990CmdEngine.hh.

References sync().

Referenced by openmsx::V9990::peekIO().

◆ getVDP()

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

Definition at line 90 of file V9990CmdEngine.hh.

◆ peekCmdData()

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

read the command data byte (without side-effects)

Definition at line 1774 of file V9990CmdEngine.cc.

References sync(), and TR.

Referenced by openmsx::V9990::peekIO().

◆ 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 728 of file V9990CmdEngine.cc.

Referenced by openmsx::V9990::reset(), and V9990CmdEngine().

◆ serialize()

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

Definition at line 1856 of file V9990CmdEngine.cc.

References openmsx::EmuDuration::serialize().

◆ setCmdData()

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

set the data byte

Definition at line 1751 of file V9990CmdEngine.cc.

References sync().

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

◆ setCmdReg()

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

Set a value to one of the command registers.

Definition at line 736 of file V9990CmdEngine.cc.

References CE, sync(), and UNREACHABLE.

◆ sync()

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

Synchronizes the command engine with the V9990.

Parameters
timeThe moment in emulated time to sync to.

Definition at line 39 of file V9990CmdEngine.hh.

References sync2().

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

◆ sync2()

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

Definition at line 1648 of file V9990CmdEngine.cc.

References UNREACHABLE.

Referenced by sync().

Member Data Documentation

◆ BD

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

Definition at line 24 of file V9990CmdEngine.hh.

◆ CE

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

Definition at line 25 of file V9990CmdEngine.hh.

Referenced by setCmdReg().

◆ TR

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

Definition at line 23 of file V9990CmdEngine.hh.

Referenced by getCmdData(), and peekCmdData().


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