rearrange functions again

This commit is contained in:
Zane Kaminski 2021-04-02 01:16:47 -04:00
parent a6a136e5cd
commit 980eed4c88
4 changed files with 11 additions and 13 deletions

Binary file not shown.

Binary file not shown.

19
rdisk.c
View File

@ -53,9 +53,8 @@ void C24(Ptr sourcePtr, Ptr destPtr, unsigned long byteCount) {
} }
// Switch to 32-bit mode and patch // Switch to 32-bit mode and patch
typedef void (*RDiskPatch_t)(Ptr, char*);
#pragma parameter P24(__A0, __A1) #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; signed char mode = true32b;
SwapMMUMode(&mode); SwapMMUMode(&mode);
*ptr = *patch; // Patch byte *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 // Patch debug and CD-ROM enable bytes
if (c->ramdisk) { if (c->ramdisk) {
RDiskPatch_t fun = P24; if (!dbgEN /*&& *RDiskDBGDisPos >= 0*/) { patch24(c->ramdisk + 0x00000031UL, RDiskDBGDisByte); }
if (!dbgEN /*&& *RDiskDBGDisPos >= 0*/) { fun(c->ramdisk + 0x00000031UL, RDiskDBGDisByte); } if (!cdrEN /*&& *RDiskCDRDisPos >= 0*/) { patch24(c->ramdisk + 0x00012CAFUL, RDiskCDRDisByte); }
if (!cdrEN /*&& *RDiskCDRDisPos >= 0*/) { fun(c->ramdisk + 0x00012CAFUL, RDiskCDRDisByte); }
} }
// Unmount if not booting from ROM disk // Unmount if not booting from ROM disk
@ -234,15 +232,12 @@ OSErr RDCtl(CntrlParamPtr p, DCtlPtr d) {
switch (p->csCode) { switch (p->csCode) {
case killCode: case killCode:
return noErr; return noErr;
/*case kFormat: case kFormat:
if (!c->status.diskInPlace || c->status.writeProt || if (!c->status.diskInPlace || c->status.writeProt ||
!c->ramdisk) { return controlErr; } !c->ramdisk) { return controlErr; }
long zero[32]; char zero = 0;
for (int i = 0; i < 32; i++) { zero[i] = 0; } patch24(c->ramdisk, &zero);
for (int i = 0; i < 32; i++) { return noErr;
copy24((Ptr)zero, c->ramdisk + i * sizeof(zero), sizeof(zero));
}
return noErr;*/
case kVerify: case kVerify:
if (!c->status.diskInPlace) { return controlErr; } if (!c->status.diskInPlace) { return controlErr; }
return noErr; return noErr;

View File

@ -35,7 +35,10 @@ typedef struct RDiskStorage_s {
} RDiskStorage_t; } RDiskStorage_t;
typedef void (*RDiskCopy_t)(Ptr, Ptr, unsigned long); 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_Repeat(count) (-1 * (count - 1))
#define PackBits_Literal(count) (count - 1) #define PackBits_Literal(count) (count - 1)