openMSX
Public Member Functions | Protected Member Functions | List of all members
openmsx::CPUClock Class Reference

#include <CPUClock.hh>

Inheritance diagram for openmsx::CPUClock:
Inheritance graph
[legend]

Public Member Functions

unsigned getFreq () const
 

Protected Member Functions

 CPUClock (EmuTime::param time, Scheduler &scheduler)
 
void add (unsigned ticks)
 
void sync () const
 
EmuTime::param getTime () const
 
EmuTime getTimeFast () const
 
EmuTime getTimeFast (int cc) const
 
void setTime (EmuTime::param time)
 
void setFreq (unsigned freq)
 
void advanceTime (EmuTime::param time)
 
EmuTime calcTime (EmuTime::param time, unsigned ticks) const
 
unsigned advanceHalt (unsigned hltStates, EmuTime::param time)
 Implementation of the HALT instruction timing.
 
void waitForEvenCycle (int cc)
 R800 runs at 7MHz, but I/O is done over a slower 3.5MHz bus.
 
void setLimit (EmuTime::param time)
 
void enableLimit ()
 
void disableLimit ()
 
bool limitReached () const
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 

Detailed Description

Definition at line 11 of file CPUClock.hh.

Constructor & Destructor Documentation

◆ CPUClock()

openmsx::CPUClock::CPUClock ( EmuTime::param  time,
Scheduler scheduler 
)
protected

Definition at line 6 of file CPUClock.cc.

Member Function Documentation

◆ add()

void openmsx::CPUClock::add ( unsigned  ticks)
inlineprotected

◆ advanceHalt()

unsigned openmsx::CPUClock::advanceHalt ( unsigned  hltStates,
EmuTime::param  time 
)
inlineprotected

Implementation of the HALT instruction timing.

Advances the clock with an integer multiple of 'hltStates' cycles so that it equal or bigger than 'time'. Returns the number of times 'hltStates' needed to be added.

Definition at line 53 of file CPUClock.hh.

References openmsx::DynamicClock::getTicksTillUp(), and sync().

◆ advanceTime()

void openmsx::CPUClock::advanceTime ( EmuTime::param  time)
protected

◆ calcTime()

EmuTime openmsx::CPUClock::calcTime ( EmuTime::param  time,
unsigned  ticks 
) const
inlineprotected

Definition at line 44 of file CPUClock.hh.

References openmsx::DynamicClock::add().

◆ disableLimit()

void openmsx::CPUClock::disableLimit ( )
inlineprotected

Definition at line 107 of file CPUClock.hh.

◆ enableLimit()

void openmsx::CPUClock::enableLimit ( )
inlineprotected

Definition at line 103 of file CPUClock.hh.

References openmsx::Scheduler::getNext(), and setLimit().

◆ getFreq()

unsigned openmsx::CPUClock::getFreq ( ) const
inline

Definition at line 14 of file CPUClock.hh.

References openmsx::DynamicClock::getFreq().

◆ getTime()

EmuTime::param openmsx::CPUClock::getTime ( ) const
inlineprotected

Definition at line 36 of file CPUClock.hh.

References openmsx::DynamicClock::getTime(), and sync().

◆ getTimeFast() [1/2]

EmuTime openmsx::CPUClock::getTimeFast ( ) const
inlineprotected

Definition at line 37 of file CPUClock.hh.

References openmsx::DynamicClock::getFastAdd().

Referenced by openmsx::R800TYPE::R800Refresh().

◆ getTimeFast() [2/2]

EmuTime openmsx::CPUClock::getTimeFast ( int  cc) const
inlineprotected

Definition at line 38 of file CPUClock.hh.

References openmsx::DynamicClock::getFastAdd().

◆ limitReached()

bool openmsx::CPUClock::limitReached ( ) const
inlineprotected

Definition at line 113 of file CPUClock.hh.

◆ serialize()

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

Definition at line 20 of file CPUClock.cc.

References sync().

Referenced by openmsx::R800TYPE::serialize(), and openmsx::Z80TYPE::serialize().

◆ setFreq()

void openmsx::CPUClock::setFreq ( unsigned  freq)
inlineprotected

Definition at line 42 of file CPUClock.hh.

References openmsx::DynamicClock::setFreq().

◆ setLimit()

void openmsx::CPUClock::setLimit ( EmuTime::param  time)
inlineprotected

Definition at line 93 of file CPUClock.hh.

References openmsx::DynamicClock::getTicksTillUp(), and sync().

Referenced by advanceTime(), and enableLimit().

◆ setTime()

void openmsx::CPUClock::setTime ( EmuTime::param  time)
inlineprotected

Definition at line 41 of file CPUClock.hh.

References openmsx::DynamicClock::reset(), and sync().

Referenced by openmsx::R800TYPE::setTime().

◆ sync()

void openmsx::CPUClock::sync ( ) const
inlineprotected

◆ waitForEvenCycle()

void openmsx::CPUClock::waitForEvenCycle ( int  cc)
inlineprotected

R800 runs at 7MHz, but I/O is done over a slower 3.5MHz bus.

So sometimes right before I/O it's needed to wait for one cycle so that we're at the start of a clock cycle of the slower bus.

Definition at line 65 of file CPUClock.hh.

References add(), openmsx::DynamicClock::getTotalTicks(), and sync().

Referenced by openmsx::R800TYPE::R800RefreshSlow().


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