1 |
/* |
2 |
* emul_op.h - 68k opcodes for ROM patches |
3 |
* |
4 |
* SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
#ifndef EMUL_OP_H |
22 |
#define EMUL_OP_H |
23 |
|
24 |
// PowerPC opcodes |
25 |
const uint32 POWERPC_NOP = 0x60000000; |
26 |
const uint32 POWERPC_ILLEGAL = 0x00000000; |
27 |
const uint32 POWERPC_BLR = 0x4e800020; |
28 |
const uint32 POWERPC_BCTR = 0x4e800420; |
29 |
const uint32 POWERPC_EMUL_OP = 0x18000000; // Base opcode for EMUL_OP opcodes (only used with PPC emulation) |
30 |
|
31 |
enum { // Selectors for NATIVE_EXEC callbacks (only used with PPC emulation) |
32 |
NATIVE_PATCH_NAME_REGISTRY, |
33 |
NATIVE_VIDEO_INSTALL_ACCEL, |
34 |
NATIVE_VIDEO_VBL, |
35 |
NATIVE_VIDEO_DO_DRIVER_IO, |
36 |
NATIVE_ETHER_IRQ, |
37 |
NATIVE_ETHER_INIT, |
38 |
NATIVE_ETHER_TERM, |
39 |
NATIVE_ETHER_OPEN, |
40 |
NATIVE_ETHER_CLOSE, |
41 |
NATIVE_ETHER_WPUT, |
42 |
NATIVE_ETHER_RSRV, |
43 |
NATIVE_SERIAL_NOTHING, |
44 |
NATIVE_SERIAL_OPEN, |
45 |
NATIVE_SERIAL_PRIME_IN, |
46 |
NATIVE_SERIAL_PRIME_OUT, |
47 |
NATIVE_SERIAL_CONTROL, |
48 |
NATIVE_SERIAL_STATUS, |
49 |
NATIVE_SERIAL_CLOSE, |
50 |
NATIVE_GET_RESOURCE, |
51 |
NATIVE_GET_1_RESOURCE, |
52 |
NATIVE_GET_IND_RESOURCE, |
53 |
NATIVE_GET_1_IND_RESOURCE, |
54 |
NATIVE_R_GET_RESOURCE, |
55 |
NATIVE_DISABLE_INTERRUPT, |
56 |
NATIVE_ENABLE_INTERRUPT, |
57 |
NATIVE_OP_MAX |
58 |
}; |
59 |
#define POWERPC_NATIVE_OP(SELECTOR) NativeOpTable[SELECTOR] |
60 |
#define POWERPC_NATIVE_OP_FUNC(SELECTOR) ((uint32)(uintptr)&POWERPC_NATIVE_OP(SELECTOR)) |
61 |
extern const uint32 NativeOpTable[NATIVE_OP_MAX]; |
62 |
|
63 |
// 68k opcodes |
64 |
const uint16 M68K_ILLEGAL = 0x4afc; |
65 |
const uint16 M68K_NOP = 0x4e71; |
66 |
const uint16 M68K_RTS = 0x4e75; |
67 |
const uint16 M68K_RTD = 0x4e74; |
68 |
const uint16 M68K_JMP = 0x4ef9; |
69 |
const uint16 M68K_JMP_A0 = 0x4ed0; |
70 |
const uint16 M68K_JSR = 0x4eb9; |
71 |
const uint16 M68K_JSR_A0 = 0x4e90; |
72 |
enum { // Selectors for EMUL_OP opcodes |
73 |
OP_BREAK, OP_XPRAM1, OP_XPRAM2, OP_XPRAM3, OP_NVRAM1, OP_NVRAM2, OP_NVRAM3, |
74 |
OP_FIX_MEMTOP, OP_FIX_MEMSIZE, OP_FIX_BOOTSTACK, |
75 |
OP_SONY_OPEN, OP_SONY_PRIME, OP_SONY_CONTROL, OP_SONY_STATUS, |
76 |
OP_DISK_OPEN, OP_DISK_PRIME, OP_DISK_CONTROL, OP_DISK_STATUS, |
77 |
OP_CDROM_OPEN, OP_CDROM_PRIME, OP_CDROM_CONTROL, OP_CDROM_STATUS, |
78 |
OP_AUDIO_DISPATCH, OP_SOUNDIN_OPEN, OP_SOUNDIN_PRIME, OP_SOUNDIN_CONTROL, OP_SOUNDIN_STATUS, OP_SOUNDIN_CLOSE, |
79 |
OP_ADBOP, OP_INSTIME, OP_RMVTIME, OP_PRIMETIME, OP_MICROSECONDS, OP_PUT_SCRAP, OP_GET_SCRAP, |
80 |
OP_DEBUG_STR, OP_INSTALL_DRIVERS, OP_NAME_REGISTRY, OP_RESET, OP_IRQ, |
81 |
OP_SCSI_DISPATCH, OP_SCSI_ATOMIC, |
82 |
OP_NTRB_17_PATCH, OP_NTRB_17_PATCH2, OP_NTRB_17_PATCH3, OP_CHECKLOAD, |
83 |
OP_EXTFS_COMM, OP_EXTFS_HFS, OP_IDLE_TIME, |
84 |
OP_MAX |
85 |
}; |
86 |
const uint16 M68K_EMUL_RETURN = 0xfe40; // Extended opcodes |
87 |
const uint16 M68K_EXEC_RETURN = 0xfe41; |
88 |
const uint16 M68K_EXEC_NATIVE = 0xfe42; |
89 |
const uint16 M68K_EMUL_BREAK = 0xfe43; |
90 |
const uint16 M68K_EMUL_OP_XPRAM1 = M68K_EMUL_BREAK + OP_XPRAM1; |
91 |
const uint16 M68K_EMUL_OP_XPRAM2 = M68K_EMUL_BREAK + OP_XPRAM2; |
92 |
const uint16 M68K_EMUL_OP_XPRAM3 = M68K_EMUL_BREAK + OP_XPRAM3; |
93 |
const uint16 M68K_EMUL_OP_NVRAM1 = M68K_EMUL_BREAK + OP_NVRAM1; |
94 |
const uint16 M68K_EMUL_OP_NVRAM2 = M68K_EMUL_BREAK + OP_NVRAM2; |
95 |
const uint16 M68K_EMUL_OP_NVRAM3 = M68K_EMUL_BREAK + OP_NVRAM3; |
96 |
const uint16 M68K_EMUL_OP_FIX_MEMTOP = M68K_EMUL_BREAK + OP_FIX_MEMTOP; |
97 |
const uint16 M68K_EMUL_OP_FIX_MEMSIZE = M68K_EMUL_BREAK + OP_FIX_MEMSIZE; |
98 |
const uint16 M68K_EMUL_OP_FIX_BOOTSTACK = M68K_EMUL_BREAK + OP_FIX_BOOTSTACK; |
99 |
const uint16 M68K_EMUL_OP_SONY_OPEN = M68K_EMUL_BREAK + OP_SONY_OPEN; |
100 |
const uint16 M68K_EMUL_OP_SONY_PRIME = M68K_EMUL_BREAK + OP_SONY_PRIME; |
101 |
const uint16 M68K_EMUL_OP_SONY_CONTROL = M68K_EMUL_BREAK + OP_SONY_CONTROL; |
102 |
const uint16 M68K_EMUL_OP_SONY_STATUS = M68K_EMUL_BREAK + OP_SONY_STATUS; |
103 |
const uint16 M68K_EMUL_OP_DISK_OPEN = M68K_EMUL_BREAK + OP_DISK_OPEN; |
104 |
const uint16 M68K_EMUL_OP_DISK_PRIME = M68K_EMUL_BREAK + OP_DISK_PRIME; |
105 |
const uint16 M68K_EMUL_OP_DISK_CONTROL = M68K_EMUL_BREAK + OP_DISK_CONTROL; |
106 |
const uint16 M68K_EMUL_OP_DISK_STATUS = M68K_EMUL_BREAK + OP_DISK_STATUS; |
107 |
const uint16 M68K_EMUL_OP_CDROM_OPEN = M68K_EMUL_BREAK + OP_CDROM_OPEN; |
108 |
const uint16 M68K_EMUL_OP_CDROM_PRIME = M68K_EMUL_BREAK + OP_CDROM_PRIME; |
109 |
const uint16 M68K_EMUL_OP_CDROM_CONTROL = M68K_EMUL_BREAK + OP_CDROM_CONTROL; |
110 |
const uint16 M68K_EMUL_OP_CDROM_STATUS = M68K_EMUL_BREAK + OP_CDROM_STATUS; |
111 |
const uint16 M68K_EMUL_OP_AUDIO_DISPATCH = M68K_EMUL_BREAK + OP_AUDIO_DISPATCH; |
112 |
const uint16 M68K_EMUL_OP_SOUNDIN_OPEN = M68K_EMUL_BREAK + OP_SOUNDIN_OPEN; |
113 |
const uint16 M68K_EMUL_OP_SOUNDIN_CLOSE = M68K_EMUL_BREAK + OP_SOUNDIN_CLOSE; |
114 |
const uint16 M68K_EMUL_OP_SOUNDIN_PRIME = M68K_EMUL_BREAK + OP_SOUNDIN_PRIME; |
115 |
const uint16 M68K_EMUL_OP_SOUNDIN_CONTROL = M68K_EMUL_BREAK + OP_SOUNDIN_CONTROL; |
116 |
const uint16 M68K_EMUL_OP_SOUNDIN_STATUS = M68K_EMUL_BREAK + OP_SOUNDIN_STATUS; |
117 |
const uint16 M68K_EMUL_OP_ADBOP = M68K_EMUL_BREAK + OP_ADBOP; |
118 |
const uint16 M68K_EMUL_OP_INSTIME = M68K_EMUL_BREAK + OP_INSTIME; |
119 |
const uint16 M68K_EMUL_OP_RMVTIME = M68K_EMUL_BREAK + OP_RMVTIME; |
120 |
const uint16 M68K_EMUL_OP_PRIMETIME = M68K_EMUL_BREAK + OP_PRIMETIME; |
121 |
const uint16 M68K_EMUL_OP_MICROSECONDS = M68K_EMUL_BREAK + OP_MICROSECONDS; |
122 |
const uint16 M68K_EMUL_OP_PUT_SCRAP = M68K_EMUL_BREAK + OP_PUT_SCRAP; |
123 |
const uint16 M68K_EMUL_OP_GET_SCRAP = M68K_EMUL_BREAK + OP_GET_SCRAP; |
124 |
const uint16 M68K_EMUL_OP_DEBUG_STR = M68K_EMUL_BREAK + OP_DEBUG_STR; |
125 |
const uint16 M68K_EMUL_OP_INSTALL_DRIVERS = M68K_EMUL_BREAK + OP_INSTALL_DRIVERS; |
126 |
const uint16 M68K_EMUL_OP_NAME_REGISTRY = M68K_EMUL_BREAK + OP_NAME_REGISTRY; |
127 |
const uint16 M68K_EMUL_OP_RESET = M68K_EMUL_BREAK + OP_RESET; |
128 |
const uint16 M68K_EMUL_OP_IRQ = M68K_EMUL_BREAK + OP_IRQ; |
129 |
const uint16 M68K_EMUL_OP_SCSI_DISPATCH = M68K_EMUL_BREAK + OP_SCSI_DISPATCH; |
130 |
const uint16 M68K_EMUL_OP_SCSI_ATOMIC = M68K_EMUL_BREAK + OP_SCSI_ATOMIC; |
131 |
const uint16 M68K_EMUL_OP_NTRB_17_PATCH = M68K_EMUL_BREAK + OP_NTRB_17_PATCH; |
132 |
const uint16 M68K_EMUL_OP_NTRB_17_PATCH2 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH2; |
133 |
const uint16 M68K_EMUL_OP_NTRB_17_PATCH3 = M68K_EMUL_BREAK + OP_NTRB_17_PATCH3; |
134 |
const uint16 M68K_EMUL_OP_CHECKLOAD = M68K_EMUL_BREAK + OP_CHECKLOAD; |
135 |
const uint16 M68K_EMUL_OP_EXTFS_COMM = M68K_EMUL_BREAK + OP_EXTFS_COMM; |
136 |
const uint16 M68K_EMUL_OP_EXTFS_HFS = M68K_EMUL_BREAK + OP_EXTFS_HFS; |
137 |
const uint16 M68K_EMUL_OP_IDLE_TIME = M68K_EMUL_BREAK + OP_IDLE_TIME; |
138 |
|
139 |
extern "C" void EmulOp(M68kRegisters *r, uint32 pc, int selector); |
140 |
|
141 |
#endif |