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
 
const EmuTime getTimeFast () const
 
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. More...
 
void waitForEvenCycle (int cc)
 R800 runs at 7MHz, but I/O is done over a slower 3.5MHz bus. More...
 
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.

Referenced by getFreq().

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

Definition at line 13 of file CPUClock.cc.

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

Referenced by setFreq().

◆ 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 add(), CPUClock(), openmsx::DynamicClock::getFreq(), and sync().

◆ 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]

const 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]

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

References serialize().

◆ serialize()

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

Definition at line 21 of file CPUClock.cc.

References sync().

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

◆ setFreq()

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

Definition at line 42 of file CPUClock.hh.

References advanceTime(), and 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: