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

Comparing BasiliskII/src/rom_patches.cpp (file contents):
Revision 1.9 by cebix, 1999-10-25T19:01:29Z vs.
Revision 1.10 by cebix, 1999-10-26T16:28:27Z

# Line 38 | Line 38
38   #include "debug.h"
39  
40  
41 < // Breakpoint
42 < //#define M68K_BREAKPOINT 0x2310        // CritError
43 < //#define M68K_BREAKPOINT 0x1d10        // BootMe
41 > // Breakpoint (offset into ROM)
42 > uint32 ROMBreakpoint = 0;       // 0 = disabled, 0x2310 = CritError
43  
44   // Global variables
45   uint32 UniversalInfo;   // ROM offset of UniversalInfo
# Line 547 | Line 546 | void InstallDrivers(uint32 pb)
546          r.d[0] = 0xa093;
547          Execute68kTrap(0xa247, &r);             // SetOSTrapAddress()
548  
549 +        // Install MemoryDispatch() replacement routine
550 +        r.a[0] = ROMBaseMac + memory_dispatch_offset;
551 +        r.d[0] = 0xa05c;
552 +        Execute68kTrap(0xa247, &r);             // SetOSTrapAddress()
553 +
554          // Install disk driver
555          r.a[0] = ROMBaseMac + sony_offset + 0x100;
556          r.d[0] = (uint32)DiskRefNum;
# Line 642 | Line 646 | void InstallSERD(void)
646  
647   void PatchAfterStartup(void)
648   {
645        // Install MemoryDispatch() replacement routine
646        M68kRegisters r;
647        r.a[0] = ROMBaseMac + memory_dispatch_offset;
648        r.d[0] = 0xa05c;
649        Execute68kTrap(0xa247, &r);             // SetOSTrapAddress()
650
649   #if SUPPORTS_EXTFS
650          // Install external file system
651          InstallExtFS();
# Line 1303 | Line 1301 | static bool patch_rom_32(void)
1301                  }
1302          }
1303  
1304 +        // Don't set MemoryDispatch() to unimplemented trap
1305 +        static const uint8 memdisp_dat[] = {0x30, 0x3c, 0xa8, 0x9f, 0xa7, 0x46, 0x30, 0x3c, 0xa0, 0x5c, 0xa2, 0x47};
1306 +        base = find_rom_data(0x4f100, 0x4f180, memdisp_dat, sizeof(memdisp_dat));
1307 +        D(bug("memdisp %08lx\n", base));
1308 +        if (base) {     // ROM15/32
1309 +                wp = (uint16 *)(ROMBaseHost + base + 10);
1310 +                *wp = htons(M68K_NOP);
1311 +        }
1312 +
1313          // Patch .EDisk driver (don't scan for EDisks in the area ROMBase..0xe00000)
1314          uint32 edisk_offset = find_rom_resource('DRVR', 51);
1315          if (edisk_offset) {
# Line 1455 | Line 1462 | bool PatchROM(void)
1462                          return false;
1463          }
1464  
1458 #ifdef M68K_BREAKPOINT
1465          // Install breakpoint
1466 <        uint16 *wp = (uint16 *)(ROMBaseHost + M68K_BREAKPOINT);
1467 <        *wp = htons(M68K_EMUL_BREAK);
1468 < #endif
1466 >        if (ROMBreakpoint) {
1467 >                uint16 *wp = (uint16 *)(ROMBaseHost + ROMBreakpoint);
1468 >                *wp = htons(M68K_EMUL_BREAK);
1469 >        }
1470  
1471          // Clear caches as we loaded and patched code
1472          FlushCodeCache(ROMBaseHost, ROMSize);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines