mirror of
https://github.com/garrettsworkshop/MacIIROMDiskDriver.git
synced 2024-11-22 03:30:58 +00:00
Add extra settings
This commit is contained in:
parent
0afd682ea6
commit
99ff56c41c
57
rdisk.c
57
rdisk.c
@ -9,31 +9,42 @@
|
|||||||
#include "rdisk.h"
|
#include "rdisk.h"
|
||||||
|
|
||||||
// Decode keyboard/PRAM settings
|
// Decode keyboard/PRAM settings
|
||||||
static void RDiskDecodeSettings(RDiskStorage_t *c, Ptr unmount, Ptr mount, Ptr ram) {
|
static void RDDecodeSettings(Ptr unmountEN, Ptr mountEN, Ptr ramEN, Ptr dbgEN, Ptr cdromEN) {
|
||||||
// Decode settings
|
|
||||||
if (RDiskIsRPressed()) { // R boots from ROM disk
|
|
||||||
*unmount = 0; // Don't unmount so we boot from this drive
|
|
||||||
*mount = 0; // No need to mount later since we are boot disk
|
|
||||||
*ram = RDiskIsAPressed(); // A enables RAM disk
|
|
||||||
} else {
|
|
||||||
// Read PRAM
|
// Read PRAM
|
||||||
char legacy_startup, legacy_ram;
|
char legacy_startup, legacy_ram;
|
||||||
RDiskReadXPRAM(1, 4, &legacy_startup);
|
RDiskReadXPRAM(1, 4, &legacy_startup);
|
||||||
RDiskReadXPRAM(1, 5, &legacy_ram);
|
RDiskReadXPRAM(1, 5, &legacy_ram);
|
||||||
if (legacy_startup & 1) { // Boot from ROM disk
|
|
||||||
*unmount = 0; // Don't unmount so we boot from this drive
|
// Decode settings: unmount (don't boot), mount (after boot), RAM disk
|
||||||
*mount = 0; // No need to mount later since we are boot disk
|
if (RDiskIsRPressed()) { // R boots from ROM disk
|
||||||
*ram = legacy_ram & 1;
|
*unmountEN = 0; // Don't unmount so we boot from this drive
|
||||||
} else if (legacy_startup & 2) { // Mount ROM disk
|
*mountEN = 0; // No need to mount later since we are boot disk
|
||||||
*unmount = 1; // Unmount to not boot from our disk
|
*ramEN = RDiskIsAPressed(); // A enables RAM disk
|
||||||
*mount = 1; // Mount in accRun
|
|
||||||
*ram = legacy_ram & 1;
|
|
||||||
} else {
|
} else {
|
||||||
*unmount = 1; // Unmount
|
if (legacy_startup & 0x01) { // Boot from ROM disk
|
||||||
*mount = 0; // Don't mount again
|
*unmountEN = 0; // Don't unmount so we boot from this drive
|
||||||
*ram = 0; // Don't allocate RAM disk
|
*mountEN = 0; // No need to mount later since we are boot disk
|
||||||
|
*ramEN = legacy_ram & 0x01;
|
||||||
|
} else if (legacy_startup & 0x02) { // Mount ROM disk
|
||||||
|
*unmountEN = 1; // Unmount to not boot from our disk
|
||||||
|
*mountEN = 1; // Mount in accRun
|
||||||
|
*ramEN = legacy_ram & 0x01;
|
||||||
|
} else {
|
||||||
|
*unmountEN = 1; // Unmount
|
||||||
|
*mountEN = 0; // Don't mount again
|
||||||
|
*ramEN = 0; // Don't allocate RAM disk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MacsBug enabled if bit 3 == 1 or DBGDis addr invalid or not boot
|
||||||
|
*dbgEN = *unmountEN ||
|
||||||
|
(legacy_startup & 0x04) ||
|
||||||
|
(*RDiskDBGDisPos == 0);
|
||||||
|
|
||||||
|
// CDROM enabled if bit 3 == 0 or CDROMDis addr invalid or not boot
|
||||||
|
*cdromEN = *unmountEN ||
|
||||||
|
!(legacy_startup & 0x08) ||
|
||||||
|
(*RDiskCDROMDisPos == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to 32-bit mode and copy
|
// Switch to 32-bit mode and copy
|
||||||
@ -105,12 +116,18 @@ OSErr RDOpen(IOParamPtr p, DCtlPtr d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init is called at beginning of first prime (read/write) call
|
// Init is called at beginning of first prime (read/write) call
|
||||||
char unmountEN, mountEN, ramEN;
|
|
||||||
static void RDInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
|
static void RDInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
|
||||||
|
char unmountEN, mountEN, ramEN, dbgEN, cdromEN;
|
||||||
// Mark init done
|
// Mark init done
|
||||||
c->initialized = 1;
|
c->initialized = 1;
|
||||||
// Decode settings
|
// Decode settings
|
||||||
RDiskDecodeSettings(c, &unmountEN, &mountEN, &ramEN);
|
RDDecodeSettings(&unmountEN, &mountEN, &ramEN, &dbgEN, &cdromEN);
|
||||||
|
// Set debug and CD-ROM enable flags in storage struct
|
||||||
|
c->dbgEN = dbgEN;
|
||||||
|
c->cdromEN = cdromEN;
|
||||||
|
// Clear debug and CD-ROM overwrite flags
|
||||||
|
c->dbgOverwrite = 0;
|
||||||
|
c->cdromOverwrite = 0;
|
||||||
|
|
||||||
// If RAM disk enabled, try to allocate RAM disk buffer if not already
|
// If RAM disk enabled, try to allocate RAM disk buffer if not already
|
||||||
if (ramEN & !c->ramdisk) {
|
if (ramEN & !c->ramdisk) {
|
||||||
|
4
rdisk.h
4
rdisk.h
@ -28,6 +28,10 @@ typedef struct RDiskStorage_s {
|
|||||||
DrvSts2 status;
|
DrvSts2 status;
|
||||||
char initialized;
|
char initialized;
|
||||||
Ptr ramdisk;
|
Ptr ramdisk;
|
||||||
|
char dbgEN;
|
||||||
|
char dbgOverwrite;
|
||||||
|
char cdromEN;
|
||||||
|
char cdromOverwrite;
|
||||||
#ifdef RDISK_COMPRESS_ICON_ENABLE
|
#ifdef RDISK_COMPRESS_ICON_ENABLE
|
||||||
char icon[RDISK_ICON_SIZE];
|
char icon[RDISK_ICON_SIZE];
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user