openMSX
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
openmsx::CPU Class Referenceabstract

#include <CPU.hh>

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

Classes

class  CPURegs
 

Public Types

enum  Reg8 {
  A, F, B, C,
  D, E, H, L,
  IXH, IXL, IYH, IYL,
  REG_I, REG_R, DUMMY
}
 
enum  Reg16 {
  AF, BC, DE, HL,
  IX, IY, SP
}
 

Public Member Functions

virtual void execute (bool fastForward)=0
 TODO. More...
 
virtual void exitCPULoopSync ()=0
 Request to exit the main CPU emulation loop. More...
 
virtual void exitCPULoopAsync ()=0
 Similar to exitCPULoopSync(), but this method may be called from any thread. More...
 
virtual void warp (EmuTime::param time)=0
 Sets the CPU its current time. More...
 
virtual EmuTime::param getCurrentTime () const =0
 Returns the CPU its current time. More...
 
virtual void wait (EmuTime::param time)=0
 Wait till an absolute moment in time (fast forward). More...
 
virtual void waitCycles (unsigned cycles)=0
 Wait for a number of cycles. More...
 
virtual void setNextSyncPoint (EmuTime::param time)=0
 Inform CPU of new (possibly earlier) sync point. More...
 
virtual void invalidateMemCache (unsigned start, unsigned num)=0
 Invalidate the CPU its cache for the interval [start, start + num * CacheLine::SIZE). More...
 
virtual bool isM1Cycle (unsigned address) const =0
 See MSXCPU::isM1Cycle(). More...
 
virtual void disasmCommand (const std::vector< TclObject > &tokens, TclObject &result) const =0
 
CPURegsgetRegisters ()
 
void setPaused (bool paused)
 (un)pause CPU. More...
 

Static Public Attributes

static const byte S_FLAG = 0x80
 
static const byte Z_FLAG = 0x40
 
static const byte Y_FLAG = 0x20
 
static const byte H_FLAG = 0x10
 
static const byte X_FLAG = 0x08
 
static const byte V_FLAG = 0x04
 
static const byte P_FLAG = V_FLAG
 
static const byte N_FLAG = 0x02
 
static const byte C_FLAG = 0x01
 

Protected Member Functions

 CPU (bool r800)
 
virtual ~CPU ()
 

Protected Attributes

CPURegs R
 

Static Protected Attributes

static byte ZSTable [256]
 
static byte ZSXYTable [256]
 
static byte ZSPTable [256]
 
static byte ZSPXYTable [256]
 
static byte ZSPHTable [256]
 
static const byte ZS0 = Z_FLAG
 
static const byte ZSXY0 = Z_FLAG
 
static const byte ZSP0 = Z_FLAG | V_FLAG
 
static const byte ZSPXY0 = Z_FLAG | V_FLAG
 
static const byte ZS255 = S_FLAG
 
static const byte ZSXY255 = S_FLAG | X_FLAG | Y_FLAG
 

Additional Inherited Members

Detailed Description

Definition at line 26 of file CPU.hh.

Member Enumeration Documentation

Enumerator
AF 
BC 
DE 
HL 
IX 
IY 
SP 

Definition at line 149 of file CPU.hh.

Enumerator
A 
F 
B 
C 
D 
E 
H 
L 
IXH 
IXL 
IYH 
IYL 
REG_I 
REG_R 
DUMMY 

Definition at line 148 of file CPU.hh.

Constructor & Destructor Documentation

openmsx::CPU::CPU ( bool  r800)
protected

Definition at line 13 of file CPU.cc.

References H_FLAG, S_FLAG, V_FLAG, X_FLAG, Y_FLAG, Z_FLAG, ZS0, ZS255, ZSP0, ZSPHTable, ZSPTable, ZSPXY0, ZSPXYTable, ZSTable, ZSXY0, ZSXY255, and ZSXYTable.

openmsx::CPU::~CPU ( )
protectedvirtual

Definition at line 44 of file CPU.cc.

Member Function Documentation

virtual void openmsx::CPU::disasmCommand ( const std::vector< TclObject > &  tokens,
TclObject result 
) const
pure virtual
virtual void openmsx::CPU::execute ( bool  fastForward)
pure virtual
virtual void openmsx::CPU::exitCPULoopAsync ( )
pure virtual

Similar to exitCPULoopSync(), but this method may be called from any thread.

Although now the loop will only be exited 'soon'.

Implemented in openmsx::CPUCore< CPU_POLICY >, openmsx::CPUCore< openmsx::R800TYPE >, and openmsx::CPUCore< openmsx::Z80TYPE >.

Referenced by openmsx::MSXCPU::exitCPULoopAsync().

virtual void openmsx::CPU::exitCPULoopSync ( )
pure virtual

Request to exit the main CPU emulation loop.

This method may only be called from the main thread. The CPU loop will immediately be exited (current instruction will be finished, but no new instruction will be executed).

Implemented in openmsx::CPUCore< CPU_POLICY >, openmsx::CPUCore< openmsx::R800TYPE >, and openmsx::CPUCore< openmsx::Z80TYPE >.

Referenced by openmsx::MSXCPU::exitCPULoopSync(), and setPaused().

virtual EmuTime::param openmsx::CPU::getCurrentTime ( ) const
pure virtual
CPURegs& openmsx::CPU::getRegisters ( )
inline

Definition at line 441 of file CPU.hh.

References R.

Referenced by openmsx::MSXCPUDebuggable::read(), setPaused(), and openmsx::MSXCPUDebuggable::write().

