mirror of
https://github.com/garrettsworkshop/MacIIROMDiskDriver.git
synced 2025-02-06 16:30:06 +00:00
Better copy24
This commit is contained in:
parent
83af6e36f8
commit
27f3f5c947
20
rdisk.c
20
rdisk.c
@ -290,8 +290,6 @@ static void RDiskInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
|
|||||||
c->status.writeProt = 0;
|
c->status.writeProt = 0;
|
||||||
}
|
}
|
||||||
} else { // 24-bit mode
|
} else { // 24-bit mode
|
||||||
// Get address of copy24 routine
|
|
||||||
RDiskCopy_t copy24 = (RDiskCopy_t)RDiskCopy24;
|
|
||||||
// Put RAM disk just past 8MB
|
// Put RAM disk just past 8MB
|
||||||
c->ramdisk = (Ptr)(8 * 1024 * 1024);
|
c->ramdisk = (Ptr)(8 * 1024 * 1024);
|
||||||
// Copy ROM disk image to RAM disk
|
// Copy ROM disk image to RAM disk
|
||||||
@ -345,21 +343,13 @@ OSErr RDiskPrime(IOParamPtr p, DCtlPtr d) {
|
|||||||
if (cmd == aRdCmd) { // Read
|
if (cmd == aRdCmd) { // Read
|
||||||
// Read from disk into buffer.
|
// Read from disk into buffer.
|
||||||
if (*MMU32bit) { BlockMove(disk, p->ioBuffer, p->ioReqCount); }
|
if (*MMU32bit) { BlockMove(disk, p->ioBuffer, p->ioReqCount); }
|
||||||
else {
|
else { copy24(disk, StripAddress(p->ioBuffer), p->ioReqCount); }
|
||||||
// Get address of copy24 routine and then copy
|
|
||||||
RDiskCopy_t copy24 = (RDiskCopy_t)RDiskCopy24;
|
|
||||||
copy24(disk, StripAddress(p->ioBuffer), p->ioReqCount);
|
|
||||||
}
|
|
||||||
} else if (cmd == aWrCmd) { // Write
|
} else if (cmd == aWrCmd) { // Write
|
||||||
// Fail if write protected or RAM disk buffer not set up
|
// Fail if write protected or RAM disk buffer not set up
|
||||||
if (c->status.writeProt || !c->ramdisk) { return wPrErr; }
|
if (c->status.writeProt || !c->ramdisk) { return wPrErr; }
|
||||||
// Write from buffer into disk.
|
// Write from buffer into disk.
|
||||||
if (*MMU32bit) { BlockMove(p->ioBuffer, disk, p->ioReqCount); }
|
if (*MMU32bit) { BlockMove(p->ioBuffer, disk, p->ioReqCount); }
|
||||||
else {
|
else { copy24(StripAddress(p->ioBuffer), disk, p->ioReqCount); }
|
||||||
// Get address of copy24 routine and then copy
|
|
||||||
RDiskCopy_t copy24 = (RDiskCopy_t)RDiskCopy24;
|
|
||||||
copy24(StripAddress(p->ioBuffer), disk, p->ioReqCount);
|
|
||||||
}
|
|
||||||
} else { return noErr; } //FIXME: Fail if cmd isn't read or write?
|
} else { return noErr; } //FIXME: Fail if cmd isn't read or write?
|
||||||
|
|
||||||
// Update count and position/offset, then return
|
// Update count and position/offset, then return
|
||||||
@ -385,11 +375,7 @@ OSErr RDiskControl(CntrlParamPtr p, DCtlPtr d) {
|
|||||||
zero[0] = 0;
|
zero[0] = 0;
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
if (*MMU32bit) { BlockMove(zero, c->ramdisk, sizeof(zero)); }
|
if (*MMU32bit) { BlockMove(zero, c->ramdisk, sizeof(zero)); }
|
||||||
else {
|
else { copy24((Ptr)zero, c->ramdisk, sizeof(zero)); }
|
||||||
// Get address of copy24 routine and then copy
|
|
||||||
RDiskCopy_t copy24 = (RDiskCopy_t)RDiskCopy24;
|
|
||||||
copy24((Ptr)zero, c->ramdisk, sizeof(zero));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return noErr;
|
return noErr;
|
||||||
case kVerify:
|
case kVerify:
|
||||||
|
2
rdisk.h
2
rdisk.h
@ -47,6 +47,8 @@ typedef struct RDiskStorage_s {
|
|||||||
#endif
|
#endif
|
||||||
} RDiskStorage_t;
|
} RDiskStorage_t;
|
||||||
|
|
||||||
|
#define copy24(s, d, b) { RDiskCopy_t copy24 = (RDiskCopy_t)RDiskCopy24; copy24(s, d, b); }
|
||||||
|
|
||||||
#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)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user