-
Notifications
You must be signed in to change notification settings - Fork 2
/
cpudefs.h
103 lines (79 loc) · 2.24 KB
/
cpudefs.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
94
95
96
97
98
99
100
101
102
103
/*
Definitions for the CPU-Modules
*/
#ifndef __m68000defs__
#define __m68000defs__
#include <stdlib.h>
#include <inttypes.h>
#include "memory.h"
extern unsigned char pending_interrupts;
extern short cpu_readop();
#define BYTE signed char
#define UBYTE unsigned char
#define UWORD unsigned short
#define WORD short
#define ULONG unsigned int
#define LONG int
#define CPTR unsigned int
extern void Exception(int nr, CPTR oldpc);
typedef void cpuop_func(ULONG);
extern cpuop_func *cpufunctbl[65536];
typedef char flagtype;
#define READ_MEML(a,b) asm ("mov (%%esi),%%eax \n\t bswap %%eax \n\t" :"=a" (b) :"S" (a))
#define READ_MEMW(a,b) asm ("mov (%%esi),%%ax\n\t xchg %%al,%%ah" :"=a" (b) : "S" (a))
#define get_byte(a) cpu_readmem24((a)&0xffffff)
#define get_word(a) cpu_readmem24_word((a)&0xffffff)
#define get_long(a) cpu_readmem24_dword((a)&0xffffff)
#define put_byte(a,b) cpu_writemem24((a)&0xffffff,b)
#define put_word(a,b) cpu_writemem24_word((a)&0xffffff,b)
#define put_long(a,b) cpu_writemem24_dword((a)&0xffffff,b)
union flagu {
struct {
char v;
char c;
char n;
char z;
} flags;
ULONG longflags;
};
extern int areg_byteinc[];
extern int movem_index1[256];
extern int movem_index2[256];
extern int movem_next[256];
extern int imm8_table[];
extern UBYTE *actadr;
typedef struct
{
ULONG d[8];
CPTR a[8],usp,isp,msp;
UWORD sr;
flagtype t1;
flagtype t0;
flagtype s;
flagtype m;
flagtype x;
flagtype stopped;
int intmask;
ULONG pc;
ULONG vbr,sfc,dfc;
double fp[8];
ULONG fpcr,fpsr,fpiar;
} regstruct;
extern regstruct regs, lastint_regs;
extern union flagu intel_flag_lookup[256];
extern union flagu regflags;
#define ZFLG (regflags.flags.z)
#define NFLG (regflags.flags.n)
#define CFLG (regflags.flags.c)
#define VFLG (regflags.flags.v)
extern UWORD nextiword(void);
extern ULONG nextilong(void);
extern void m68k_setpc(CPTR newpc);
extern ULONG get_disp_ea(ULONG base);
extern CPTR m68k_getpc(void);
extern int cctrue(const int cc);
extern void MakeSR(void);
extern void MakeFromSR(void);
#include "68kint.h"
extern int raiseTrap(int n);
#endif