Home :: PacmanEmulator :: Z80 | classes |
class Z80 | ? ^ |
Z80 software emulator.
- Source:
- z80.h:104
- Author:
- Alessandro Scotti
- Version:
- 1.1
Contents | ^ |
Entity Type Scope Short Description ~Z80 destructor public Destructor. Z80 constructor public Copy constructor: creates a copy of the specified Z80 object. Z80 constructor public Constructor: creates a Z80 object with the specified environment. $anonymous$ enum public CPU flags A attribute public A register (accumulator) A1 attribute public Alternate A register (A') AF method public Returns the 16 bit register AF. B attribute public B register B1 attribute public Alternate B register (B') BC method public Returns the 16 bit register BC. C attribute public C register C1 attribute public Alternate C register (C') D attribute public D register D1 attribute public Alternate D register (D') DE method public Returns the 16 bit register DE. E attribute public E register E1 attribute public Alternate E register (E') F attribute public Flags register F1 attribute public Alternate flags register (F') getCycles method public Returns the number of Z80 CPU cycles elapsed so far. getInterruptMode method public Returns the current interrupt mode. getSizeOfSnapshotBuffer method public Returns the size of the buffer needed to take a snapshot of the CPU. H attribute public H register H1 attribute public Alternate H register (H') HL method public Returns the 16 bit register HL. I attribute public Interrupt register interrupt method public Invokes an interrupt. isHalted method public Returns non-zero if the CPU is halted, otherwise zero. IX attribute public Index register X IY attribute public Index register Y L attribute public L register L1 attribute public Alternate L register (L') nmi method public Forces a non-maskable interrupt. operator = operator public Copies CPU register from one object to another. PC attribute public Program counter R attribute public Refresh register reset method public Resets the CPU to its initial state. restoreSnapshot method public Restores a snapshot taken with takeSnapshot(). run method public Runs the CPU for the specified number of cycles. setCycles method public Sets the CPU cycle counter to the specified value. setInterruptMode method public Sets the interrupt mode to the specified value. SP attribute public Stack pointer step method public Executes one instruction. takeSnapshot method public Takes a snapshot of the CPU.
destructor ~Z80 | ? ^ > |
Destructor.
- Source:
- z80.h:155
- Code:
public virtual ~ Z80 ( )
constructor Z80 | ? ^ < > |
Copy constructor: creates a copy of the specified Z80 object.
- Source:
- z80.h:151
- Code:
public Z80 ( const Z80 & )
constructor Z80 | ? ^ < > |
Constructor: creates a Z80 object with the specified environment.
- Source:
- z80.h:146
- Code:
public Z80 ( Z80Environment & )
enum $anonymous$ | ? ^ < > |
CPU flags
- Source:
- z80.h:116
- Code:
public enum { Carry = 0x01 , AddSub = 0x02 , Subtraction = AddSub , Parity = 0x04 , Overflow = Parity , Flag3 = 0x08 , Halfcarry = 0x10 , Flag5 = 0x20 , Zero = 0x40 , Sign = 0x80 }
attribute A | ? ^ < > |
A register (accumulator)
- Source:
- z80.h:126
- Code:
- public unsigned char A
attribute A1 | ? ^ < > |
Alternate A register (A')
- Source:
- z80.h:134
- Code:
- public unsigned char A1
method AF | ? ^ < > |
Returns the 16 bit register AF.
- Source:
- z80.h:203
- Code:
public unsigned AF ( ) const
attribute B | ? ^ < > |
B register
- Source:
- z80.h:120
- Code:
- public unsigned char B
attribute B1 | ? ^ < > |
Alternate B register (B')
- Source:
- z80.h:128
- Code:
- public unsigned char B1
method BC | ? ^ < > |
Returns the 16 bit register BC.
- Source:
- z80.h:208
- Code:
public unsigned BC ( ) const
attribute C | ? ^ < > |
C register
- Source:
- z80.h:121
- Code:
- public unsigned char C
attribute C1 | ? ^ < > |
Alternate C register (C')
- Source:
- z80.h:129
- Code:
- public unsigned char C1
attribute D | ? ^ < > |
D register
- Source:
- z80.h:122
- Code:
- public unsigned char D
attribute D1 | ? ^ < > |
Alternate D register (D')
- Source:
- z80.h:130
- Code:
- public unsigned char D1
method DE | ? ^ < > |
Returns the 16 bit register DE.
- Source:
- z80.h:213
- Code:
public unsigned DE ( ) const
attribute E | ? ^ < > |
E register
- Source:
- z80.h:123
- Code:
- public unsigned char E
attribute E1 | ? ^ < > |
Alternate E register (E')
- Source:
- z80.h:131
- Code:
- public unsigned char E1
attribute F | ? ^ < > |
Flags register
- Source:
- z80.h:127
- Code:
- public unsigned char F
attribute F1 | ? ^ < > |
Alternate flags register (F')
- Source:
- z80.h:135
- Code:
- public unsigned char F1
method getCycles | ? ^ < > |
Returns the number of Z80 CPU cycles elapsed so far.
The cycle count is reset to zero when reset() is called, or it can be set to any value with setCycles(). It is updated after a CPU instruction is executed, for example by calling step() or interrupt().
- Source:
- z80.h:230
- Code:
public unsigned getCycles ( ) const
method getInterruptMode | ? ^ < > |
Returns the current interrupt mode.
- Source:
- z80.h:240
- Code:
public unsigned getInterruptMode ( ) const
method getSizeOfSnapshotBuffer | ? ^ < > |
Returns the size of the buffer needed to take a snapshot of the CPU.
- Source:
- z80.h:258
- Code:
public unsigned getSizeOfSnapshotBuffer ( ) const
attribute H | ? ^ < > |
H register
- Source:
- z80.h:124
- Code:
- public unsigned char H
attribute H1 | ? ^ < > |
Alternate H register (H')
- Source:
- z80.h:132
- Code:
- public unsigned char H1
method HL | ? ^ < > |
Returns the 16 bit register HL.
- Source:
- z80.h:218
- Code:
public unsigned HL ( ) const
attribute I | ? ^ < > |
Interrupt register
- Source:
- z80.h:140
- Code:
- public unsigned char I
method interrupt | ? ^ < > |
Invokes an interrupt.
If interrupts are enabled, the current program counter (PC) is saved on the stack and assigned the specified address. When the interrupt handler returns, execution resumes from the point where the interrupt occurred.
The actual interrupt address depends on the current interrupt mode and on the interrupt type. For maskable interrupts, data is as follows: - mode 0: data is an opcode that is executed (usually RST xxh); - mode 1: data is ignored and a call is made to address 0x38; - mode 2: a call is made to the 16 bit address given by (256*I + data).
- Source:
- z80.h:195
- Code:
public void interrupt ( unsigned char data )
method isHalted | ? ^ < > |
Returns non-zero if the CPU is halted, otherwise zero.
- Source:
- z80.h:248
- Code:
public int isHalted ( ) const
attribute IX | ? ^ < > |
Index register X
- Source:
- z80.h:136
- Code:
- public unsigned IX
attribute IY | ? ^ < > |
Index register Y
- Source:
- z80.h:137
- Code:
- public unsigned IY
attribute L | ? ^ < > |
L register
- Source:
- z80.h:125
- Code:
- public unsigned char L
attribute L1 | ? ^ < > |
Alternate L register (L')
- Source:
- z80.h:133
- Code:
- public unsigned char L1
method nmi | ? ^ < > |
Forces a non-maskable interrupt.
- Source:
- z80.h:198
- Code:
public void nmi ( )
operator = | ? ^ < > |
Copies CPU register from one object to another.
Note that the environment is not copied, only registers.
- Source:
- z80.h:255
- Code:
public Z80 & operator = ( const Z80 & )
attribute PC | ? ^ < > |
Program counter
- Source:
- z80.h:138
- Code:
- public unsigned PC
attribute R | ? ^ < > |
Refresh register
- Source:
- z80.h:141
- Code:
- public unsigned char R
method reset | ? ^ < > |
Resets the CPU to its initial state.
The stack pointer (SP) is set to F000h, all other registers are cleared.
- Source:
- z80.h:162
- Code:
public virtual void reset ( )
method restoreSnapshot | ? ^ < > |
Restores a snapshot taken with takeSnapshot().
This function uses the data saved in the snapshot buffer to restore the CPU status.
- Source:
- z80.h:286
- Param:
buffer buffer where the snapshot data is stored
- Returns:
- the number of bytes read from the buffer
- Code:
public unsigned restoreSnapshot ( unsigned char * buffer )
method run | ? ^ < > |
Runs the CPU for the specified number of cycles.
Note that the number of CPU cycles performed by this function may be actually a little more than the value specified. If that happens then the function returns the number of extra cycles executed.
- Source:
- z80.h:175
- Param:
cycles number of cycles the CPU must execute
- Returns:
- the number of extra cycles executed by the last instruction
- Code:
public virtual unsigned run ( unsigned cycles )
method setCycles | ? ^ < > |
Sets the CPU cycle counter to the specified value.
- Source:
- z80.h:235
- Code:
public void setCycles ( unsigned value )
method setInterruptMode | ? ^ < > |
Sets the interrupt mode to the specified value.
- Source:
- z80.h:243
- Code:
public void setInterruptMode ( unsigned mode )
attribute SP | ? ^ < > |
Stack pointer
- Source:
- z80.h:139
- Code:
- public unsigned SP
method step | ? ^ < > |
Executes one instruction.
- Source:
- z80.h:180
- Code:
public virtual void step ( )
method takeSnapshot | ? ^ < > |
Takes a snapshot of the CPU.
A snapshot saves all of the CPU registers and internals. It can be restored at any time to bring the CPU back to the exact status it had when the snapshot was taken.
Note: the size of the snapshot buffer must be no less than the size returned by the getSizeOfSnapshotBuffer() function.
- Source:
- z80.h:274
- Param:
buffer buffer where the snapshot data is stored
- Returns:
- the number of bytes written into the buffer
- Code:
public unsigned takeSnapshot ( unsigned char * buffer )
Copyright (c) 1997-2003,2004 Alessandro Scotti. All rights reserved.