-
Notifications
You must be signed in to change notification settings - Fork 1
/
ARMZ80.h
81 lines (67 loc) · 1.63 KB
/
ARMZ80.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef ARMZ80_HEADER
#define ARMZ80_HEADER
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
u8 *memTbl[64];
u8 (*readTbl[8])(void);
void (*writeTbl[8])(u8);
u32 regs[8];
u32 regs2[5];
u32 IX;
u32 IY;
u8 I;
u8 R;
u8 IM;
u8 Iff2;
u8 IrqPin;
u8 Padding0[1];
u8 Iff1;
u8 NmiPending;
u8 NmiPin;
u8 Out0;
u8 Padding1[2];
u8 *LastBank;
void (*IMFunction)(void);
u8 (*IrqVectorFunc)(void);
void (*IrqAckFunc)(void);
void (*Opz[256])(void);
u8 PZST[256];
} ARMZ80Core;
extern ARMZ80Core Z80OpTable;
void Z80Reset(ARMZ80Core *cpu, int type);
/**
* Saves the state of the cpu to the destination.
* @param *destination: Where to save the state.
* @param *cpu: The ARMZ80Core cpu to save.
* @return The size of the state.
*/
int Z80SaveState(void *destination, const ARMZ80Core *cpu);
/**
* Loads the state of the cpu from the source.
* @param *cpu: The ARMZ80Core cpu to load a state into.
* @param *source: Where to load the state from.
* @return The size of the state.
*/
int Z80LoadState(ARMZ80Core *cpu, const void *source);
/**
* Gets the state size of an ARMZ80Core state.
* @return The size of the state.
*/
int Z80GetStateSize(void);
/**
* Redirect/patch an opcode to a new function.
* @param opcode: Which opcode to redirect.
* @param *function: Pointer to new function .
*/
void Z80RedirectOpcode(int opcode, void (*function)(void));
void Z80SetIRQPin(bool state, ARMZ80Core *cpu);
void Z80SetNMIPin(bool state, ARMZ80Core *cpu);
void Z80SetResetPin(bool state, ARMZ80Core *cpu);
void Z80RestoreAndRunXCycles(int cycles);
void Z80RunXCycles(int cycles);
#ifdef __cplusplus
}
#endif
#endif // ARMZ80_HEADER