z80 CPU data structure and functions
More...
#include <stdint.h>
#include "bus.h"
Go to the source code of this file.
|
| union | word |
| | type to deal with endianness and access of high/low bits More...
|
| |
| struct | z80 |
| |
|
|
#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
|
| |
z80 CPU data structure and functions
- Author
- Peter H. Ezetta
◆ interrupt_mode
enum to contain all possible interrupt modes
| Enumerator |
|---|
| IM0 | Interrupt Mode 0
|
| IM1 | Interrupt Mode 1
|
| IM2 | Interrupt Mode 2
|
◆ 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
-
| cpu | A z80 struct to reset. |
◆ run()
| int run |
( |
struct z80 * |
cpu, |
|
|
uint8_t * |
memory, |
|
|
long |
runcycles, |
|
|
bool |
s_flag |
|
) |
| |
Runs the cpu
- Parameters
-
| cpu | A z80 cpu struct to run. |
| memory | An allocated block of memory to pass to the cpu. |
| runcycles | The number of clock cycles to run the cpu. |
| s_flag | Enable running in step mode |
- Returns
- Count of cycles executed.