diff --git a/bin/GWSys6_4M.bin b/bin/GWSys6_4M.bin index e9e434f..2f7d728 100755 Binary files a/bin/GWSys6_4M.bin and b/bin/GWSys6_4M.bin differ diff --git a/bin/GWSys6_8M.bin b/bin/GWSys6_8M.bin index 7ee7725..cda9863 100644 Binary files a/bin/GWSys6_8M.bin and b/bin/GWSys6_8M.bin differ diff --git a/bin/GWSys71_8M.bin b/bin/GWSys71_8M.bin index a019f54..4da7ea0 100755 Binary files a/bin/GWSys71_8M.bin and b/bin/GWSys71_8M.bin differ diff --git a/bin/GWSys7Diagnostics_8M.bin b/bin/GWSys7Diagnostics_8M.bin index ceee568..fb671a0 100755 Binary files a/bin/GWSys7Diagnostics_8M.bin and b/bin/GWSys7Diagnostics_8M.bin differ diff --git a/bin/baserom_romdisk_noramtest.bin b/bin/baserom_romdisk_noramtest.bin index f71f627..8538612 100755 Binary files a/bin/baserom_romdisk_noramtest.bin and b/bin/baserom_romdisk_noramtest.bin differ diff --git a/bin/baserom_romdisk_ramtest.bin b/bin/baserom_romdisk_ramtest.bin index 7b9c585..cc70301 100755 Binary files a/bin/baserom_romdisk_ramtest.bin and b/bin/baserom_romdisk_ramtest.bin differ diff --git a/bin/driver.bin b/bin/driver.bin index 30accd3..add226d 100755 Binary files a/bin/driver.bin and b/bin/driver.bin differ diff --git a/rdisk.c b/rdisk.c index a1644ac..a01c4b2 100644 --- a/rdisk.c +++ b/rdisk.c @@ -92,6 +92,21 @@ void __attribute__ ((noinline)) S24(Ptr pos, char patch) { SwapMMUMode(&mode); } +static void RDUnpatch(unsigned long pos, Ptr patch) { + char (*peek)(Ptr) = G24; + *patch = peek(RDiskBuf + pos); +} + +static void RDPatch(char enable, Ptr patch, Ptr ramdisk, unsigned long pos, char data) { + if (!enable) { + *patch = data; + if (ramdisk) { + void (*poke)(Ptr, char) = S24; + poke(ramdisk + pos, data); + } + } +} + // Figure out the first available drive number >= 5 static int RDFindDrvNum() { DrvQElPtr dq; @@ -144,9 +159,9 @@ OSErr RDOpen(IOParamPtr p, DCtlPtr d) { // Find first available drive number drvNum = RDFindDrvNum(); - // Get debug and CD-ROM disable settings from ROM table - c->dbgDisByte = RDiskDBGDisByte; - c->cdrDisByte = RDiskCDRDisByte; + // Enable debugger and CD-ROM + RDUnpatch(RDiskDBGDisPos, &c->dbgDisByte); + RDUnpatch(RDiskCDRDisPos, &c->cdrDisByte); // Set drive status //c->status.track = 0; @@ -173,19 +188,6 @@ OSErr RDOpen(IOParamPtr p, DCtlPtr d) { return noErr; } -static void RDPatchRAMDisk(char enable, Ptr ram, Ptr rom, - unsigned long pos, unsigned long size, Ptr patch) { - if (pos < size) { - if (enable) { - void (*poke)(Ptr, char) = S24; - poke(ram + pos, *patch); - } else { - char (*peek)(Ptr) = G24; - *patch = peek(rom + pos); - } - } -} - // Init is called at beginning of first prime (read/write) call static void RDBootInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) { // Mark init done @@ -216,19 +218,12 @@ static void RDBootInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) { // but it would be better to switch to read-only status } } + // Copy ROM disk image to RAM disk + if (c->ramdisk) { copy24(RDiskBuf, c->ramdisk, RDiskSize); } - if (c->ramdisk) { - // Copy ROM disk image to RAM disk - copy24(RDiskBuf, c->ramdisk, RDiskSize); - // Clearing write protect marks RAM disk enabled - c->status.writeProt = 0; - // Patch debug - RDPatchRAMDisk(!c->dbgEN, c->ramdisk, RDiskBuf, - RDiskDBGDisPos, RDiskSize, &c->dbgDisByte); - // Patch CD - RDPatchRAMDisk(!c->cdrEN, c->ramdisk, RDiskBuf, - RDiskCDRDisPos, RDiskSize, &c->cdrDisByte); - } + // Patch to disable debugger and CD-ROM + RDPatch(c->dbgEN, &c->dbgDisByte, c->ramdisk, RDiskDBGDisPos, RDiskDBGDisByte); + RDPatch(c->cdrEN, &c->cdrDisByte, c->ramdisk, RDiskCDRDisPos, RDiskCDRDisByte); // Unmount if not booting from ROM disk if (c->unmountEN) { c->status.diskInPlace = 0; }