virtual void openmsx::CPU::invalidateMemCache ( unsigned  start,
unsigned  num 
)
pure virtual

Invalidate the CPU its cache for the interval [start, start + num * CacheLine::SIZE).

Implemented in openmsx::CPUCore< CPU_POLICY >, openmsx::CPUCore< openmsx::R800TYPE >, and openmsx::CPUCore< openmsx::Z80TYPE >.

Referenced by openmsx::MSXCPU::invalidateMemCache().

virtual bool openmsx::CPU::isM1Cycle ( unsigned  address) const
pure virtual
virtual void openmsx::CPU::setNextSyncPoint ( EmuTime::param  time)
pure virtual
void openmsx::CPU::setPaused ( bool  paused)

(un)pause CPU.

During pause the CPU executes NOP instructions continuously (just like during HALT). Used by turbor hw pause.

Definition at line 48 of file CPU.cc.

References exitCPULoopSync(), getRegisters(), and openmsx::CPU::CPURegs::setExtHALT().

Referenced by openmsx::MSXCPU::setPaused().

virtual void openmsx::CPU::wait ( EmuTime::param  time)
pure virtual

Wait till an absolute moment in time (fast forward).

Synchronsization points between the current time and the specified time do get executed.

Implemented in openmsx::CPUCore< CPU_POLICY >, openmsx::CPUCore< openmsx::R800TYPE >, and openmsx::CPUCore< openmsx::Z80TYPE >.

Referenced by openmsx::MSXCPU::wait().

virtual void openmsx::CPU::waitCycles ( unsigned  cycles)
pure virtual

Wait for a number of cycles.

Can be used to insert an extra delay when accessing specific IO devices.

Implemented in openmsx::CPUCore< CPU_POLICY >, openmsx::CPUCore< openmsx::R800TYPE >, and openmsx::CPUCore< openmsx::Z80TYPE >.

Referenced by openmsx::MSXCPU::waitCycles().

virtual void openmsx::CPU::warp ( EmuTime::param  time)
pure virtual

Sets the CPU its current time.

This is used to 'warp' a CPU when you switch between Z80/R800.

Implemented in openmsx::CPUCore< CPU_POLICY >, openmsx::CPUCore< openmsx::R800TYPE >, and openmsx::CPUCore< openmsx::Z80TYPE >.

Member Data Documentation

const byte openmsx::CPU::C_FLAG = 0x01
static

Definition at line 38 of file CPU.hh.

Referenced by openmsx::CondC::operator()(), and openmsx::CondNC::operator()().

const byte openmsx::CPU::H_FLAG = 0x10
static

Definition at line 33 of file CPU.hh.

Referenced by CPU().

const byte openmsx::CPU::N_FLAG = 0x02
static

Definition at line 37 of file CPU.hh.

const byte openmsx::CPU::P_FLAG = V_FLAG
static

Definition at line 36 of file CPU.hh.

CPURegs openmsx::CPU::R
protected

Definition at line 466 of file CPU.hh.

Referenced by getRegisters().

const byte openmsx::CPU::S_FLAG = 0x80
static

Definition at line 30 of file CPU.hh.

Referenced by CPU(), openmsx::CondM::operator()(), and openmsx::CondP::operator()().

const byte openmsx::CPU::V_FLAG = 0x04
static

Definition at line 35 of file CPU.hh.

Referenced by CPU(), openmsx::CondPE::operator()(), and openmsx::CondPO::operator()().

const byte openmsx::CPU::X_FLAG = 0x08
static

Definition at line 34 of file CPU.hh.

Referenced by CPU().

const byte openmsx::CPU::Y_FLAG = 0x20
static

Definition at line 32 of file CPU.hh.

Referenced by CPU().

const byte openmsx::CPU::Z_FLAG = 0x40
static

Definition at line 31 of file CPU.hh.

Referenced by CPU(), openmsx::CondZ::operator()(), and openmsx::CondNZ::operator()().

const byte openmsx::CPU::ZS0 = Z_FLAG
staticprotected

Definition at line 459 of file CPU.hh.

Referenced by CPU().

const byte openmsx::CPU::ZS255 = S_FLAG
staticprotected

Definition at line 463 of file CPU.hh.

Referenced by CPU().

const byte openmsx::CPU::ZSP0 = Z_FLAG | V_FLAG
staticprotected

Definition at line 461 of file CPU.hh.

Referenced by CPU().

byte openmsx::CPU::ZSPHTable
staticprotected

Definition at line 458 of file CPU.hh.

Referenced by CPU().

byte openmsx::CPU::ZSPTable
staticprotected

Definition at line 456 of file CPU.hh.

Referenced by CPU().

const byte openmsx::CPU::ZSPXY0 = Z_FLAG | V_FLAG
staticprotected

Definition at line 462 of file CPU.hh.

Referenced by CPU().

byte openmsx::CPU::ZSPXYTable
staticprotected

Definition at line 457 of file CPU.hh.

Referenced by CPU().

byte openmsx::CPU::ZSTable
staticprotected

Definition at line 454 of file CPU.hh.

Referenced by CPU().

const byte openmsx::CPU::ZSXY0 = Z_FLAG
staticprotected

Definition at line 460 of file CPU.hh.

Referenced by CPU().

const byte openmsx::CPU::ZSXY255 = S_FLAG | X_FLAG | Y_FLAG
staticprotected

Definition at line 464 of file CPU.hh.

Referenced by CPU().

byte openmsx::CPU::ZSXYTable
staticprotected

Definition at line 455 of file CPU.hh.

Referenced by CPU().


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