mirror of
https://github.com/garrettsworkshop/MacIIROMDiskDriver.git
synced 2024-11-24 17:32:39 +00:00
rearrange functions again
This commit is contained in:
parent
a6a136e5cd
commit
980eed4c88
Binary file not shown.
BIN
bin/rom8M.bin
BIN
bin/rom8M.bin
Binary file not shown.
19
rdisk.c
19
rdisk.c
@ -53,9 +53,8 @@ void C24(Ptr sourcePtr, Ptr destPtr, unsigned long byteCount) {
|
||||
}
|
||||
|
||||
// Switch to 32-bit mode and patch
|
||||
typedef void (*RDiskPatch_t)(Ptr, char*);
|
||||
#pragma parameter P24(__A0, __A1)
|
||||
void __attribute__ ((noinline)) P24(Ptr ptr, char *patch) {
|
||||
void __attribute__ ((noinline)) P24(Ptr ptr, Ptr patch) {
|
||||
signed char mode = true32b;
|
||||
SwapMMUMode(&mode);
|
||||
*ptr = *patch; // Patch byte
|
||||
@ -165,9 +164,8 @@ static void RDInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
|
||||
|
||||
// Patch debug and CD-ROM enable bytes
|
||||
if (c->ramdisk) {
|
||||
RDiskPatch_t fun = P24;
|
||||
if (!dbgEN /*&& *RDiskDBGDisPos >= 0*/) { fun(c->ramdisk + 0x00000031UL, RDiskDBGDisByte); }
|
||||
if (!cdrEN /*&& *RDiskCDRDisPos >= 0*/) { fun(c->ramdisk + 0x00012CAFUL, RDiskCDRDisByte); }
|
||||
if (!dbgEN /*&& *RDiskDBGDisPos >= 0*/) { patch24(c->ramdisk + 0x00000031UL, RDiskDBGDisByte); }
|
||||
if (!cdrEN /*&& *RDiskCDRDisPos >= 0*/) { patch24(c->ramdisk + 0x00012CAFUL, RDiskCDRDisByte); }
|
||||
}
|
||||
|
||||
// Unmount if not booting from ROM disk
|
||||
@ -234,15 +232,12 @@ OSErr RDCtl(CntrlParamPtr p, DCtlPtr d) {
|
||||
switch (p->csCode) {
|
||||
case killCode:
|
||||
return noErr;
|
||||
/*case kFormat:
|
||||
case kFormat:
|
||||
if (!c->status.diskInPlace || c->status.writeProt ||
|
||||
!c->ramdisk) { return controlErr; }
|
||||
long zero[32];
|
||||
for (int i = 0; i < 32; i++) { zero[i] = 0; }
|
||||
for (int i = 0; i < 32; i++) {
|
||||
copy24((Ptr)zero, c->ramdisk + i * sizeof(zero), sizeof(zero));
|
||||
}
|
||||
return noErr;*/
|
||||
char zero = 0;
|
||||
patch24(c->ramdisk, &zero);
|
||||
return noErr;
|
||||
case kVerify:
|
||||
if (!c->status.diskInPlace) { return controlErr; }
|
||||
return noErr;
|
||||
|
5
rdisk.h
5
rdisk.h
@ -35,7 +35,10 @@ typedef struct RDiskStorage_s {
|
||||
} RDiskStorage_t;
|
||||
|
||||
typedef void (*RDiskCopy_t)(Ptr, Ptr, unsigned long);
|
||||
#define copy24(s, d, b) { RDiskCopy_t copy24 = C24; copy24(s, d, b); }
|
||||
#define copy24(s, d, b) { RDiskCopy_t f = C24; f(s, d, b); }
|
||||
|
||||
typedef void (*RDiskPatch_t)(Ptr, Ptr);
|
||||
#define patch24(d, s) { RDiskPatch_t f = P24; f(d, s); }
|
||||
|
||||
#define PackBits_Repeat(count) (-1 * (count - 1))
|
||||
#define PackBits_Literal(count) (count - 1)
|
||||
|
Loading…
Reference in New Issue
Block a user