PZ80emu  0.1
Data Structures | Macros | Enumerations | Functions
z80.h File Reference

z80 CPU data structure and functions More...

#include <stdint.h>
#include "bus.h"
Include dependency graph for z80.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  word
 type to deal with endianness and access of high/low bits More...
 
struct  z80
 

Macros

#define INIT_PC   0x0000
 initial value of the PC register
 
#define INTERRUPT_PERIOD   10240
 number of cycles to run before triggering interrupt
 
#define CARRY   0
 bit position of CARRY flag
 
#define SUBTRACT   1
 bit position of SUBTRACT flag
 
#define PARITY_OVERFLOW   2
 bit position of OVERFLOW flag
 
#define F3   3
 bit position of F3 flag
 
#define HALF_CARRY   4
 bit position of HALF CARRY flag
 
#define F5   5
 bit position of F5 flag
 
#define ZERO   6
 bit position of ZERO flag
 
#define SIGN   7
 bit position of SIGN flag
 

Enumerations

enum  interrupt_mode { IM0, IM1, IM2 }
 enum to contain all possible interrupt modes More...
 

Functions

__BEGIN_DECLS struct z80new_cpu (void)
 
void reset_cpu (struct z80 *)
 
int run (struct z80 *, uint8_t *, long, bool)
 

Detailed Description

z80 CPU data structure and functions

Author
Peter H. Ezetta

Enumeration Type Documentation

◆ interrupt_mode

enum to contain all possible interrupt modes

Enumerator
IM0 

Interrupt Mode 0

IM1 

Interrupt Mode 1

IM2 

Interrupt Mode 2

Function Documentation

◆ new_cpu()

__BEGIN_DECLS struct z80* new_cpu ( void  )

Fills out a new z80 CPU struct

Returns
A z80 struct

◆ reset_cpu()

void reset_cpu ( struct z80 cpu)

Triggers the reset state on the z80 CPU

Parameters
cpuA z80 struct to reset.

◆ run()

int run ( struct z80 cpu,
uint8_t *  memory,
long  runcycles,
bool  s_flag 
)

Runs the cpu

Parameters
cpuA z80 cpu struct to run.
memoryAn allocated block of memory to pass to the cpu.
runcyclesThe number of clock cycles to run the cpu.
s_flagEnable running in step mode
Returns
Count of cycles executed.
Here is the call graph for this function: