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.13 by cebix, 2000-04-10T18:52:26Z vs.
Revision 1.16 by jlachmann, 2000-08-20T14:08:40Z

# Line 44 | Line 44 | uint32 PutScrapPatch;          // Mac address of
44   uint32 ROMBreakpoint = 0;       // ROM offset of breakpoint (0 = disabled, 0x2310 = CritError)
45   bool PrintROMInfo = false;      // Flag: print ROM information in PatchROM()
46  
47 < static uint32 sony_offset;                              // ROM offset of .Sony driver
48 < static uint32 serd_offset;                              // ROM offset of SERD resource (serial drivers)
49 < static uint32 microseconds_offset;              // ROM offset of Microseconds() replacement routine
47 > static uint32 sony_offset;              // ROM offset of .Sony driver
48 > static uint32 serd_offset;              // ROM offset of SERD resource (serial drivers)
49 > static uint32 microseconds_offset;      // ROM offset of Microseconds() replacement routine
50 > static uint32 debugutil_offset;         // ROM offset of DebugUtil() replacement routine
51  
52   // Prototypes
53   uint16 ROMVersion;
# Line 270 | Line 271 | static void list_universal_infos(void)
271                                  printf("Universal Table at %08x:\n", q);
272                                  printf("Offset\t ID\tHWCfg\tROM85\tModel\n");
273                                  printf("------------------------------------------------\n");
274 <                                while (ofs = ReadMacInt32(ROMBaseMac + q)) {
274 >                                while ((ofs = ReadMacInt32(ROMBaseMac + q))) {
275                                          print_universal_info(ROMBaseMac + ofs + q);
276                                          q += 4;
277                                  }
# Line 693 | Line 694 | static const uint8 adbop_patch[] = {   //
694  
695   void InstallDrivers(uint32 pb)
696   {
697 <        D(bug("InstallDrivers\n"));
697 >        D(bug("InstallDrivers, pb %08x\n", pb));
698          M68kRegisters r;
699  
700          // Install Microseconds() replacement routine
# Line 701 | Line 702 | void InstallDrivers(uint32 pb)
702          r.d[0] = 0xa093;
703          Execute68kTrap(0xa247, &r);             // SetOSTrapAddress()
704  
705 +        // Install DebugUtil() replacement routine
706 +        r.a[0] = ROMBaseMac + debugutil_offset;
707 +        r.d[0] = 0xa08d;
708 +        Execute68kTrap(0xa247, &r);             // SetOSTrapAddress()
709 +
710          // Install disk driver
711          r.a[0] = ROMBaseMac + sony_offset + 0x100;
712          r.d[0] = (uint32)DiskRefNum;
# Line 930 | Line 936 | static bool patch_rom_classic(void)
936          *wp++ = htons(M68K_RTS);
937          microseconds_offset = (uint8 *)wp - ROMBaseHost;
938          *wp++ = htons(M68K_EMUL_OP_MICROSECONDS);
939 +        *wp++ = htons(M68K_RTS);
940 +
941 +        // Replace DebugUtil
942 +        debugutil_offset = (uint8 *)wp - ROMBaseHost;
943 +        *wp++ = htons(M68K_EMUL_OP_DEBUGUTIL);
944          *wp = htons(M68K_RTS);
945  
946          // Replace SCSIDispatch()
# Line 1192 | Line 1203 | static bool patch_rom_32(void)
1203          *wp = htons(M68K_RTS);
1204  
1205          // Fake CPU speed test (SetupTimeK)
1206 +        // *** increased jl : MacsBug uses TimeDBRA for kbd repeat timing
1207          wp = (uint16 *)(ROMBaseHost + 0x800);
1208          *wp++ = htons(0x31fc);                  // move.w       #xxx,TimeDBRA
1209 <        *wp++ = htons(100);
1209 >        *wp++ = htons(10000);
1210          *wp++ = htons(0x0d00);
1211          *wp++ = htons(0x31fc);                  // move.w       #xxx,TimeSCCDBRA
1212 <        *wp++ = htons(100);
1212 >        *wp++ = htons(10000);
1213          *wp++ = htons(0x0d02);
1214          *wp++ = htons(0x31fc);                  // move.w       #xxx,TimeSCSIDBRA
1215 <        *wp++ = htons(100);
1215 >        *wp++ = htons(10000);
1216          *wp++ = htons(0x0b24);
1217          *wp++ = htons(0x31fc);                  // move.w       #xxx,TimeRAMDBRA
1218 <        *wp++ = htons(100);
1218 >        *wp++ = htons(10000);
1219          *wp++ = htons(0x0cea);
1220          *wp = htons(M68K_RTS);
1221  
# Line 1461 | Line 1473 | static bool patch_rom_32(void)
1473          }
1474  
1475          // Patch .EDisk driver (don't scan for EDisks in the area ROMBase..0xe00000)
1476 <        uint32 edisk_offset = find_rom_resource('DRVR', 51);
1476 >        uint32 edisk_offset = find_rom_resource(FOURCC('D','R','V','R'), 51);
1477          if (edisk_offset) {
1478                  static const uint8 edisk_dat[] = {0xd5, 0xfc, 0x00, 0x01, 0x00, 0x00, 0xb5, 0xfc, 0x00, 0xe0, 0x00, 0x00};
1479                  base = find_rom_data(edisk_offset, edisk_offset + 0x10000, edisk_dat, sizeof(edisk_dat));
# Line 1474 | Line 1486 | static bool patch_rom_32(void)
1486          }
1487  
1488          // Replace .Sony driver
1489 <        sony_offset = find_rom_resource('DRVR', 4);
1489 >        sony_offset = find_rom_resource(FOURCC('D','R','V','R'), 4);
1490          D(bug("sony %08lx\n", sony_offset));
1491          memcpy(ROMBaseHost + sony_offset, sony_driver, sizeof(sony_driver));
1492  
# Line 1493 | Line 1505 | static bool patch_rom_32(void)
1505          memcpy(ROMBaseHost + sony_offset + 0xa00, CDROMIcon, sizeof(CDROMIcon));
1506  
1507          // Install SERD patch and serial drivers
1508 <        serd_offset = find_rom_resource('SERD', 0);
1508 >        serd_offset = find_rom_resource(FOURCC('S','E','R','D'), 0);
1509          D(bug("serd %08lx\n", serd_offset));
1510          wp = (uint16 *)(ROMBaseHost + serd_offset + 12);
1511          *wp++ = htons(M68K_EMUL_OP_SERD);
# Line 1526 | Line 1538 | static bool patch_rom_32(void)
1538          *wp++ = htons(M68K_RTS);
1539          microseconds_offset = (uint8 *)wp - ROMBaseHost;
1540          *wp++ = htons(M68K_EMUL_OP_MICROSECONDS);
1541 +        *wp++ = htons(M68K_RTS);
1542 +
1543 +        // Replace DebugUtil
1544 +        debugutil_offset = (uint8 *)wp - ROMBaseHost;
1545 +        *wp++ = htons(M68K_EMUL_OP_DEBUGUTIL);
1546          *wp = htons(M68K_RTS);
1547  
1548          // Replace SCSIDispatch()
# Line 1570 | Line 1587 | static bool patch_rom_32(void)
1587   #endif
1588  
1589          // Look for double PACK 4 resources
1590 <        if ((base = find_rom_resource('PACK', 4)) == 0) return false;
1591 <        if ((base = find_rom_resource('PACK', 4, true)) == 0 && FPUType == 0)
1590 >        if ((base = find_rom_resource(FOURCC('P','A','C','K'), 4)) == 0) return false;
1591 >        if ((base = find_rom_resource(FOURCC('P','A','C','K'), 4, true)) == 0 && FPUType == 0)
1592                  printf("WARNING: This ROM seems to require an FPU\n");
1593  
1594          // Patch VIA interrupt handler

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines