annotate src/psf2/cpuintrf.h @ 3193:93cf4d0a0dde

alsa-ng: Prefer "PCM" volume control over "Wave" on systems that have both, for consistency with OSS plugin and maybe other apps (closes AUD-34 and AUD-36).
author John Lindgren <john.lindgren@tds.net>
date Mon, 29 Jun 2009 23:05:56 -0400
parents 62cc6d667119
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2737
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 #ifndef CPUINTRF_H
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2 #define CPUINTRF_H
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 #include "osd_cpu.h"
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 /* The old system is obsolete and no longer supported by the core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 #define NEW_INTERRUPT_SYSTEM 1
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 #define MAX_IRQ_LINES 8 /* maximum number of IRQ lines per CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11 #define CLEAR_LINE 0 /* clear (a fired, held or pulsed) line */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 #define ASSERT_LINE 1 /* assert an interrupt immediately */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 #define HOLD_LINE 2 /* hold interrupt line until enable is true */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 #define PULSE_LINE 3 /* pulse interrupt line for one instruction */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 #define MAX_REGS 64 /* maximum number of register of any CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18 #define IRQ_LINE_NMI 10
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19 /* Values passed to the cpu_info function of a core to retrieve information */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 enum {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 CPU_INFO_REG,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22 CPU_INFO_FLAGS=MAX_REGS,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23 CPU_INFO_NAME,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 CPU_INFO_FAMILY,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 CPU_INFO_VERSION,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 CPU_INFO_FILE,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27 CPU_INFO_CREDITS,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28 CPU_INFO_REG_LAYOUT,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 CPU_INFO_WIN_LAYOUT
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 };
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 #define CPU_IS_LE 0 /* emulated CPU is little endian */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33 #define CPU_IS_BE 1 /* emulated CPU is big endian */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35 /*
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36 * This value is passed to cpu_get_reg to retrieve the previous
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 * program counter value, ie. before a CPU emulation started
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38 * to fetch opcodes and arguments for the current instrution.
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 #define REG_PREVIOUSPC -1
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42 /*
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43 * This value is passed to cpu_get_reg/cpu_set_reg, instead of one of
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44 * the names from the enum a CPU core defines for it's registers,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 * to get or set the contents of the memory pointed to by a stack pointer.
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 * You can specify the n'th element on the stack by (REG_SP_CONTENTS-n),
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47 * ie. lower negative values. The actual element size (UINT16 or UINT32)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
48 * depends on the CPU core.
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49 * This is also used to replace the cpu_geturnpc() function.
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50 */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51 #define REG_SP_CONTENTS -2
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53 /*
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 * These flags can be defined in the makefile (or project) to
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55 * exclude (zero) or include (non zero) specific CPU cores
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56 */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57 #ifndef HAS_GENSYNC
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58 #define HAS_GENSYNC 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
59 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
60 #ifndef HAS_Z80
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
61 #define HAS_Z80 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
62 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
63 #ifndef HAS_Z80_VM
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
64 #define HAS_Z80_VM 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
65 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
66 #ifndef HAS_8080
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
67 #define HAS_8080 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
68 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
69 #ifndef HAS_8085A
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
70 #define HAS_8085A 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
71 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
72 #ifndef HAS_M6502
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
73 #define HAS_M6502 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
74 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
75 #ifndef HAS_M65C02
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
76 #define HAS_M65C02 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
77 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
78 #ifndef HAS_M65SC02
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
79 #define HAS_M65SC02 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
80 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
81 #ifndef HAS_M65CE02
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
82 #define HAS_M65CE02 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
83 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
84 #ifndef HAS_M6509
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
85 #define HAS_M6509 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
86 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
87 #ifndef HAS_M6510
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
88 #define HAS_M6510 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
89 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
90 #ifndef HAS_N2A03
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
91 #define HAS_N2A03 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
92 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
93 #ifndef HAS_H6280
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
94 #define HAS_H6280 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
95 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
96 #ifndef HAS_I86
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
97 #define HAS_I86 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
98 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
99 #ifndef HAS_V20
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
100 #define HAS_V20 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
101 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
102 #ifndef HAS_V30
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
103 #define HAS_V30 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
104 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
105 #ifndef HAS_V33
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
106 #define HAS_V33 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
107 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
108 #ifndef HAS_I8035
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
109 #define HAS_I8035 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
110 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
111 #ifndef HAS_I8039
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
112 #define HAS_I8039 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
113 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
114 #ifndef HAS_I8048
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
115 #define HAS_I8048 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
116 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
117 #ifndef HAS_N7751
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
118 #define HAS_N7751 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
119 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
120 #ifndef HAS_M6800
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
121 #define HAS_M6800 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
122 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
123 #ifndef HAS_M6801
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
124 #define HAS_M6801 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
125 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
126 #ifndef HAS_M6802
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
127 #define HAS_M6802 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
128 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
129 #ifndef HAS_M6803
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
130 #define HAS_M6803 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
131 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
132 #ifndef HAS_M6808
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
133 #define HAS_M6808 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
134 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
135 #ifndef HAS_HD63701
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
136 #define HAS_HD63701 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
137 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
138 #ifndef HAS_M6805
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
139 #define HAS_M6805 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
140 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
141 #ifndef HAS_M68705
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
142 #define HAS_M68705 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
143 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
144 #ifndef HAS_HD63705
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
145 #define HAS_HD63705 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
146 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
147 #ifndef HAS_HD6309
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
148 #define HAS_HD6309 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
149 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
150 #ifndef HAS_M6809
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
151 #define HAS_M6809 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
152 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
153 #ifndef HAS_KONAMI
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
154 #define HAS_KONAMI 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
155 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
156 #ifndef HAS_M68000
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
157 #define HAS_M68000 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
158 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
159 #ifndef HAS_M68010
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
160 #define HAS_M68010 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
161 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
162 #ifndef HAS_M68020
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
163 #define HAS_M68020 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
164 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
165 #ifndef HAS_T11
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
166 #define HAS_T11 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
167 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
168 #ifndef HAS_S2650
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
169 #define HAS_S2650 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
170 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
171 #ifndef HAS_TMS34010
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
172 #define HAS_TMS34010 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
173 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
174 #ifndef HAS_TMS9900
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
175 #define HAS_TMS9900 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
176 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
177 #ifndef HAS_TMS9940
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
178 #define HAS_TMS9940 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
179 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
180 #ifndef HAS_TMS9980
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
181 #define HAS_TMS9980 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
182 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
183 #ifndef HAS_TMS9985
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
184 #define HAS_TMS9985 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
185 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
186 #ifndef HAS_TMS9989
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
187 #define HAS_TMS9989 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
188 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
189 #ifndef HAS_TMS9995
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
190 #define HAS_TMS9995 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
191 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
192 #ifndef HAS_TMS99105A
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
193 #define HAS_TMS99105A 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
194 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
195 #ifndef HAS_TMS99110A
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
196 #define HAS_TMS99110A 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
197 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
198 #ifndef HAS_Z8000
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
199 #define HAS_Z8000 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
200 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
201 #ifndef HAS_TMS320C10
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
202 #define HAS_TMS320C10 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
203 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
204 #ifndef HAS_CCPU
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
205 #define HAS_CCPU 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
206 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
207 #ifndef HAS_PDP1
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
208 #define HAS_PDP1 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
209 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
210 #ifndef HAS_ADSP2100
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
211 #define HAS_ADSP2100 0
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
212 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
213
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
214 /* ASG 971222 -- added this generic structure */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
215 struct cpu_interface
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
216 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
217 unsigned cpu_num;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
218 void (*reset)(void *param);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
219 void (*exit)(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
220 int (*execute)(int cycles);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
221 void (*burn)(int cycles);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
222 unsigned (*get_context)(void *reg);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
223 void (*set_context)(void *reg);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
224 unsigned (*get_pc)(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
225 void (*set_pc)(unsigned val);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
226 unsigned (*get_sp)(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
227 void (*set_sp)(unsigned val);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
228 unsigned (*get_reg)(int regnum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
229 void (*set_reg)(int regnum, unsigned val);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
230 void (*set_nmi_line)(int linestate);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
231 void (*set_irq_line)(int irqline, int linestate);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
232 void (*set_irq_callback)(int(*callback)(int irqline));
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
233 void (*internal_interrupt)(int type);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
234 void (*cpu_state_save)(void *file);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
235 void (*cpu_state_load)(void *file);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
236 const char* (*cpu_info)(void *context,int regnum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
237 unsigned (*cpu_dasm)(char *buffer,unsigned pc);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
238 unsigned num_irqs;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
239 int default_vector;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
240 int *icount;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
241 double overclock;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
242 int no_int, irq_int, nmi_int;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
243 int (*memory_read)(int offset);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
244 void (*memory_write)(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
245 void (*set_op_base)(int pc);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
246 int address_shift;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
247 unsigned address_bits, endianess, align_unit, max_inst_len;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
248 unsigned abits1, abits2, abitsmin;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
249 };
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
250
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
251 extern struct cpu_interface cpuintf[];
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
252
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
253 void cpu_init(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
254 void cpu_run(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
255
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
256 /* optional watchdog */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
257 void watchdog_reset_w(int offset,int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
258 int watchdog_reset_r(int offset);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
259 /* Use this function to reset the machine */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
260 void machine_reset(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
261 /* Use this function to reset a single CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
262 void cpu_set_reset_line(int cpu,int state);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
263 /* Use this function to halt a single CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
264 void cpu_set_halt_line(int cpu,int state);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
265
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
266 /* This function returns CPUNUM current status (running or halted) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
267 int cpu_getstatus(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
268 int cpu_gettotalcpu(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
269 int cpu_getactivecpu(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
270 void cpu_setactivecpu(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
271
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
272 /* Returns the current program counter */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
273 unsigned cpu_get_pc(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
274 /* Set the current program counter */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
275 void cpu_set_pc(unsigned val);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
276
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
277 /* Returns the current stack pointer */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
278 unsigned cpu_get_sp(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
279 /* Set the current stack pointer */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
280 void cpu_set_sp(unsigned val);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
281
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
282 /* Get the active CPUs context and return it's size */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
283 unsigned cpu_get_context(void *context);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
284 /* Set the active CPUs context */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
285 void cpu_set_context(void *context);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
286
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
287 /* Returns a specific register value (mamedbg) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
288 unsigned cpu_get_reg(int regnum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
289 /* Sets a specific register value (mamedbg) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
290 void cpu_set_reg(int regnum, unsigned val);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
291
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
292 /* Returns previous pc (start of opcode causing read/write) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
293 /* int cpu_getpreviouspc(void); */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
294 #define cpu_getpreviouspc() cpu_get_reg(REG_PREVIOUSPC)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
295
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
296 /* Returns the return address from the top of the stack (Z80 only) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
297 /* int cpu_getreturnpc(void); */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
298 /* This can now be handled with a generic function */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
299 #define cpu_geturnpc() cpu_get_reg(REG_SP_CONTENTS)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
300
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
301 int cycles_currently_ran(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
302 int cycles_left_to_run(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
303
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
304 /* Returns the number of CPU cycles which take place in one video frame */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
305 int cpu_gettotalcycles(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
306 /* Returns the number of CPU cycles before the next interrupt handler call */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
307 int cpu_geticount(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
308 /* Returns the number of CPU cycles before the end of the current video frame */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
309 int cpu_getfcount(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
310 /* Returns the number of CPU cycles in one video frame */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
311 int cpu_getfperiod(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
312 /* Scales a given value by the ratio of fcount / fperiod */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
313 int cpu_scalebyfcount(int value);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
314 /* Returns the current scanline number */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
315 int cpu_getscanline(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
316 /* Returns the amount of time until a given scanline */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
317 double cpu_getscanlinetime(int scanline);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
318 /* Returns the duration of a single scanline */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
319 double cpu_getscanlineperiod(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
320 /* Returns the duration of a single scanline in cycles */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
321 int cpu_getscanlinecycles(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
322 /* Returns the number of cycles since the beginning of this frame */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
323 int cpu_getcurrentcycles(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
324 /* Returns the current horizontal beam position in pixels */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
325 int cpu_gethorzbeampos(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
326 /*
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
327 Returns the number of times the interrupt handler will be called before
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
328 the end of the current video frame. This is can be useful to interrupt
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
329 handlers to synchronize their operation. If you call this from outside
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
330 an interrupt handler, add 1 to the result, i.e. if it returns 0, it means
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
331 that the interrupt handler will be called once.
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
332 */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
333 int cpu_getiloops(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
334
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
335 /* Returns the current VBLANK state */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
336 int cpu_getvblank(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
337
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
338 /* Returns the number of the video frame we are currently playing */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
339 int cpu_getcurrentframe(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
340
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
341
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
342 /* generate a trigger after a specific period of time */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
343 void cpu_triggertime (double duration, int trigger);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
344 /* generate a trigger now */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
345 void cpu_trigger (int trigger);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
346
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
347 /* burn CPU cycles until a timer trigger */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
348 void cpu_spinuntil_trigger (int trigger);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
349 /* burn CPU cycles until the next interrupt */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
350 void cpu_spinuntil_int (void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
351 /* burn CPU cycles until our timeslice is up */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
352 void cpu_spin (void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
353 /* burn CPU cycles for a specific period of time */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
354 void cpu_spinuntil_time (double duration);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
355
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
356 /* yield our timeslice for a specific period of time */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
357 void cpu_yielduntil_trigger (int trigger);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
358 /* yield our timeslice until the next interrupt */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
359 void cpu_yielduntil_int (void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
360 /* yield our current timeslice */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
361 void cpu_yield (void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
362 /* yield our timeslice for a specific period of time */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
363 void cpu_yielduntil_time (double duration);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
364
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
365 /* set the NMI line state for a CPU, normally use PULSE_LINE */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
366 void cpu_set_nmi_line(int cpunum, int state);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
367 /* set the IRQ line state for a specific irq line of a CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
368 /* normally use state HOLD_LINE, irqline 0 for first IRQ type of a cpu */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
369 void cpu_set_irq_line(int cpunum, int irqline, int state);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
370 /* this is to be called by CPU cores only! */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
371 void cpu_generate_internal_interrupt(int cpunum, int type);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
372 /* set the vector to be returned during a CPU's interrupt acknowledge cycle */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
373 void cpu_irq_line_vector_w(int cpunum, int irqline, int vector);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
374
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
375 /* use these in your write memory/port handles to set an IRQ vector */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
376 /* offset corresponds to the irq line number here */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
377 void cpu_0_irq_line_vector_w(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
378 void cpu_1_irq_line_vector_w(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
379 void cpu_2_irq_line_vector_w(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
380 void cpu_3_irq_line_vector_w(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
381 void cpu_4_irq_line_vector_w(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
382 void cpu_5_irq_line_vector_w(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
383 void cpu_6_irq_line_vector_w(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
384 void cpu_7_irq_line_vector_w(int offset, int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
385
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
386 /* Obsolete functions: avoid to use them in new drivers if possible. */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
387
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
388 /* cause an interrupt on a CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
389 void cpu_cause_interrupt(int cpu,int type);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
390 void cpu_clear_pending_interrupts(int cpu);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
391 void interrupt_enable_w(int offset,int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
392 void interrupt_vector_w(int offset,int data);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
393 int interrupt(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
394 int nmi_interrupt(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
395 int m68_level1_irq(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
396 int m68_level2_irq(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
397 int m68_level3_irq(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
398 int m68_level4_irq(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
399 int m68_level5_irq(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
400 int m68_level6_irq(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
401 int m68_level7_irq(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
402 int ignore_interrupt(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
403
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
404 /* CPU context access */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
405 void* cpu_getcontext (int _activecpu);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
406 int cpu_is_saving_context(int _activecpu);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
407
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
408 /***************************************************************************
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
409 * Get information for the currently active CPU
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
410 * cputype is a value from the CPU enum in driver.h
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
411 ***************************************************************************/
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
412 /* Return number of address bits */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
413 unsigned cpu_address_bits(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
414 /* Return address mask */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
415 unsigned cpu_address_mask(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
416 /* Return address shift factor (TMS34010 bit addressing mode) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
417 int cpu_address_shift(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
418 /* Return endianess of the emulated CPU (CPU_IS_LE or CPU_IS_BE) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
419 unsigned cpu_endianess(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
420 /* Return opcode align unit (1 byte, 2 word, 4 dword) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
421 unsigned cpu_align_unit(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
422 /* Return maximum instruction length */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
423 unsigned cpu_max_inst_len(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
424
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
425 /* Return name of the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
426 const char *cpu_name(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
427 /* Return family name of the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
428 const char *cpu_core_family(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
429 /* Return core version of the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
430 const char *cpu_core_version(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
431 /* Return core filename of the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
432 const char *cpu_core_file(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
433 /* Return credits info for of the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
434 const char *cpu_core_credits(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
435 /* Return register layout definition for the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
436 const char *cpu_reg_layout(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
437 /* Return (debugger) window layout definition for the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
438 const char *cpu_win_layout(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
439
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
440 /* Disassemble an instruction at PC into the given buffer */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
441 unsigned cpu_dasm(char *buffer, unsigned pc);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
442 /* Return a string describing the currently set flag (status) bits of the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
443 const char *cpu_flags(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
444 /* Return a string with a register name and hex value for the active CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
445 /* regnum is a value defined in the CPU cores header files */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
446 const char *cpu_dump_reg(int regnum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
447 /* Return a string describing the active CPUs current state */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
448 const char *cpu_dump_state(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
449
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
450 /***************************************************************************
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
451 * Get information for a specific CPU type
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
452 * cputype is a value from the CPU enum in driver.h
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
453 ***************************************************************************/
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
454 /* Return address shift factor */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
455 /* TMS320C10 -1: word addressing mode, TMS34010 3: bit addressing mode */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
456 int cputype_address_shift(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
457 /* Return number of address bits */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
458 unsigned cputype_address_bits(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
459 /* Return address mask */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
460 unsigned cputype_address_mask(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
461 /* Return endianess of the emulated CPU (CPU_IS_LE or CPU_IS_BE) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
462 unsigned cputype_endianess(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
463 /* Return opcode align unit (1 byte, 2 word, 4 dword) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
464 unsigned cputype_align_unit(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
465 /* Return maximum instruction length */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
466 unsigned cputype_max_inst_len(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
467
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
468 /* Return name of the CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
469 const char *cputype_name(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
470 /* Return family name of the CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
471 const char *cputype_core_family(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
472 /* Return core version number of the CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
473 const char *cputype_core_version(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
474 /* Return core filename of the CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
475 const char *cputype_core_file(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
476 /* Return credits for the CPU core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
477 const char *cputype_core_credits(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
478 /* Return register layout definition for the CPU core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
479 const char *cputype_reg_layout(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
480 /* Return (debugger) window layout definition for the CPU core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
481 const char *cputype_win_layout(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
482
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
483 /***************************************************************************
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
484 * Get (or set) information for a numbered CPU of the running machine
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
485 * cpunum is a value between 0 and cpu_gettotalcpu() - 1
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
486 ***************************************************************************/
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
487 /* Return number of address bits */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
488 unsigned cpunum_address_bits(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
489 /* Return address mask */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
490 unsigned cpunum_address_mask(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
491 /* Return endianess of the emulated CPU (CPU_LSB_FIRST or CPU_MSB_FIRST) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
492 unsigned cpunum_endianess(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
493 /* Return opcode align unit (1 byte, 2 word, 4 dword) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
494 unsigned cpunum_align_unit(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
495 /* Return maximum instruction length */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
496 unsigned cpunum_max_inst_len(int cputype);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
497
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
498 /* Get a register value for the specified CPU number of the running machine */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
499 unsigned cpunum_get_reg(int cpunum, int regnum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
500 /* Set a register value for the specified CPU number of the running machine */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
501 void cpunum_set_reg(int cpunum, int regnum, unsigned val);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
502
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
503 /* Return (debugger) register layout definition for the CPU core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
504 const char *cpunum_reg_layout(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
505 /* Return (debugger) window layout definition for the CPU core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
506 const char *cpunum_win_layout(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
507
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
508 unsigned cpunum_dasm(int cpunum,char *buffer,unsigned pc);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
509 /* Return a string describing the currently set flag (status) bits of the CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
510 const char *cpunum_flags(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
511 /* Return a string with a register name and value */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
512 /* regnum is a value defined in the CPU cores header files */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
513 const char *cpunum_dump_reg(int cpunum, int regnum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
514 /* Return a string describing the CPUs current state */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
515 const char *cpunum_dump_state(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
516 /* Return a name for the specified cpu number */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
517 const char *cpunum_name(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
518 /* Return a family name for the specified cpu number */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
519 const char *cpunum_core_family(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
520 /* Return a version for the specified cpu number */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
521 const char *cpunum_core_version(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
522 /* Return a the source filename for the specified cpu number */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
523 const char *cpunum_core_file(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
524 /* Return a the credits for the specified cpu number */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
525 const char *cpunum_core_credits(int cpunum);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
526
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
527 /* Dump all of the running machines CPUs state to stderr */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
528 void cpu_dump_states(void);
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
529
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
530 /* daisy-chain link */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
531 typedef struct {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
532 void (*reset)(int); /* reset callback */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
533 int (*interrupt_entry)(int); /* entry callback */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
534 void (*interrupt_reti)(int); /* reti callback */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
535 int irq_param; /* callback paramater */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
536 } Z80_DaisyChain;
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
537
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
538 #define Z80_MAXDAISY 4 /* maximum of daisy chan device */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
539
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
540 #define Z80_INT_REQ 0x01 /* interrupt request mask */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
541 #define Z80_INT_IEO 0x02 /* interrupt disable mask(IEO) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
542
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
543 #define Z80_VECTOR(device,state) (((device)<<8)|(state))
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
544
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
545 #ifndef INLINE
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
546 #define INLINE inline
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
547 #endif
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
548
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
549 #include <string.h>
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
550 #include <stdlib.h>
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
551 #include <stdio.h>
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
552
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
553 #define cpu_readmem16 memory_read
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
554 #define cpu_readport16 memory_readport
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
555 #define cpu_writeport16 memory_writeport
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
556 #define cpu_writemem16 memory_write
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
557 #define cpu_readop memory_readop
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
558 #define cpu_readop_arg memory_read
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
559 #define logerror(x, ...)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
560 #define change_pc16(x)
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
561 #define CALL_MAME_DEBUG
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
562
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
563 #define ADDRESS_SPACES 3 /* maximum number of address spaces */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
564 #define ADDRESS_SPACE_PROGRAM 0 /* program address space */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
565 #define ADDRESS_SPACE_DATA 1 /* data address space */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
566 #define ADDRESS_SPACE_IO 2 /* I/O address space */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
567
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
568 enum
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
569 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
570 /* internal flags (not for use by drivers!) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
571 INTERNAL_CLEAR_LINE = 100 + CLEAR_LINE,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
572 INTERNAL_ASSERT_LINE = 100 + ASSERT_LINE,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
573
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
574 /* input lines */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
575 MAX_INPUT_LINES = 32+3,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
576 INPUT_LINE_IRQ0 = 0,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
577 INPUT_LINE_IRQ1 = 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
578 INPUT_LINE_IRQ2 = 2,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
579 INPUT_LINE_IRQ3 = 3,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
580 INPUT_LINE_IRQ4 = 4,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
581 INPUT_LINE_IRQ5 = 5,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
582 INPUT_LINE_IRQ6 = 6,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
583 INPUT_LINE_IRQ7 = 7,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
584 INPUT_LINE_IRQ8 = 8,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
585 INPUT_LINE_IRQ9 = 9,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
586 INPUT_LINE_NMI = MAX_INPUT_LINES - 3,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
587
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
588 /* special input lines that are implemented in the core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
589 INPUT_LINE_RESET = MAX_INPUT_LINES - 2,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
590 INPUT_LINE_HALT = MAX_INPUT_LINES - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
591
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
592 /* output lines */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
593 MAX_OUTPUT_LINES = 32
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
594 };
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
595
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
596 enum
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
597 {
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
598 /* --- the following bits of info are returned as 64-bit signed integers --- */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
599 CPUINFO_INT_FIRST = 0x00000,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
600
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
601 CPUINFO_INT_CONTEXT_SIZE = CPUINFO_INT_FIRST, /* R/O: size of CPU context in bytes */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
602 CPUINFO_INT_INPUT_LINES, /* R/O: number of input lines */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
603 CPUINFO_INT_OUTPUT_LINES, /* R/O: number of output lines */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
604 CPUINFO_INT_DEFAULT_IRQ_VECTOR, /* R/O: default IRQ vector */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
605 CPUINFO_INT_ENDIANNESS, /* R/O: either CPU_IS_BE or CPU_IS_LE */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
606 CPUINFO_INT_CLOCK_DIVIDER, /* R/O: internal clock divider */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
607 CPUINFO_INT_MIN_INSTRUCTION_BYTES, /* R/O: minimum bytes per instruction */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
608 CPUINFO_INT_MAX_INSTRUCTION_BYTES, /* R/O: maximum bytes per instruction */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
609 CPUINFO_INT_MIN_CYCLES, /* R/O: minimum cycles for a single instruction */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
610 CPUINFO_INT_MAX_CYCLES, /* R/O: maximum cycles for a single instruction */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
611
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
612 CPUINFO_INT_DATABUS_WIDTH, /* R/O: data bus size for each address space (8,16,32,64) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
613 CPUINFO_INT_DATABUS_WIDTH_LAST = CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACES - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
614 CPUINFO_INT_ADDRBUS_WIDTH, /* R/O: address bus size for each address space (12-32) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
615 CPUINFO_INT_ADDRBUS_WIDTH_LAST = CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACES - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
616 CPUINFO_INT_ADDRBUS_SHIFT, /* R/O: shift applied to addresses each address space (+3 means >>3, -1 means <<1) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
617 CPUINFO_INT_ADDRBUS_SHIFT_LAST = CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACES - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
618
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
619 CPUINFO_INT_SP, /* R/W: the current stack pointer value */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
620 CPUINFO_INT_PC, /* R/W: the current PC value */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
621 CPUINFO_INT_PREVIOUSPC, /* R/W: the previous PC value */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
622 CPUINFO_INT_INPUT_STATE, /* R/W: states for each input line */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
623 CPUINFO_INT_INPUT_STATE_LAST = CPUINFO_INT_INPUT_STATE + MAX_INPUT_LINES - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
624 CPUINFO_INT_OUTPUT_STATE, /* R/W: states for each output line */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
625 CPUINFO_INT_OUTPUT_STATE_LAST = CPUINFO_INT_OUTPUT_STATE + MAX_OUTPUT_LINES - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
626 CPUINFO_INT_REGISTER, /* R/W: values of up to MAX_REGs registers */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
627 CPUINFO_INT_REGISTER_LAST = CPUINFO_INT_REGISTER + MAX_REGS - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
628
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
629 CPUINFO_INT_CPU_SPECIFIC = 0x08000, /* R/W: CPU-specific values start here */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
630
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
631 /* --- the following bits of info are returned as pointers to data or functions --- */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
632 CPUINFO_PTR_FIRST = 0x10000,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
633
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
634 CPUINFO_PTR_SET_INFO = CPUINFO_PTR_FIRST, /* R/O: void (*set_info)(UINT32 state, INT64 data, void *ptr) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
635 CPUINFO_PTR_GET_CONTEXT, /* R/O: void (*get_context)(void *buffer) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
636 CPUINFO_PTR_SET_CONTEXT, /* R/O: void (*set_context)(void *buffer) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
637 CPUINFO_PTR_INIT, /* R/O: void (*init)(void) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
638 CPUINFO_PTR_RESET, /* R/O: void (*reset)(void *param) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
639 CPUINFO_PTR_EXIT, /* R/O: void (*exit)(void) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
640 CPUINFO_PTR_EXECUTE, /* R/O: int (*execute)(int cycles) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
641 CPUINFO_PTR_BURN, /* R/O: void (*burn)(int cycles) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
642 CPUINFO_PTR_DISASSEMBLE, /* R/O: void (*disassemble)(char *buffer, offs_t pc) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
643 CPUINFO_PTR_IRQ_CALLBACK, /* R/W: int (*irqcallback)(int state) */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
644 CPUINFO_PTR_INSTRUCTION_COUNTER, /* R/O: int *icount */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
645 CPUINFO_PTR_REGISTER_LAYOUT, /* R/O: struct debug_register_layout *layout */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
646 CPUINFO_PTR_WINDOW_LAYOUT, /* R/O: struct debug_window_layout *layout */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
647 CPUINFO_PTR_INTERNAL_MEMORY_MAP, /* R/O: construct_map_t map */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
648 CPUINFO_PTR_INTERNAL_MEMORY_MAP_LAST = CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACES - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
649 CPUINFO_PTR_DEBUG_REGISTER_LIST, /* R/O: int *list: list of registers for NEW_DEBUGGER */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
650
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
651 CPUINFO_PTR_CPU_SPECIFIC = 0x18000, /* R/W: CPU-specific values start here */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
652
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
653 /* --- the following bits of info are returned as NULL-terminated strings --- */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
654 CPUINFO_STR_FIRST = 0x20000,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
655
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
656 CPUINFO_STR_NAME = CPUINFO_STR_FIRST, /* R/O: name of the CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
657 CPUINFO_STR_CORE_FAMILY, /* R/O: family of the CPU */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
658 CPUINFO_STR_CORE_VERSION, /* R/O: version of the CPU core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
659 CPUINFO_STR_CORE_FILE, /* R/O: file containing the CPU core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
660 CPUINFO_STR_CORE_CREDITS, /* R/O: credits for the CPU core */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
661 CPUINFO_STR_FLAGS, /* R/O: string representation of the main flags value */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
662 CPUINFO_STR_REGISTER, /* R/O: string representation of up to MAX_REGs registers */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
663 CPUINFO_STR_REGISTER_LAST = CPUINFO_STR_REGISTER + MAX_REGS - 1,
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
664
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
665 CPUINFO_STR_CPU_SPECIFIC = 0x28000 /* R/W: CPU-specific values start here */
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
666 };
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
667
62cc6d667119 Import a bunch of stuff for new psf2 plugin.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
668 #endif /* CPUINTRF_H */