ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/emul_op.cpp
Revision: 1.32
Committed: 2005-01-30T21:42:13Z (19 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.31: +1 -1 lines
Log Message:
Happy New Year!

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * emul_op.cpp - 68k opcodes for ROM patches
3     *
4 gbeauche 1.32 * Basilisk II (C) 1997-2005 Christian Bauer
5 cebix 1.1 *
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     #include <string.h>
22     #include <stdio.h>
23    
24     #include "sysdeps.h"
25     #include "cpu_emulation.h"
26     #include "main.h"
27     #include "macos_util.h"
28     #include "rom_patches.h"
29     #include "rsrc_patches.h"
30     #include "xpram.h"
31     #include "adb.h"
32     #include "timer.h"
33     #include "clip.h"
34     #include "serial.h"
35     #include "sony.h"
36     #include "disk.h"
37     #include "cdrom.h"
38     #include "scsi.h"
39     #include "video.h"
40     #include "audio.h"
41     #include "ether.h"
42 cebix 1.4 #include "extfs.h"
43 cebix 1.1 #include "emul_op.h"
44    
45 cebix 1.16 #ifdef ENABLE_MON
46 cebix 1.8 #include "mon.h"
47     #endif
48    
49 cebix 1.1 #define DEBUG 0
50     #include "debug.h"
51    
52    
53     /*
54     * Execute EMUL_OP opcode (called by 68k emulator or Illegal Instruction trap handler)
55     */
56    
57     void EmulOp(uint16 opcode, M68kRegisters *r)
58     {
59     D(bug("EmulOp %04x\n", opcode));
60     switch (opcode) {
61     case M68K_EMUL_BREAK: { // Breakpoint
62     printf("*** Breakpoint\n");
63 cebix 1.27 printf("d0 %08x d1 %08x d2 %08x d3 %08x\n"
64     "d4 %08x d5 %08x d6 %08x d7 %08x\n"
65     "a0 %08x a1 %08x a2 %08x a3 %08x\n"
66     "a4 %08x a5 %08x a6 %08x a7 %08x\n"
67 cebix 1.1 "sr %04x\n",
68     r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7],
69     r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
70     r->sr);
71 cebix 1.25 VideoQuitFullScreen();
72 cebix 1.16 #ifdef ENABLE_MON
73 cebix 1.20 char *arg[4] = {"mon", "-m", "-r", NULL};
74     mon(3, arg);
75 cebix 1.8 #endif
76 cebix 1.1 QuitEmulator();
77     break;
78     }
79    
80     case M68K_EMUL_OP_SHUTDOWN: // Quit emulator
81     QuitEmulator();
82     break;
83    
84     case M68K_EMUL_OP_RESET: { // MacOS reset
85     D(bug("*** RESET ***\n"));
86     TimerReset();
87     EtherReset();
88 cebix 1.14 AudioReset();
89 cebix 1.1
90     // Create BootGlobs at top of memory
91 cebix 1.12 Mac_memset(RAMBaseMac + RAMSize - 4096, 0, 4096);
92 cebix 1.1 uint32 boot_globs = RAMBaseMac + RAMSize - 0x1c;
93     WriteMacInt32(boot_globs + 0x00, RAMBaseMac); // First RAM bank
94     WriteMacInt32(boot_globs + 0x04, RAMSize);
95     WriteMacInt32(boot_globs + 0x08, 0xffffffff); // End of bank table
96     WriteMacInt32(boot_globs + 0x0c, 0);
97    
98     // Setup registers for boot routine
99     r->d[0] = ReadMacInt32(ROMBaseMac + UniversalInfo + 0x18); // AddrMapFlags
100     r->d[1] = ReadMacInt32(ROMBaseMac + UniversalInfo + 0x1c); // UnivROMFlags
101     r->d[2] = ReadMacInt32(ROMBaseMac + UniversalInfo + 0x10); // HWCfgFlags/IDs
102     if (FPUType)
103     r->d[2] |= 0x10000000; // Set FPU flag if FPU present
104     else
105     r->d[2] &= 0xefffffff; // Clear FPU flag if no FPU present
106     r->a[0] = ROMBaseMac + UniversalInfo + ReadMacInt32(ROMBaseMac + UniversalInfo);// AddrMap
107     r->a[1] = ROMBaseMac + UniversalInfo; // UniversalInfo
108     r->a[6] = boot_globs; // BootGlobs
109     r->a[7] = RAMBaseMac + 0x10000; // Boot stack
110     break;
111     }
112    
113     case M68K_EMUL_OP_CLKNOMEM: { // Clock/PRAM operations
114     bool is_read = r->d[1] & 0x80;
115     if ((r->d[1] & 0x78) == 0x38) {
116     // XPRAM
117     uint8 reg = (r->d[1] << 5) & 0xe0 | (r->d[1] >> 10) & 0x1f;
118     if (is_read) {
119     r->d[2] = XPRAM[reg];
120     bool localtalk = !(XPRAM[0xe0] || XPRAM[0xe1]); // LocalTalk enabled?
121     switch (reg) {
122     case 0x08:
123     if (ROMVersion != ROM_VERSION_32)
124     r->d[2] &= 0xf8;
125     break;
126     case 0x8a:
127     r->d[2] |= 0x05; // 32bit mode is always enabled
128     break;
129     case 0xe0: // Disable LocalTalk (use EtherTalk instead)
130     if (localtalk)
131     r->d[2] = 0x00;
132     break;
133     case 0xe1:
134     if (localtalk)
135     r->d[2] = 0xf1;
136     break;
137     case 0xe2:
138     if (localtalk)
139     r->d[2] = 0x00;
140     break;
141     case 0xe3:
142     if (localtalk)
143     r->d[2] = 0x0a;
144     break;
145     }
146     D(bug("Read XPRAM %02x->%02lx\n", reg, r->d[2]));
147     } else {
148     D(bug("Write XPRAM %02x<-%02lx\n", reg, r->d[2] & 0xff));
149     if (reg == 0x8a && !TwentyFourBitAddressing)
150     r->d[2] |= 0x05; // 32bit mode is always enabled if possible
151     XPRAM[reg] = r->d[2];
152     }
153     } else {
154     // PRAM, RTC and other clock registers
155     uint8 reg = (r->d[1] >> 2) & 0x1f;
156     if (reg >= 0x10 || (reg >= 0x08 && reg < 0x0c)) {
157     if (is_read) {
158     r->d[2] = XPRAM[reg];
159     D(bug("Read XPRAM %02x->%02x\n", reg, XPRAM[reg]));
160     } else {
161     D(bug("Write PRAM %02x<-%02lx\n", reg, r->d[2]));
162     XPRAM[reg] = r->d[2];
163     }
164     } else if (reg < 0x08 && is_read) {
165     uint32 t = TimerDateTime();
166 cebix 1.2 uint8 b = t;
167 cebix 1.1 switch (reg & 3) {
168     case 1: b = t >> 8; break;
169     case 2: b = t >> 16; break;
170     case 3: b = t >> 24; break;
171     }
172     r->d[2] = b;
173     } else
174     D(bug("RTC %s op %d, d1 %08lx d2 %08lx\n", is_read ? "read" : "write", reg, r->d[1], r->d[2]));
175     }
176     r->d[0] = 0;
177     r->d[1] = r->d[2];
178     break;
179     }
180    
181     case M68K_EMUL_OP_READ_XPRAM: // Read from XPRAM (ROM10/11)
182     D(bug("Read XPRAM %02lx\n", r->d[1]));
183     r->d[1] = XPRAM[r->d[1] & 0xff];
184     break;
185    
186     case M68K_EMUL_OP_READ_XPRAM2: // Read from XPRAM (ROM15)
187     D(bug("Read XPRAM %02lx\n", r->d[0]));
188     r->d[0] = XPRAM[r->d[0] & 0xff];
189     break;
190    
191     case M68K_EMUL_OP_PATCH_BOOT_GLOBS: // Patch BootGlobs at startup
192     D(bug("Patch BootGlobs\n"));
193     WriteMacInt32(r->a[4] - 20, RAMBaseMac + RAMSize); // MemTop
194     WriteMacInt8(r->a[4] - 26, 0); // No MMU
195     WriteMacInt8(r->a[4] - 25, ReadMacInt8(r->a[4] - 25) | 1); // No MMU
196     r->a[6] = RAMBaseMac + RAMSize;
197     break;
198    
199     case M68K_EMUL_OP_FIX_BOOTSTACK: // Set boot stack to 3/4 of RAM (7.5)
200     r->a[1] = RAMBaseMac + RAMSize * 3 / 4;
201 cebix 1.16 D(bug("Fix boot stack %08x\n", r->a[1]));
202 cebix 1.1 break;
203    
204     case M68K_EMUL_OP_FIX_MEMSIZE: { // Set correct logical and physical memory size
205     D(bug("Fix MemSize\n"));
206     uint32 diff = ReadMacInt32(0x1ef8) - ReadMacInt32(0x1ef4); // Difference between logical and physical size
207     WriteMacInt32(0x1ef8, RAMSize); // Physical RAM size
208     WriteMacInt32(0x1ef4, RAMSize - diff); // Logical RAM size
209     break;
210     }
211    
212     case M68K_EMUL_OP_ADBOP: // ADBOp() replacement
213     ADBOp(r->d[0], Mac2HostAddr(ReadMacInt32(r->a[0])));
214     break;
215    
216     case M68K_EMUL_OP_INSTIME: // InsTime() replacement
217     r->d[0] = InsTime(r->a[0], r->d[1]);
218     break;
219    
220     case M68K_EMUL_OP_RMVTIME: // RmvTime() replacement
221     r->d[0] = RmvTime(r->a[0]);
222     break;
223    
224     case M68K_EMUL_OP_PRIMETIME: // PrimeTime() replacement
225     r->d[0] = PrimeTime(r->a[0], r->d[0]);
226     break;
227    
228     case M68K_EMUL_OP_MICROSECONDS: // Microseconds() replacement
229     Microseconds(r->a[0], r->d[0]);
230     break;
231    
232     case M68K_EMUL_OP_INSTALL_DRIVERS: {// Patch to install our own drivers during startup
233     // Install drivers
234     D(bug("InstallDrivers\n"));
235     InstallDrivers(r->a[0]);
236    
237     // Install PutScrap() patch
238     M68kRegisters r;
239     r.d[0] = 0xa9fe;
240     r.a[0] = PutScrapPatch;
241     Execute68kTrap(0xa647, &r); // SetToolTrap()
242    
243 gbeauche 1.31 // Install GetScrap() patch
244     if (GetScrapPatch) {
245     r.d[0] = 0xa9fd;
246     r.a[0] = GetScrapPatch;
247     Execute68kTrap(0xa647, &r); // SetToolTrap()
248     }
249    
250 cebix 1.1 // Setup fake ASC registers
251     if (ROMVersion == ROM_VERSION_32) {
252     r.d[0] = 0x1000;
253     Execute68kTrap(0xa71e, &r); // NewPtrSysClear()
254     uint32 asc_regs = r.a[0];
255     D(bug("ASC registers at %08lx\n", asc_regs));
256     WriteMacInt8(asc_regs + 0x800, 0x0f); // Set ASC version number
257     WriteMacInt32(0xcc0, asc_regs); // Set ASCBase
258     }
259     break;
260     }
261    
262     case M68K_EMUL_OP_SERD: // Install serial drivers
263     D(bug("InstallSERD\n"));
264     InstallSERD();
265     break;
266    
267     case M68K_EMUL_OP_SONY_OPEN: // Floppy driver functions
268     r->d[0] = SonyOpen(r->a[0], r->a[1]);
269     break;
270    
271     case M68K_EMUL_OP_SONY_PRIME:
272     r->d[0] = SonyPrime(r->a[0], r->a[1]);
273     break;
274    
275     case M68K_EMUL_OP_SONY_CONTROL:
276     r->d[0] = SonyControl(r->a[0], r->a[1]);
277     break;
278    
279     case M68K_EMUL_OP_SONY_STATUS:
280     r->d[0] = SonyStatus(r->a[0], r->a[1]);
281     break;
282    
283     case M68K_EMUL_OP_DISK_OPEN: // Disk driver functions
284     r->d[0] = DiskOpen(r->a[0], r->a[1]);
285     break;
286    
287     case M68K_EMUL_OP_DISK_PRIME:
288     r->d[0] = DiskPrime(r->a[0], r->a[1]);
289     break;
290    
291     case M68K_EMUL_OP_DISK_CONTROL:
292     r->d[0] = DiskControl(r->a[0], r->a[1]);
293     break;
294    
295     case M68K_EMUL_OP_DISK_STATUS:
296     r->d[0] = DiskStatus(r->a[0], r->a[1]);
297     break;
298    
299     case M68K_EMUL_OP_CDROM_OPEN: // CD-ROM driver functions
300     r->d[0] = CDROMOpen(r->a[0], r->a[1]);
301     break;
302    
303     case M68K_EMUL_OP_CDROM_PRIME:
304     r->d[0] = CDROMPrime(r->a[0], r->a[1]);
305     break;
306    
307     case M68K_EMUL_OP_CDROM_CONTROL:
308     r->d[0] = CDROMControl(r->a[0], r->a[1]);
309     break;
310    
311     case M68K_EMUL_OP_CDROM_STATUS:
312     r->d[0] = CDROMStatus(r->a[0], r->a[1]);
313     break;
314    
315     case M68K_EMUL_OP_VIDEO_OPEN: // Video driver functions
316 cebix 1.5 r->d[0] = VideoDriverOpen(r->a[0], r->a[1]);
317 cebix 1.1 break;
318    
319     case M68K_EMUL_OP_VIDEO_CONTROL:
320 cebix 1.5 r->d[0] = VideoDriverControl(r->a[0], r->a[1]);
321 cebix 1.1 break;
322    
323     case M68K_EMUL_OP_VIDEO_STATUS:
324 cebix 1.5 r->d[0] = VideoDriverStatus(r->a[0], r->a[1]);
325 cebix 1.1 break;
326    
327     case M68K_EMUL_OP_SERIAL_OPEN: // Serial driver functions
328     r->d[0] = SerialOpen(r->a[0], r->a[1], r->d[0]);
329     break;
330    
331     case M68K_EMUL_OP_SERIAL_PRIME:
332     r->d[0] = SerialPrime(r->a[0], r->a[1], r->d[0]);
333     break;
334    
335     case M68K_EMUL_OP_SERIAL_CONTROL:
336     r->d[0] = SerialControl(r->a[0], r->a[1], r->d[0]);
337     break;
338    
339     case M68K_EMUL_OP_SERIAL_STATUS:
340     r->d[0] = SerialStatus(r->a[0], r->a[1], r->d[0]);
341     break;
342    
343     case M68K_EMUL_OP_SERIAL_CLOSE:
344     r->d[0] = SerialClose(r->a[0], r->a[1], r->d[0]);
345     break;
346    
347     case M68K_EMUL_OP_ETHER_OPEN: // Ethernet driver functions
348     r->d[0] = EtherOpen(r->a[0], r->a[1]);
349     break;
350    
351     case M68K_EMUL_OP_ETHER_CONTROL:
352     r->d[0] = EtherControl(r->a[0], r->a[1]);
353     break;
354    
355     case M68K_EMUL_OP_ETHER_READ_PACKET:
356     EtherReadPacket((uint8 **)&r->a[0], r->a[3], r->d[3], r->d[1]);
357     break;
358    
359 cebix 1.18 case M68K_EMUL_OP_SOUNDIN_OPEN: // Sound input driver functions
360     r->d[0] = SoundInOpen(r->a[0], r->a[1]);
361     break;
362    
363     case M68K_EMUL_OP_SOUNDIN_PRIME:
364     r->d[0] = SoundInPrime(r->a[0], r->a[1]);
365     break;
366    
367     case M68K_EMUL_OP_SOUNDIN_CONTROL:
368     r->d[0] = SoundInControl(r->a[0], r->a[1]);
369     break;
370    
371     case M68K_EMUL_OP_SOUNDIN_STATUS:
372     r->d[0] = SoundInStatus(r->a[0], r->a[1]);
373     break;
374    
375     case M68K_EMUL_OP_SOUNDIN_CLOSE:
376     r->d[0] = SoundInClose(r->a[0], r->a[1]);
377     break;
378    
379 cebix 1.1 case M68K_EMUL_OP_SCSI_DISPATCH: { // SCSIDispatch() replacement
380     uint32 ret = ReadMacInt32(r->a[7]); // Get return address
381     uint16 sel = ReadMacInt16(r->a[7] + 4); // Get selector
382     r->a[7] += 6;
383     int stack = 0;
384     switch (sel) {
385     case 0: // SCSIReset
386     WriteMacInt16(r->a[7], SCSIReset());
387     stack = 0;
388     break;
389     case 1: // SCSIGet
390     WriteMacInt16(r->a[7], SCSIGet());
391     stack = 0;
392     break;
393     case 2: // SCSISelect
394     case 11: // SCSISelAtn
395     WriteMacInt16(r->a[7] + 2, SCSISelect(ReadMacInt16(r->a[7]) & 0xff));
396     stack = 2;
397     break;
398     case 3: // SCSICmd
399     WriteMacInt16(r->a[7] + 6, SCSICmd(ReadMacInt16(r->a[7]), Mac2HostAddr(ReadMacInt32(r->a[7] + 2))));
400     stack = 6;
401     break;
402     case 4: // SCSIComplete
403     WriteMacInt16(r->a[7] + 12, SCSIComplete(ReadMacInt32(r->a[7]), ReadMacInt32(r->a[7] + 4), ReadMacInt32(r->a[7] + 8)));
404     stack = 12;
405     break;
406     case 5: // SCSIRead
407     case 8: // SCSIRBlind
408     WriteMacInt16(r->a[7] + 4, SCSIRead(ReadMacInt32(r->a[7])));
409     stack = 4;
410     break;
411     case 6: // SCSIWrite
412     case 9: // SCSIWBlind
413     WriteMacInt16(r->a[7] + 4, SCSIWrite(ReadMacInt32(r->a[7])));
414     stack = 4;
415     break;
416     case 10: // SCSIStat
417     WriteMacInt16(r->a[7], SCSIStat());
418     stack = 0;
419     break;
420     case 12: // SCSIMsgIn
421     WriteMacInt16(r->a[7] + 4, 0);
422     stack = 4;
423     break;
424     case 13: // SCSIMsgOut
425     WriteMacInt16(r->a[7] + 2, 0);
426     stack = 2;
427     break;
428     case 14: // SCSIMgrBusy
429     WriteMacInt16(r->a[7], SCSIMgrBusy());
430     stack = 0;
431     break;
432     default:
433     printf("FATAL: SCSIDispatch(%d): illegal selector\n", sel);
434     QuitEmulator();
435     break;
436     }
437     r->a[0] = ret; // "rtd" emulation, a0 = return address, a1 = new stack pointer
438     r->a[1] = r->a[7] + stack;
439     break;
440     }
441    
442     case M68K_EMUL_OP_IRQ: // Level 1 interrupt
443     r->d[0] = 0;
444 cebix 1.15
445 cebix 1.1 if (InterruptFlags & INTFLAG_60HZ) {
446     ClearInterruptFlag(INTFLAG_60HZ);
447 cebix 1.29
448     // Increment Ticks variable
449     WriteMacInt32(0x16a, ReadMacInt32(0x16a) + 1);
450    
451 cebix 1.1 if (HasMacStarted()) {
452    
453 cebix 1.3 // Mac has started, execute all 60Hz interrupt functions
454 cebix 1.1 TimerInterrupt();
455     VideoInterrupt();
456    
457     // Call DoVBLTask(0)
458     if (ROMVersion == ROM_VERSION_32) {
459     M68kRegisters r2;
460     r2.d[0] = 0;
461     Execute68kTrap(0xa072, &r2);
462     }
463    
464     r->d[0] = 1; // Flag: 68k interrupt routine executes VBLTasks etc.
465     }
466     }
467 cebix 1.15
468     if (InterruptFlags & INTFLAG_1HZ) {
469     ClearInterruptFlag(INTFLAG_1HZ);
470     if (HasMacStarted()) {
471     SonyInterrupt();
472     DiskInterrupt();
473     CDROMInterrupt();
474     }
475     }
476    
477 cebix 1.1 if (InterruptFlags & INTFLAG_SERIAL) {
478     ClearInterruptFlag(INTFLAG_SERIAL);
479     SerialInterrupt();
480     }
481 cebix 1.15
482 cebix 1.1 if (InterruptFlags & INTFLAG_ETHER) {
483     ClearInterruptFlag(INTFLAG_ETHER);
484     EtherInterrupt();
485     }
486 cebix 1.15
487 cebix 1.1 if (InterruptFlags & INTFLAG_AUDIO) {
488     ClearInterruptFlag(INTFLAG_AUDIO);
489     AudioInterrupt();
490     }
491 jlachmann 1.19
492 cebix 1.26 if (InterruptFlags & INTFLAG_ADB) {
493     ClearInterruptFlag(INTFLAG_ADB);
494     if (HasMacStarted())
495     ADBInterrupt();
496     }
497    
498 jlachmann 1.19 if (InterruptFlags & INTFLAG_NMI) {
499     ClearInterruptFlag(INTFLAG_NMI);
500 cebix 1.26 if (HasMacStarted())
501 jlachmann 1.19 TriggerNMI();
502     }
503 cebix 1.1 break;
504    
505     case M68K_EMUL_OP_PUT_SCRAP: { // PutScrap() patch
506     void *scrap = Mac2HostAddr(ReadMacInt32(r->a[7] + 4));
507     uint32 type = ReadMacInt32(r->a[7] + 8);
508     int32 length = ReadMacInt32(r->a[7] + 12);
509     PutScrap(type, scrap, length);
510     break;
511     }
512    
513 gbeauche 1.31 case M68K_EMUL_OP_GET_SCRAP: { // GetScrap() patch
514     void **scrap_handle = (void **)Mac2HostAddr(ReadMacInt32(r->a[7] + 4));
515     uint32 type = ReadMacInt32(r->a[7] + 8);
516     int32 length = ReadMacInt32(r->a[7] + 12);
517     GetScrap(scrap_handle, type, length);
518     break;
519     }
520    
521 cebix 1.1 case M68K_EMUL_OP_CHECKLOAD: { // vCheckLoad() patch (resource loader)
522     uint32 type = r->d[1];
523     int16 id = ReadMacInt16(r->a[2]);
524     if (r->a[0] == 0)
525     break;
526     uint32 adr = ReadMacInt32(r->a[0]);
527     if (adr == 0)
528     break;
529     uint8 *p = Mac2HostAddr(adr);
530     uint32 size = ReadMacInt32(adr - 8) & 0xffffff;
531     CheckLoad(type, id, p, size);
532     break;
533     }
534    
535     case M68K_EMUL_OP_AUDIO: // Audio component dispatch function
536     r->d[0] = AudioDispatch(r->a[3], r->a[4]);
537 cebix 1.4 break;
538    
539 cebix 1.6 #if SUPPORTS_EXTFS
540 cebix 1.4 case M68K_EMUL_OP_EXTFS_COMM: // External file system routines
541     WriteMacInt16(r->a[7] + 14, ExtFSComm(ReadMacInt16(r->a[7] + 12), ReadMacInt32(r->a[7] + 8), ReadMacInt32(r->a[7] + 4)));
542     break;
543    
544     case M68K_EMUL_OP_EXTFS_HFS:
545     WriteMacInt16(r->a[7] + 20, ExtFSHFS(ReadMacInt32(r->a[7] + 16), ReadMacInt16(r->a[7] + 14), ReadMacInt32(r->a[7] + 10), ReadMacInt32(r->a[7] + 6), ReadMacInt16(r->a[7] + 4)));
546 cebix 1.1 break;
547 cebix 1.6 #endif
548 cebix 1.1
549 cebix 1.21 case M68K_EMUL_OP_BLOCK_MOVE: // BlockMove() cache flushing
550     FlushCodeCache(Mac2HostAddr(r->a[0]), r->a[1]);
551 cebix 1.7 break;
552    
553 jlachmann 1.19 case M68K_EMUL_OP_DEBUGUTIL:
554     // printf("DebugUtil d0=%08lx a5=%08lx\n", r->d[0], r->a[5]);
555     r->d[0] = DebugUtil(r->d[0]);
556     break;
557    
558 cebix 1.1 default:
559 jlachmann 1.19 printf("FATAL: EMUL_OP called with bogus opcode %08x\n", opcode);
560 cebix 1.27 printf("d0 %08x d1 %08x d2 %08x d3 %08x\n"
561     "d4 %08x d5 %08x d6 %08x d7 %08x\n"
562     "a0 %08x a1 %08x a2 %08x a3 %08x\n"
563     "a4 %08x a5 %08x a6 %08x a7 %08x\n"
564 cebix 1.1 "sr %04x\n",
565     r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7],
566     r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
567     r->sr);
568 cebix 1.16 #ifdef ENABLE_MON
569 cebix 1.20 char *arg[4] = {"mon", "-m", "-r", NULL};
570     mon(3, arg);
571 cebix 1.9 #endif
572 cebix 1.1 QuitEmulator();
573     break;
574     }
575     }