mirror of
https://github.com/garrettsworkshop/MacIIROMDiskDriver.git
synced 2025-01-14 02:31:51 +00:00
Change RDiskAddDrive to better match IM: Devices
This commit is contained in:
parent
65a426ed5e
commit
74c030c733
11
rdisk.c
11
rdisk.c
@ -92,7 +92,7 @@ OSErr RDiskOpen(IOParamPtr p, DCtlPtr d) {
|
||||
dNeedLockMask; // 0x4F */
|
||||
|
||||
// Add drive to drive queue and return
|
||||
RDAddDrive(status->dQRefNum, drvNum, (DrvQElPtr)&status->qLink);
|
||||
RDiskAddDrive(status->dQRefNum, drvNum, (DrvQElPtr)&status->qLink);
|
||||
return noErr;
|
||||
}
|
||||
|
||||
@ -103,11 +103,11 @@ OSErr RDiskInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
|
||||
c->init_done = 1;
|
||||
|
||||
// Read PRAM
|
||||
/*RDReadXPRam(1, 4, &startup);
|
||||
RDReadXPRam(1, 5, &ram);*/
|
||||
/*RDiskReadXPRam(1, 4, &startup);
|
||||
RDiskReadXPRam(1, 5, &ram);*/
|
||||
|
||||
// Either enable ROM disk or remove ourselves from the drive queue
|
||||
/*if (startup || RDIsRPressed()) { // If ROM disk boot set in PRAM or R pressed,*/
|
||||
/*if (startup || RDiskIsRPressed()) { // If ROM disk boot set in PRAM or R pressed,*/
|
||||
// Set ROM disk attributes
|
||||
c->drvsts.writeProt = -1; // Set write protected
|
||||
// Clear disk fields (even though we used NewHandleSysClear)
|
||||
@ -115,7 +115,7 @@ OSErr RDiskInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
|
||||
c->ramdisk_alloc = NULL;
|
||||
c->ramdisk_valid = 0;
|
||||
// If RAM disk set in PRAM or A pressed, enable RAM disk
|
||||
/*if (ram || RDISAPressed()) {
|
||||
/*if (ram || RDiskISAPressed()) {
|
||||
unsigned long minBufPtr, newBufPtr;
|
||||
// Clearing write protect marks RAM disk enabled
|
||||
c->drvsts.writeProt = 0;
|
||||
@ -166,7 +166,6 @@ OSErr RDiskPrime(IOParamPtr p, DCtlPtr d) {
|
||||
unsigned long offset;
|
||||
ROMDiskCopy_t copy24 = RDiskCopy24;
|
||||
|
||||
|
||||
// Return disk offline error if dCtlStorage null
|
||||
if (!d->dCtlStorage) { return offLinErr; }
|
||||
// Dereference dCtlStorage to get pointer to our context
|
||||
|
27
rdtraps.h
27
rdtraps.h
@ -2,12 +2,27 @@
|
||||
#define RDTRAPS_H
|
||||
|
||||
#pragma parameter __D0 RDReadXPRAM(__D0, __D1, __A0)
|
||||
OSErr RDReadXPRAM(short numBytes, short whichByte, void *dest) = {0x4840, 0x3001, 0xA051};
|
||||
OSErr RDiskReadXPRAM(short numBytes, short whichByte, void *dest) = {0x4840, 0x3001, 0xA051};
|
||||
|
||||
#pragma parameter __D0 RDAddDrive(__D1, __D0, __A0)
|
||||
OSErr RDAddDrive(short drvrRefNum, short drvNum, DrvQElPtr dq) = {0x4840, 0x3001, 0xA04E};
|
||||
// Other definition of RDiskAddDrive with register calling convention
|
||||
//#pragma parameter __D0 RDiskAddDrive(__D1, __D0, __A0)
|
||||
//OSErr RDiskAddDrive(short numBytes, short whichByte, void *dest) = {0x4840, 0x3001, 0xA04E};
|
||||
|
||||
inline char RDIsRPressed() { return *((char*)0x175) & 0x80; }
|
||||
inline char RDISAPressed() { return *((char*)0x174) & 0x01; }
|
||||
OSErr RDiskAddDrive(short drvrRefNum, short drvNum, DrvQElPtr dq) {
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"clr.l %%D0 \n\t"
|
||||
"move.w %1,%%D0 \n\t"
|
||||
"swap %%D0 \n\t"
|
||||
"move.w %0,%%D0 \n\t"
|
||||
"movea.l %2,%%A0 \n\t"
|
||||
".word 0xA04E \n\t"
|
||||
: /* outputs */
|
||||
: "g"(drvrRefNum), "g"(drvNum), "g"(dq) /* inputs */
|
||||
: /* clobbered */);
|
||||
}
|
||||
|
||||
#endif
|
||||
inline char RDiskIsRPressed() { return *((char*)0x175) & 0x80; }
|
||||
inline char RDiskIsAPressed() { return *((char*)0x174) & 0x01; }
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user