ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/emul_op.cpp
Revision: 1.23
Committed: 2001-02-02T20:52:57Z (23 years, 9 months ago) by cebix
Branch: MAIN
Changes since 1.22: +1 -1 lines
Log Message:
- bumped version number to 0.9
- updated copyright dates

File Contents

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