-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathARMV30MZ.h
93 lines (78 loc) · 1.85 KB
/
ARMV30MZ.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
82
83
84
85
86
87
88
89
90
91
92
93
//
// ARMV30MZ.h
// V30MZ cpu emulator for arm32.
//
// Created by Fredrik Ahlström on 2021-10-19.
// Copyright © 2021-2024 Fredrik Ahlström. All rights reserved.
//
#ifndef ARMV30MZ_HEADER
#define ARMV30MZ_HEADER
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
u32 regs[8];
u32 sRegs[4];
u32 prefixBase;
u32 flags;
u8 *pc;
u32 cycles;
u8 irqPin;
u8 iFlag;
u8 empty;
u8 nmiPending;
u16 parityVal;
u8 nmiPin;
u8 df;
u8 mulOverflow;
u8 dummy0[3];
u8 *lastBank;
u8 (*irqVectorFunc)(void);
u8 *memTbl[16];
void (*opz[256])(void);
u8 pzst[256];
void (*EATable[256])(void);
u32 modRm[256];
u8 segTbl[256];
} ARMV30Core;
extern ARMV30Core V30OpTable;
/**
* Reset the cpu core.
* @param *cpu: The ARMV30Core cpu to reset.
* @param type: ASWAN = 0, SPHINX(2) != 0.
*/
void V30Reset(ARMV30Core *cpu, int type);
/**
* Saves the state of the cpu to the destination.
* @param *destination: Where to save the state.
* @param *cpu: The ARMV30Core cpu to save.
* @return The size of the state.
*/
int V30SaveState(void *destination, const ARMV30Core *cpu);
/**
* Loads the state of the cpu from the source.
* @param *cpu: The ARMV30Core cpu to load a state into.
* @param *source: Where to load the state from.
* @return The size of the state.
*/
int V30LoadState(ARMV30Core *cpu, const void *source);
/**
* Gets the state size of an ARMV30Core state.
* @return The size of the state.
*/
int V30GetStateSize(void);
/**
* Redirect/patch an opcode to a new function.
* @param opcode: Which opcode to redirect.
* @param *function: Pointer to new function .
*/
void V30RedirectOpcode(int opcode, void (*function)(void));
void V30SetIRQPin(bool set);
void V30SetNMIPin(bool set);
void V30RestoreAndRunXCycles(int cycles);
void V30RunXCycles(int cycles);
void V30CheckIRQs(void);
#ifdef __cplusplus
}
#endif
#endif // ARMV30MZ_HEADER