ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/emul_op.cpp
(Generate patch)

Comparing BasiliskII/src/emul_op.cpp (file contents):
Revision 1.1 by cebix, 1999-10-03T14:16:25Z vs.
Revision 1.15 by cebix, 2000-07-14T21:29:08Z

# Line 1 | Line 1
1   /*
2   *  emul_op.cpp - 68k opcodes for ROM patches
3   *
4 < *  Basilisk II (C) 1997-1999 Christian Bauer
4 > *  Basilisk II (C) 1997-2000 Christian Bauer
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
# Line 39 | Line 39
39   #include "video.h"
40   #include "audio.h"
41   #include "ether.h"
42 + #include "extfs.h"
43   #include "emul_op.h"
44  
45 + #if ENABLE_MON
46 + #include "mon.h"
47 + #endif
48 +
49   #define DEBUG 0
50   #include "debug.h"
51  
# Line 63 | Line 68 | void EmulOp(uint16 opcode, M68kRegisters
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 + #if ENABLE_MON
72 +                        char *arg[2] = {"rmon", NULL};
73 +                        mon(1, arg);
74 + #endif
75                          QuitEmulator();
76                          break;
77                  }
# Line 75 | Line 84 | void EmulOp(uint16 opcode, M68kRegisters
84                          D(bug("*** RESET ***\n"));
85                          TimerReset();
86                          EtherReset();
87 +                        AudioReset();
88  
89                          // Create BootGlobs at top of memory
90 <                        memset((void *)(RAMBaseHost + RAMSize - 4096), 0, 4096);
90 >                        Mac_memset(RAMBaseMac + RAMSize - 4096, 0, 4096);
91                          uint32 boot_globs = RAMBaseMac + RAMSize - 0x1c;
92                          WriteMacInt32(boot_globs + 0x00, RAMBaseMac);   // First RAM bank
93                          WriteMacInt32(boot_globs + 0x04, RAMSize);
# Line 152 | Line 162 | void EmulOp(uint16 opcode, M68kRegisters
162                                          }
163                                  } else if (reg < 0x08 && is_read) {
164                                          uint32 t = TimerDateTime();
165 <                                        uint8 b;
165 >                                        uint8 b = t;
166                                          switch (reg & 3) {
157                                                case 0: b = t; break;
167                                                  case 1: b = t >> 8; break;
168                                                  case 2: b = t >> 16; break;
169                                                  case 3: b = t >> 24; break;
# Line 296 | Line 305 | void EmulOp(uint16 opcode, M68kRegisters
305                          break;
306  
307                  case M68K_EMUL_OP_VIDEO_OPEN:           // Video driver functions
308 <                        r->d[0] = VideoOpen(r->a[0], r->a[1]);
308 >                        r->d[0] = VideoDriverOpen(r->a[0], r->a[1]);
309                          break;
310  
311                  case M68K_EMUL_OP_VIDEO_CONTROL:
312 <                        r->d[0] = VideoControl(r->a[0], r->a[1]);
312 >                        r->d[0] = VideoDriverControl(r->a[0], r->a[1]);
313                          break;
314  
315                  case M68K_EMUL_OP_VIDEO_STATUS:
316 <                        r->d[0] = VideoStatus(r->a[0], r->a[1]);
316 >                        r->d[0] = VideoDriverStatus(r->a[0], r->a[1]);
317                          break;
318  
319                  case M68K_EMUL_OP_SERIAL_OPEN:          // Serial driver functions
# Line 402 | Line 411 | void EmulOp(uint16 opcode, M68kRegisters
411                          break;
412                  }
413  
405                case M68K_EMUL_OP_MEMORY_DISPATCH: {    // MemoryDispatch() replacement routine
406                        int16 sel = r->d[0];
407                        D(bug("MemoryDispatch(%d)\n", sel));
408                        switch (sel) {
409                                case -6:        // GetLogicalRAMSize
410                                        r->d[0] = RAMSize;
411                                        break;
412                                case -3:
413                                        r->d[0] = 0x1000;
414                                        break;
415                                case 0:         // HoldMemory
416                                case 1:         // UnholdMemory
417                                case 2:         // LockMemory
418                                case 3:         // UnlockMemory
419                                case 4:         // LockMemoryContiguous
420                                case 6:         // ProtectMemory
421                                case 7:         // UnprotectMemory
422                                        r->d[0] = 0;
423                                        break;
424                                default:
425                                        printf("FATAL: MemoryDispatch(%d): illegal selector\n", sel);
426                                        r->d[0] = (uint32)-502;
427                                        break;
428                        }
429                        break;
430                }
431
414                  case M68K_EMUL_OP_IRQ:                  // Level 1 interrupt
415                          r->d[0] = 0;
416 +
417                          if (InterruptFlags & INTFLAG_60HZ) {
418                                  ClearInterruptFlag(INTFLAG_60HZ);
419                                  if (HasMacStarted()) {
420  
421 <                                        // Mac has started, execute video, ADB and Time Manager interrupt functions
421 >                                        // Mac has started, execute all 60Hz interrupt functions
422                                          ADBInterrupt();
423                                          TimerInterrupt();
424                                          VideoInterrupt();
# Line 450 | Line 433 | void EmulOp(uint16 opcode, M68kRegisters
433                                          r->d[0] = 1;                    // Flag: 68k interrupt routine executes VBLTasks etc.
434                                  }
435                          }
436 +
437 +                        if (InterruptFlags & INTFLAG_1HZ) {
438 +                                ClearInterruptFlag(INTFLAG_1HZ);
439 +
440 +                                if (HasMacStarted()) {
441 +                                        SonyInterrupt();
442 +                                        DiskInterrupt();
443 +                                        CDROMInterrupt();
444 +                                }
445 +                        }
446 +
447                          if (InterruptFlags & INTFLAG_SERIAL) {
448                                  ClearInterruptFlag(INTFLAG_SERIAL);
449                                  SerialInterrupt();
450                          }
451 +
452                          if (InterruptFlags & INTFLAG_ETHER) {
453                                  ClearInterruptFlag(INTFLAG_ETHER);
454                                  EtherInterrupt();
455                          }
456 +
457                          if (InterruptFlags & INTFLAG_AUDIO) {
458                                  ClearInterruptFlag(INTFLAG_AUDIO);
459                                  AudioInterrupt();
# Line 490 | Line 486 | void EmulOp(uint16 opcode, M68kRegisters
486                          r->d[0] = AudioDispatch(r->a[3], r->a[4]);
487                          break;
488  
489 + #if SUPPORTS_EXTFS
490 +                case M68K_EMUL_OP_EXTFS_COMM:           // External file system routines
491 +                        WriteMacInt16(r->a[7] + 14, ExtFSComm(ReadMacInt16(r->a[7] + 12), ReadMacInt32(r->a[7] + 8), ReadMacInt32(r->a[7] + 4)));
492 +                        break;
493 +
494 +                case M68K_EMUL_OP_EXTFS_HFS:
495 +                        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)));
496 +                        break;
497 + #endif
498 +
499 +                case M68K_EMUL_OP_BLOCK_MOVE:           // BlockMove() replacement
500 +                        memmove(Mac2HostAddr(r->a[1]), Mac2HostAddr(r->a[0]), r->d[0]);
501 +                        break;
502 +
503                  default:
504                          printf("FATAL: EMUL_OP called with bogus opcode %08x\n", opcode);
505                          printf("d0 %08lx d1 %08lx d2 %08lx d3 %08lx\n"
# Line 500 | Line 510 | void EmulOp(uint16 opcode, M68kRegisters
510                                     r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7],
511                                     r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7],
512                                     r->sr);
513 + #if ENABLE_MON
514 +                        char *arg[2] = {"rmon", NULL};
515 +                        mon(1, arg);
516 + #endif
517                          QuitEmulator();
518                          break;
519          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines