-
Notifications
You must be signed in to change notification settings - Fork 0
/
DrZ80_support.h
67 lines (53 loc) · 2.23 KB
/
DrZ80_support.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef Z80_H
#define Z80_H
#ifdef __cplusplus
extern "C" {
#endif
//#include "osd_cpu.h"
//#include "cpuintrf.h"
#include "DrZ80.h"
/* daisy-chain link */
typedef struct {
void (*reset)(int); /* reset callback */
int (*interrupt_entry)(int); /* entry callback */
void (*interrupt_reti)(int); /* reti callback */
int irq_param; /* callback paramater */
} Z80_DaisyChain;
#define Z80_MAXDAISY 4 /* maximum of daisy chan device */
#define Z80_INT_REQ 0x01 /* interrupt request mask */
#define Z80_INT_IEO 0x02 /* interrupt disable mask(IEO) */
#define Z80_VECTOR(device,state) (((device)<<8)|(state))
/****************************************************************************/
/* The Z80 registers. HALT is set to 1 when the CPU is halted, the refresh */
/* register is calculated as follows: refresh=(Regs.R&127)|(Regs.R2&128) */
/****************************************************************************/
typedef struct {
struct DrZ80 regs;
int pending_irq;
int irq_max; /* number of daisy chain devices */
int request_irq; /* daisy chain next request device */
int service_irq; /* daisy chain next reti handling device */
int int_state[Z80_MAXDAISY];
Z80_DaisyChain irq[Z80_MAXDAISY];
} Z80_Regs;
/*extern int Z80_ICount; // T-state count */
extern Z80_Regs Z80;
//#define Z80_ICount (Z80.regs.cycles)
#define Z80_IGNORE_INT -1 /* Ignore interrupt */
#define Z80_NMI_INT -2 /* Execute NMI */
#define Z80_IRQ_INT -1000 /* Execute IRQ */
extern unsigned Z80_GetPC (void); /* Get program counter */
extern int Z80_GetPreviousPC (void);
extern void Z80_GetRegs (Z80_Regs *Regs); /* Get registers */
extern void Z80_SetRegs (Z80_Regs *Regs); /* Set registers */
//extern void Z80_Reset (Z80_DaisyChain *daisy_chain);
extern void Z80_Reset(void);
extern int Z80_Execute(int cycles); /* Execute cycles T-States - returns number of cycles actually run */
extern int Z80_Interrupt(void);
extern void Z80_Cause_Interrupt(int type);
extern void Z80_Clear_Pending_Interrupts(void);
extern void Interrupt(void); /* required for DrZ80 int hack */
#ifdef __cplusplus
} /* End of extern "C" */
#endif
#endif