mirror of
https://github.com/garrettsworkshop/ROMBUSDriver.git
synced 2024-11-28 12:51:43 +00:00
Rename stuff to ROMBUS/RB
This commit is contained in:
parent
3d1073a665
commit
2cc1076981
12
Makefile
12
Makefile
@ -5,7 +5,7 @@ LD=$(PREFIX)-ld
|
|||||||
OBJCOPY=$(PREFIX)-objcopy
|
OBJCOPY=$(PREFIX)-objcopy
|
||||||
OBJDUMP=$(PREFIX)-objdump
|
OBJDUMP=$(PREFIX)-objdump
|
||||||
|
|
||||||
all: bin/ROMBUS.bin obj/rdisk.s obj/driver.s obj/driver_abs.sym
|
all: bin/ROMBUS.bin obj/rombus.s obj/driver.s obj/driver_abs.sym
|
||||||
|
|
||||||
obj:
|
obj:
|
||||||
mkdir $@
|
mkdir $@
|
||||||
@ -20,14 +20,14 @@ obj/entry_rel.sym: obj obj/entry.o
|
|||||||
$(OBJDUMP) -t obj/entry.o > $@
|
$(OBJDUMP) -t obj/entry.o > $@
|
||||||
|
|
||||||
|
|
||||||
obj/rdisk.o: rdisk.c obj
|
obj/rombus.o: rombus.c obj
|
||||||
$(CC) -Wall -march=68030 -c -Os $< -o $@
|
$(CC) -Wall -march=68030 -c -Os $< -o $@
|
||||||
|
|
||||||
obj/rdisk.s: obj obj/rdisk.o
|
obj/rombus.s: obj obj/rombus.o
|
||||||
$(OBJDUMP) -d obj/rdisk.o > $@
|
$(OBJDUMP) -d obj/rombus.o > $@
|
||||||
|
|
||||||
obj/driver.o: obj obj/entry.o obj/rdisk.o
|
obj/driver.o: obj obj/entry.o obj/rombus.o
|
||||||
$(LD) -Ttext=40851D70 -o $@ obj/entry.o obj/rdisk.o
|
$(LD) -Ttext=40851D70 -o $@ obj/entry.o obj/rombus.o
|
||||||
|
|
||||||
obj/driver.s: obj obj/driver.o
|
obj/driver.s: obj obj/driver.o
|
||||||
$(OBJDUMP) -d obj/driver.o > $@
|
$(OBJDUMP) -d obj/driver.o > $@
|
||||||
|
30
entry.s
30
entry.s
@ -8,49 +8,33 @@
|
|||||||
dc.l 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
dc.l 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
dc.l 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
dc.l 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
|
||||||
RDiskSig:
|
SDiskSig:
|
||||||
.ascii "\5RDisk\0"
|
.ascii "\5SDisk\0"
|
||||||
.align 4
|
|
||||||
RDiskDBGDisPos:
|
|
||||||
dc.l 0x00000031
|
|
||||||
RDiskCDRDisPos:
|
|
||||||
dc.l 0xFFFFFFFF
|
|
||||||
RDiskDBGNameAddr:
|
|
||||||
dc.l 0x4088002A
|
|
||||||
RDiskCDRNameAddr:
|
|
||||||
dc.l 0x00000000
|
|
||||||
RDiskDBGDisByte:
|
|
||||||
dc.b 0x44
|
|
||||||
RDiskCDRDisByte:
|
|
||||||
dc.b 0x44
|
|
||||||
RDiskRAMRequired:
|
|
||||||
.ascii "16"
|
|
||||||
|
|
||||||
.align 4
|
.align 4
|
||||||
RDiskSize:
|
RDiskSize:
|
||||||
dc.l 0x00780000
|
dc.l 0x00780000
|
||||||
|
|
||||||
DOpen:
|
DOpen:
|
||||||
movem.l %A0-%A1, -(%SP)
|
movem.l %A0-%A1, -(%SP)
|
||||||
bsr RDOpen
|
bsr RBOpen
|
||||||
movem.l (%SP)+, %A0-%A1
|
movem.l (%SP)+, %A0-%A1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
DClose:
|
DClose:
|
||||||
movem.l %A0-%A1, -(%SP)
|
movem.l %A0-%A1, -(%SP)
|
||||||
bsr RDClose
|
bsr RBClose
|
||||||
movem.l (%SP)+, %A0-%A1
|
movem.l (%SP)+, %A0-%A1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
DPrime:
|
DPrime:
|
||||||
movem.l %A0-%A1, -(%SP)
|
movem.l %A0-%A1, -(%SP)
|
||||||
bsr RDPrime
|
bsr RBPrime
|
||||||
movem.l (%SP)+, %A0-%A1
|
movem.l (%SP)+, %A0-%A1
|
||||||
bra.b IOReturn
|
bra.b IOReturn
|
||||||
|
|
||||||
DControl:
|
DControl:
|
||||||
movem.l %A0-%A1, -(%SP)
|
movem.l %A0-%A1, -(%SP)
|
||||||
bsr RDCtl
|
bsr RBCtl
|
||||||
movem.l (%SP)+, %A0-%A1
|
movem.l (%SP)+, %A0-%A1
|
||||||
cmpi.w #killCode, kcsCode(%A0)
|
cmpi.w #killCode, kcsCode(%A0)
|
||||||
bne.b IOReturn
|
bne.b IOReturn
|
||||||
@ -58,7 +42,7 @@ DControl:
|
|||||||
|
|
||||||
DStatus:
|
DStatus:
|
||||||
movem.l %A0-%A1, -(%SP)
|
movem.l %A0-%A1, -(%SP)
|
||||||
bsr RDStat
|
bsr RBStat
|
||||||
movem.l (%SP)+, %A0-%A1
|
movem.l (%SP)+, %A0-%A1
|
||||||
|
|
||||||
IOReturn:
|
IOReturn:
|
||||||
|
@ -6,46 +6,56 @@
|
|||||||
#include <Events.h>
|
#include <Events.h>
|
||||||
#include <OSUtils.h>
|
#include <OSUtils.h>
|
||||||
|
|
||||||
#include "rdisk.h"
|
#include "rombus.h"
|
||||||
|
|
||||||
// Decode keyboard/PRAM settings
|
// Decode keyboard/PRAM settings
|
||||||
static void RDDecodeSettings(Ptr unmountEN, Ptr mountEN, Ptr dbgEN, Ptr cdrEN) {
|
static void RBDecodeSettings(Ptr unmountROMEN, Ptr mountROMEN, Ptr unmountSDEN, Ptr mountSDEN) {
|
||||||
// Sample R key repeatedly
|
// Sample R, S, X keys repeatedly
|
||||||
char r = 0;
|
char r = 0, s = 0, x = 0;
|
||||||
long tmax = TickCount() + 60;
|
long tmax = TickCount() + 60;
|
||||||
for (long i = 0; i < 1000000; i++) {
|
for (long i = 0; i < 1000000; i++) {
|
||||||
r |= RDiskIsRPressed();
|
r |= RBIsRPressed();
|
||||||
if (r) { break; }
|
s |= RBIsSPressed();
|
||||||
|
x |= RBIsXPressed();
|
||||||
|
if (r || s || x) { break; }
|
||||||
if (TickCount() > tmax) { break; }
|
if (TickCount() > tmax) { break; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read PRAM
|
// Read PRAM
|
||||||
char legacy_startup;
|
char legacy_startup;
|
||||||
RDiskReadXPRAM(1, 4, &legacy_startup);
|
RBReadXPRAM(1, 4, &legacy_startup);
|
||||||
|
|
||||||
// Decode settings: unmount (don't boot), mount (after boot), RAM disk
|
// Decode settings: unmount (don't boot), mount (after boot), RAM disk
|
||||||
if (r) { // R boots from ROM disk
|
if (x) { // X disables ROM disk and SD
|
||||||
*unmountEN = 0; // Don't unmount so we boot from this drive
|
*unmountROMEN = 1; // Unmount ROM disk volume
|
||||||
*mountEN = 0; // No need to mount later since we are boot disk
|
*mountROMEN = 0; // Don't mount ROM later
|
||||||
*dbgEN = 0;
|
*unmountSDEN = 1; // Unmount SD volume
|
||||||
*cdrEN = 0;
|
*mountSDEN = 0; // Don't mount SD later
|
||||||
|
} else if (r) { // R boots from ROM disk and mount SD later
|
||||||
|
*unmountROMEN = 0; // Don't unmount so we boot from ROM
|
||||||
|
*mountROMEN = 0; // No need to mount ROM later since already mounted
|
||||||
|
*unmountSDEN = 1; // Unmount SD volume so we don't boot from it
|
||||||
|
*mountSDEN = 1; // Mount SD later
|
||||||
|
} else if (s) { // S boots from SD
|
||||||
|
*unmountROMEN = 1; // Unmount ROM disk volume so we don't boot from it
|
||||||
|
*mountROMEN = 1; // Mount ROM disk later
|
||||||
|
*unmountSDEN = 0; // Don't unmount so we boot from SD
|
||||||
|
*mountSDEN = 0; // No need to mount SD later since already mounted
|
||||||
|
} else if (legacy_startup & 0x04) { // Boot from SD
|
||||||
|
*unmountROMEN = 1; // Unmount ROM disk volume so we don't boot from it
|
||||||
|
*mountROMEN = !(legacy_startup & 0x02); // Mount ROM disk later if setting
|
||||||
|
*unmountSDEN = 0; // Don't unmount so we boot from SD
|
||||||
|
*mountSDEN = 0; // No need to mount later since already mounted
|
||||||
|
} else if (legacy_startup & 0x01) { // Boot from ROM
|
||||||
|
*unmountROMEN = 0; // Don't unmount so we boot from ROM
|
||||||
|
*mountROMEN = 0; // No need to mount later since already mounted
|
||||||
|
*unmountSDEN = 1; // Unmount SD volume so we don't boot from it
|
||||||
|
*mountSDEN = !(legacy_startup & 0x08); // Mount SD later if setting
|
||||||
} else {
|
} else {
|
||||||
if (legacy_startup & 0x01) { // Boot from ROM disk
|
*unmountROMEN = 1; // Unmount ROM disk volume so we don't boot from it
|
||||||
*unmountEN = 0; // Don't unmount so we boot from this drive
|
*mountROMEN = !(legacy_startup & 0x02); // Mount ROM disk later if setting
|
||||||
*mountEN = 0; // No need to mount later since we are boot disk
|
*unmountSDEN = 1; // Unmount SD volume so we don't boot from it
|
||||||
*dbgEN = legacy_startup & 0x04; // MacsBug enabled if bit 2 == 1
|
*mountSDEN = !(legacy_startup & 0x08); // Mount SD later if setting
|
||||||
*cdrEN = legacy_startup & 0x08; // CD-ROM enabled if bit 3 == 1
|
|
||||||
} else if (!(legacy_startup & 0x02)) { // Mount ROM disk
|
|
||||||
*unmountEN = 1; // Unmount to not boot from our disk
|
|
||||||
*mountEN = 1; // Mount in accRun
|
|
||||||
*dbgEN = 1; // CD-ROM ext. always enabled in mount mode
|
|
||||||
*cdrEN = 1; // MacsBug always enabled in mount mode
|
|
||||||
} else {
|
|
||||||
*unmountEN = 1; // Unmount
|
|
||||||
*mountEN = 0; // Don't mount again
|
|
||||||
*dbgEN = 1; // CD-ROM ext. always enabled in unmount mode
|
|
||||||
*cdrEN = 1; // MacsBug always enabled in unmount mode
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,19 +68,8 @@ void __attribute__ ((noinline)) C24(Ptr sourcePtr, Ptr destPtr, unsigned long by
|
|||||||
SwapMMUMode(&mode);
|
SwapMMUMode(&mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to 32-bit mode and get
|
|
||||||
#pragma parameter __D0 G24(__A2)
|
|
||||||
char __attribute__ ((noinline)) G24(Ptr pos) {
|
|
||||||
long ret;
|
|
||||||
signed char mode = true32b;
|
|
||||||
SwapMMUMode(&mode);
|
|
||||||
ret = *pos; // Peek
|
|
||||||
SwapMMUMode(&mode);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Figure out the first available drive number >= 5
|
// Figure out the first available drive number >= 5
|
||||||
static int RDFindDrvNum() {
|
static int RBFindDrvNum() {
|
||||||
DrvQElPtr dq;
|
DrvQElPtr dq;
|
||||||
int drvNum = 5;
|
int drvNum = 5;
|
||||||
for (dq = (DrvQElPtr)(GetDrvQHdr())->qHead; dq; dq = (DrvQElPtr)dq->qLink) {
|
for (dq = (DrvQElPtr)(GetDrvQHdr())->qHead; dq; dq = (DrvQElPtr)dq->qLink) {
|
||||||
@ -79,77 +78,66 @@ static int RDFindDrvNum() {
|
|||||||
return drvNum;
|
return drvNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma parameter __D0 RDOpen(__A0, __A1)
|
#pragma parameter __D0 RBOpen(__A0, __A1)
|
||||||
OSErr RDOpen(IOParamPtr p, DCtlPtr d) {
|
OSErr RBOpen(IOParamPtr p, DCtlPtr d) {
|
||||||
int drvNum;
|
int drvNum;
|
||||||
RDiskStorage_t *c;
|
RBStorage_t *c;
|
||||||
char legacy_startup;
|
char legacy_startup;
|
||||||
|
|
||||||
// Do nothing if already opened
|
// Do nothing if already opened
|
||||||
if (d->dCtlStorage) { return noErr; }
|
if (d->dCtlStorage) { return noErr; }
|
||||||
|
|
||||||
// Do nothing if inhibited
|
// Do nothing if inhibited
|
||||||
RDiskReadXPRAM(1, 4, &legacy_startup);
|
RBReadXPRAM(1, 4, &legacy_startup);
|
||||||
if (legacy_startup & 0x80) { return noErr; }
|
if (legacy_startup & 0x80) { return noErr; }
|
||||||
|
|
||||||
// Allocate storage struct
|
// Allocate storage struct
|
||||||
d->dCtlStorage = NewHandleSysClear(sizeof(RDiskStorage_t));
|
d->dCtlStorage = NewHandleSysClear(sizeof(RBStorage_t));
|
||||||
if (!d->dCtlStorage) { return openErr; }
|
if (!d->dCtlStorage) { return openErr; }
|
||||||
|
|
||||||
// Lock our storage struct and get master pointer
|
// Lock our storage struct and get master pointer
|
||||||
HLock(d->dCtlStorage);
|
HLock(d->dCtlStorage);
|
||||||
c = *(RDiskStorage_t**)d->dCtlStorage;
|
c = *(RBStorage_t**)d->dCtlStorage;
|
||||||
|
|
||||||
// Find first available drive number
|
// Find first available drive number
|
||||||
drvNum = RDFindDrvNum();
|
drvNum = RBFindDrvNum();
|
||||||
|
|
||||||
// Get debug and CD-ROM disable settings from ROM table
|
|
||||||
c->dbgDisByte = RDiskDBGDisByte;
|
|
||||||
c->cdrDisByte = RDiskCDRDisByte;
|
|
||||||
|
|
||||||
// Set drive status
|
// Set drive status
|
||||||
//c->status.track = 0;
|
//c->rdStatus.track = 0;
|
||||||
c->status.writeProt = -1; // nonzero is write protected
|
c->rdStatus.writeProt = -1; // nonzero is write protected
|
||||||
c->status.diskInPlace = 8; // 8 is nonejectable disk
|
c->rdStatus.diskInPlace = 8; // 8 is nonejectable disk
|
||||||
c->status.installed = 1; // drive installed
|
c->rdStatus.installed = 1; // drive installed
|
||||||
//c->status.sides = 0;
|
//c->rdStatus.sides = 0;
|
||||||
//c->status.qType = 1;
|
//c->rdStatus.qType = 1;
|
||||||
c->status.dQDrive = drvNum;
|
c->rdStatus.dQDrive = drvNum;
|
||||||
//c->status.dQFSID = 0;
|
//c->rdStatus.dQFSID = 0;
|
||||||
c->status.dQRefNum = d->dCtlRefNum;
|
c->rdStatus.dQRefNum = d->dCtlRefNum;
|
||||||
c->status.driveSize = RDiskSize / 512;
|
c->rdStatus.driveSize = RDiskSize / 512;
|
||||||
//c->status.driveS1 = (RDiskSize / 512) >> 16;
|
//c->rdStatus.driveS1 = (RDiskSize / 512) >> 16;
|
||||||
|
|
||||||
// Decompress icon
|
// Decompress icons
|
||||||
#ifdef RDISK_COMPRESS_ICON_ENABLE
|
|
||||||
char *src = &RDiskIconCompressed[0];
|
char *src = &RDiskIconCompressed[0];
|
||||||
char *dst = &c->icon[0];
|
char *dst = &c->rdIcon[0];
|
||||||
UnpackBits(&src, &dst, RDISK_ICON_SIZE);
|
UnpackBits(&src, &dst, RDISK_ICON_SIZE);
|
||||||
#endif
|
src = &SDiskIconCompressed[0];
|
||||||
|
dst = &c->sdIcon[0];
|
||||||
|
UnpackBits(&src, &dst, SDISK_ICON_SIZE);
|
||||||
|
|
||||||
// Add drive to drive queue and return
|
// Add drive to drive queue and return
|
||||||
RDiskAddDrive(c->status.dQRefNum, drvNum, (DrvQElPtr)&c->status.qLink);
|
RBAddDrive(c->rdStatus.dQRefNum, drvNum, (DrvQElPtr)&c->rdStatus.qLink);
|
||||||
return noErr;
|
return noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init is called at beginning of first prime (read/write) call
|
// Init is called at beginning of first prime (read/write) call
|
||||||
static void RDInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
|
static void RBInit(IOParamPtr p, DCtlPtr d, RBStorage_t *c) {
|
||||||
char unmountEN, mountEN, dbgEN, cdrEN;
|
char unmountEN, mountEN, dbgEN, cdrEN;
|
||||||
// Mark init done
|
// Mark init done
|
||||||
c->initialized = 1;
|
c->initialized = 1;
|
||||||
// Decode settings
|
// Decode settings
|
||||||
RDDecodeSettings(&unmountEN, &mountEN, &dbgEN, &cdrEN);
|
RBDecodeSettings(&unmountEN, &mountEN, &dbgEN, &cdrEN);
|
||||||
|
|
||||||
// Patch
|
|
||||||
if (dbgEN && RDiskDBGDisPos < RDiskSize) {
|
|
||||||
peek24(RDiskBuf + RDiskDBGDisPos, c->dbgDisByte);
|
|
||||||
}
|
|
||||||
if (cdrEN && RDiskCDRDisPos < RDiskSize) {
|
|
||||||
peek24(RDiskBuf + RDiskCDRDisPos, c->cdrDisByte);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unmount if not booting from ROM disk
|
// Unmount if not booting from ROM disk
|
||||||
if (unmountEN) { c->status.diskInPlace = 0; }
|
if (unmountEN) { c->rdStatus.diskInPlace = 0; }
|
||||||
|
|
||||||
// If mount enabled, enable accRun to post disk inserted event later
|
// If mount enabled, enable accRun to post disk inserted event later
|
||||||
if (mountEN) {
|
if (mountEN) {
|
||||||
@ -158,24 +146,24 @@ static void RDInit(IOParamPtr p, DCtlPtr d, RDiskStorage_t *c) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma parameter __D0 RDPrime(__A0, __A1)
|
#pragma parameter __D0 RBPrime(__A0, __A1)
|
||||||
OSErr RDPrime(IOParamPtr p, DCtlPtr d) {
|
OSErr RBPrime(IOParamPtr p, DCtlPtr d) {
|
||||||
RDiskStorage_t *c;
|
RBStorage_t *c;
|
||||||
char cmd;
|
char cmd;
|
||||||
Ptr disk;
|
Ptr disk;
|
||||||
|
|
||||||
// Return disk offline error if dCtlStorage null
|
// Return disk offline error if dCtlStorage null
|
||||||
if (!d->dCtlStorage) { return notOpenErr; }
|
if (!d->dCtlStorage) { return notOpenErr; }
|
||||||
// Dereference dCtlStorage to get pointer to our context
|
// Dereference dCtlStorage to get pointer to our context
|
||||||
c = *(RDiskStorage_t**)d->dCtlStorage;
|
c = *(RBStorage_t**)d->dCtlStorage;
|
||||||
|
|
||||||
// Initialize if this is the first prime call
|
// Initialize if this is the first prime call
|
||||||
if (!c->initialized) { RDInit(p, d, c); }
|
if (!c->initialized) { RBInit(p, d, c); }
|
||||||
|
|
||||||
// Return disk offline error if virtual disk not inserted
|
// Return disk offline error if virtual disk not inserted
|
||||||
if (!c->status.diskInPlace) { return offLinErr; }
|
if (!c->rdStatus.diskInPlace) { return offLinErr; }
|
||||||
|
|
||||||
// Get pointer to RAM or ROM disk buffer
|
// Get pointer to ROM disk buffer
|
||||||
disk = RDiskBuf + d->dCtlPosition;
|
disk = RDiskBuf + d->dCtlPosition;
|
||||||
// Bounds checking
|
// Bounds checking
|
||||||
if (d->dCtlPosition >= RDiskSize || p->ioReqCount >= RDiskSize ||
|
if (d->dCtlPosition >= RDiskSize || p->ioReqCount >= RDiskSize ||
|
||||||
@ -187,14 +175,6 @@ OSErr RDPrime(IOParamPtr p, DCtlPtr d) {
|
|||||||
// 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 { copy24(disk, StripAddress(p->ioBuffer), p->ioReqCount); }
|
else { copy24(disk, StripAddress(p->ioBuffer), p->ioReqCount); }
|
||||||
if (RDiskDBGDisPos >= d->dCtlPosition &&
|
|
||||||
RDiskDBGDisPos < d->dCtlPosition + p->ioReqCount) {
|
|
||||||
p->ioBuffer[RDiskDBGDisPos - d->dCtlPosition] = c->dbgDisByte;
|
|
||||||
}
|
|
||||||
if (RDiskCDRDisPos >= d->dCtlPosition &&
|
|
||||||
RDiskCDRDisPos < d->dCtlPosition + p->ioReqCount) {
|
|
||||||
p->ioBuffer[RDiskCDRDisPos - d->dCtlPosition] = c->cdrDisByte;
|
|
||||||
}
|
|
||||||
} else if (cmd == aWrCmd) { return wPrErr;
|
} else if (cmd == aWrCmd) { return wPrErr;
|
||||||
} else { return noErr; } //FIXME: Fail if cmd isn't read or write?
|
} else { return noErr; } //FIXME: Fail if cmd isn't read or write?
|
||||||
|
|
||||||
@ -204,37 +184,33 @@ OSErr RDPrime(IOParamPtr p, DCtlPtr d) {
|
|||||||
return noErr;
|
return noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma parameter __D0 RDCtl(__A0, __A1)
|
#pragma parameter __D0 RBCtl(__A0, __A1)
|
||||||
OSErr RDCtl(CntrlParamPtr p, DCtlPtr d) {
|
OSErr RBCtl(CntrlParamPtr p, DCtlPtr d) {
|
||||||
RDiskStorage_t *c;
|
RBStorage_t *c;
|
||||||
// Fail if dCtlStorage null
|
// Fail if dCtlStorage null
|
||||||
if (!d->dCtlStorage) { return notOpenErr; }
|
if (!d->dCtlStorage) { return notOpenErr; }
|
||||||
// Dereference dCtlStorage to get pointer to our context
|
// Dereference dCtlStorage to get pointer to our context
|
||||||
c = *(RDiskStorage_t**)d->dCtlStorage;
|
c = *(RBStorage_t**)d->dCtlStorage;
|
||||||
// Handle control request based on csCode
|
// Handle control request based on csCode
|
||||||
switch (p->csCode) {
|
switch (p->csCode) {
|
||||||
case killCode: return noErr;
|
case killCode: return noErr;
|
||||||
case kFormat: return controlErr;
|
case kFormat: return controlErr;
|
||||||
case kVerify:
|
case kVerify:
|
||||||
if (!c->status.diskInPlace) { return controlErr; }
|
if (!c->rdStatus.diskInPlace) { return controlErr; }
|
||||||
return noErr;
|
return noErr;
|
||||||
case kEject:
|
case kEject:
|
||||||
// "Reinsert" disk if ejected illegally
|
// "Reinsert" disk if ejected illegally
|
||||||
if (c->status.diskInPlace) {
|
if (c->rdStatus.diskInPlace) {
|
||||||
PostEvent(diskEvt, c->status.dQDrive);
|
PostEvent(diskEvt, c->rdStatus.dQDrive);
|
||||||
}
|
}
|
||||||
return controlErr; // Eject not allowed so return error
|
return controlErr; // Eject not allowed so return error
|
||||||
case accRun:
|
case accRun:
|
||||||
d->dCtlFlags &= ~dNeedTimeMask; // Disable accRun
|
d->dCtlFlags &= ~dNeedTimeMask; // Disable accRun
|
||||||
c->status.diskInPlace = 8; // 8 is nonejectable disk
|
c->rdStatus.diskInPlace = 8; // 8 is nonejectable disk
|
||||||
PostEvent(diskEvt, c->status.dQDrive); // Post disk inserted event
|
PostEvent(diskEvt, c->rdStatus.dQDrive); // Post disk inserted event
|
||||||
return noErr;
|
return noErr;
|
||||||
case kDriveIcon: case kMediaIcon: // Get icon
|
case kDriveIcon: case kMediaIcon: // Get icon
|
||||||
#ifdef RDISK_COMPRESS_ICON_ENABLE
|
*(Ptr*)p->csParam = (Ptr)c->rdIcon;
|
||||||
*(Ptr*)p->csParam = (Ptr)c->icon;
|
|
||||||
#else
|
|
||||||
*(Ptr*)p->csParam = (Ptr)RDiskIcon;
|
|
||||||
#endif
|
|
||||||
return noErr;
|
return noErr;
|
||||||
case kDriveInfo:
|
case kDriveInfo:
|
||||||
// high word (bytes 2 & 3) clear
|
// high word (bytes 2 & 3) clear
|
||||||
@ -254,27 +230,27 @@ OSErr RDCtl(CntrlParamPtr p, DCtlPtr d) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma parameter __D0 RDStat(__A0, __A1)
|
#pragma parameter __D0 RBStat(__A0, __A1)
|
||||||
OSErr RDStat(CntrlParamPtr p, DCtlPtr d) {
|
OSErr RBStat(CntrlParamPtr p, DCtlPtr d) {
|
||||||
//RDiskStorage_t *c;
|
RBStorage_t *c;
|
||||||
// Fail if dCtlStorage null
|
// Fail if dCtlStorage null
|
||||||
if (!d->dCtlStorage) { return notOpenErr; }
|
if (!d->dCtlStorage) { return notOpenErr; }
|
||||||
// Dereference dCtlStorage to get pointer to our context
|
// Dereference dCtlStorage to get pointer to our context
|
||||||
//c = *(RDiskStorage_t**)d->dCtlStorage;
|
c = *(RBStorage_t**)d->dCtlStorage;
|
||||||
// Handle status request based on csCode
|
// Handle status request based on csCode
|
||||||
switch (p->csCode) {
|
switch (p->csCode) {
|
||||||
case kDriveStatus:
|
case kDriveStatus:
|
||||||
BlockMove(*d->dCtlStorage, &p->csParam, sizeof(DrvSts2));
|
BlockMove(&c->rdStatus, &p->csParam, sizeof(DrvSts2));
|
||||||
return noErr;
|
return noErr;
|
||||||
default: return statusErr;
|
default: return statusErr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma parameter __D0 RDClose(__A0, __A1)
|
#pragma parameter __D0 RBClose(__A0, __A1)
|
||||||
OSErr RDClose(IOParamPtr p, DCtlPtr d) {
|
OSErr RBClose(IOParamPtr p, DCtlPtr d) {
|
||||||
// If dCtlStorage not null, dispose of it
|
// If dCtlStorage not null, dispose of it
|
||||||
if (!d->dCtlStorage) { return noErr; }
|
if (!d->dCtlStorage) { return noErr; }
|
||||||
//RDiskStorage_t *c = *(RDiskStorage_t**)d->dCtlStorage;
|
//RBStorage_t *c = *(RBStorage_t**)d->dCtlStorage;
|
||||||
HUnlock(d->dCtlStorage);
|
HUnlock(d->dCtlStorage);
|
||||||
DisposeHandle(d->dCtlStorage);
|
DisposeHandle(d->dCtlStorage);
|
||||||
d->dCtlStorage = NULL;
|
d->dCtlStorage = NULL;
|
@ -1,50 +1,41 @@
|
|||||||
#ifndef RDISK_H
|
#ifndef ROMBUS_H
|
||||||
#define RDISK_H
|
#define ROMBUS_H
|
||||||
|
#include <Quickdraw.h>
|
||||||
|
|
||||||
#define RDiskBuf ((char*)0x40880000)
|
#define RDiskBuf ((char*)0x40880000)
|
||||||
#define BufPtr ((Ptr*)0x10C)
|
#define BufPtr ((Ptr*)0x10C)
|
||||||
#define MemTop ((Ptr*)0x108)
|
#define MemTop ((Ptr*)0x108)
|
||||||
#define MMU32bit ((char*)0xCB2)
|
#define MMU32bit ((char*)0xCB2)
|
||||||
|
|
||||||
#define RDiskDBGDisPos (*(const unsigned long*)0x40851D98)
|
|
||||||
#define RDiskCDRDisPos (*(const unsigned long*)0x40851D9C)
|
|
||||||
#define RDiskDBGDisByte (*(const char*)0x40851DA8)
|
|
||||||
#define RDiskCDRDisByte (*(const char*)0x40851DA9)
|
|
||||||
#define RDiskSize (*(const unsigned long*)0x40851DAC)
|
#define RDiskSize (*(const unsigned long*)0x40851DAC)
|
||||||
|
|
||||||
#define RDISK_COMPRESS_ICON_ENABLE
|
#pragma parameter __D0 RBReadXPRAM(__D0, __D1, __A0)
|
||||||
|
OSErr RBReadXPRAM(short numBytes, short whichByte, Ptr dest) = {0x4840, 0x3001, 0xA051};
|
||||||
|
|
||||||
#pragma parameter __D0 RDiskReadXPRAM(__D0, __D1, __A0)
|
#pragma parameter __D0 RBAddDrive(__D1, __D0, __A0)
|
||||||
OSErr RDiskReadXPRAM(short numBytes, short whichByte, Ptr dest) = {0x4840, 0x3001, 0xA051};
|
OSErr RBAddDrive(short drvrRefNum, short drvNum, DrvQElPtr dq) = {0x4840, 0x3001, 0xA04E};
|
||||||
|
|
||||||
#pragma parameter __D0 RDiskAddDrive(__D1, __D0, __A0)
|
static inline char RBIsSPressed() { return *((volatile char*)0x174) & 0x02; }
|
||||||
OSErr RDiskAddDrive(short drvrRefNum, short drvNum, DrvQElPtr dq) = {0x4840, 0x3001, 0xA04E};
|
static inline char RBIsXPressed() { return *((volatile char*)0x174) & 0x80; }
|
||||||
|
static inline char RBIsRPressed() { return *((volatile char*)0x175) & 0x80; }
|
||||||
static inline char RDiskIsRPressed() { return *((volatile char*)0x175) & 0x80; }
|
|
||||||
|
|
||||||
#define RDISK_ICON_SIZE (285)
|
#define RDISK_ICON_SIZE (285)
|
||||||
typedef struct RDiskStorage_s {
|
#define SDISK_ICON_SIZE (285)
|
||||||
DrvSts2 status;
|
typedef struct RBStorage_s {
|
||||||
|
DrvSts2 rdStatus;
|
||||||
|
DrvSts2 sdStatus;
|
||||||
char initialized;
|
char initialized;
|
||||||
char dbgDisByte;
|
char rdIcon[RDISK_ICON_SIZE+8];
|
||||||
char cdrDisByte;
|
char sdIcon[SDISK_ICON_SIZE+8];
|
||||||
#ifdef RDISK_COMPRESS_ICON_ENABLE
|
} RBStorage_t;
|
||||||
char icon[RDISK_ICON_SIZE+8];
|
|
||||||
#endif
|
|
||||||
} RDiskStorage_t;
|
|
||||||
|
|
||||||
typedef void (*RDiskCopy_t)(Ptr, Ptr, unsigned long);
|
typedef void (*RBCopy_t)(Ptr, Ptr, unsigned long);
|
||||||
#define copy24(s, d, b) { RDiskCopy_t f = C24; f(s, d, b); }
|
#define copy24(s, d, b) { RBCopy_t f = C24; f(s, d, b); }
|
||||||
|
|
||||||
typedef char (*RDiskPeek_t)(Ptr);
|
|
||||||
#define peek24(a, d) { RDiskPeek_t f = G24; d = f(a); }
|
|
||||||
|
|
||||||
#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)
|
||||||
|
|
||||||
#define RDISK_COMPRESSED_ICON_SIZE (87)
|
#define RDISK_COMPRESSED_ICON_SIZE (87)
|
||||||
#ifdef RDISK_COMPRESS_ICON_ENABLE
|
|
||||||
#include <Quickdraw.h>
|
|
||||||
const char RDiskIconCompressed[RDISK_COMPRESSED_ICON_SIZE] = {
|
const char RDiskIconCompressed[RDISK_COMPRESSED_ICON_SIZE] = {
|
||||||
PackBits_Repeat(76), 0b00000000, /*
|
PackBits_Repeat(76), 0b00000000, /*
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
@ -127,9 +118,10 @@ const char RDiskIconCompressed[RDISK_COMPRESSED_ICON_SIZE] = {
|
|||||||
'W', 'o', 'r', 'k', 's', 'h', 'o', 'p', ' ',
|
'W', 'o', 'r', 'k', 's', 'h', 'o', 'p', ' ',
|
||||||
'R', 'O', 'M', ' ', 'D', 'i', 's', 'k', 0
|
'R', 'O', 'M', ' ', 'D', 'i', 's', 'k', 0
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
const char RDiskIcon[RDISK_ICON_SIZE] = {
|
#define SDISK_COMPRESSED_ICON_SIZE (86)
|
||||||
// Icon
|
const char SDiskIconCompressed[SDISK_COMPRESSED_ICON_SIZE] = {
|
||||||
|
PackBits_Repeat(76), 0b00000000, /*
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
@ -148,8 +140,10 @@ const char RDiskIcon[RDISK_ICON_SIZE] = {
|
|||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000, */
|
||||||
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
PackBits_Repeat(4), 0b11111111, /*
|
||||||
|
0b11111111, 0b11111111, 0b11111111, 0b11111111, */
|
||||||
|
PackBits_Literal(36),
|
||||||
0b10000000, 0b00000000, 0b00000000, 0b00000001,
|
0b10000000, 0b00000000, 0b00000000, 0b00000001,
|
||||||
0b10001111, 0b00011110, 0b00111100, 0b01111001,
|
0b10001111, 0b00011110, 0b00111100, 0b01111001,
|
||||||
0b10001001, 0b00010010, 0b00100100, 0b01001001,
|
0b10001001, 0b00010010, 0b00100100, 0b01001001,
|
||||||
@ -159,11 +153,12 @@ const char RDiskIcon[RDISK_ICON_SIZE] = {
|
|||||||
0b11000000, 0b00000000, 0b00000000, 0b00000001,
|
0b11000000, 0b00000000, 0b00000000, 0b00000001,
|
||||||
0b01010101, 0b01010101, 0b11010101, 0b01010101,
|
0b01010101, 0b01010101, 0b11010101, 0b01010101,
|
||||||
0b01111111, 0b11111111, 0b01111111, 0b11111111,
|
0b01111111, 0b11111111, 0b01111111, 0b11111111,
|
||||||
|
PackBits_Repeat(12), 0b00000000, /*
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000, */
|
||||||
// Mask
|
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
PackBits_Repeat(76), 0b00000000, /*
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
@ -182,6 +177,8 @@ const char RDiskIcon[RDISK_ICON_SIZE] = {
|
|||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
|
0b00000000, 0b00000000, 0b00000000, 0b00000000, */
|
||||||
|
PackBits_Repeat(32), 0b11111111, /*
|
||||||
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
||||||
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
||||||
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
||||||
@ -189,16 +186,21 @@ const char RDiskIcon[RDISK_ICON_SIZE] = {
|
|||||||
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
||||||
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
||||||
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
||||||
0b11111111, 0b11111111, 0b11111111, 0b11111111,
|
0b11111111, 0b11111111, 0b11111111, 0b11111111, */
|
||||||
0b01111111, 0b11111111, 0b11111111, 0b11111111,
|
PackBits_Literal(1), 0b01111111,
|
||||||
0b01111111, 0b11111111, 0b11111111, 0b11111111,
|
PackBits_Repeat(3), 0b11111111, /*
|
||||||
|
0b01111111, 0b11111111, 0b11111111, 0b11111111, */
|
||||||
|
PackBits_Literal(1), 0b01111111,
|
||||||
|
PackBits_Repeat(3), 0b11111111, /*
|
||||||
|
0b01111111, 0b11111111, 0b11111111, 0b11111111, */
|
||||||
|
PackBits_Repeat(12), 0b00000000, /*
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
||||||
0b00000000, 0b00000000, 0b00000000, 0b00000000,
|
0b00000000, 0b00000000, 0b00000000, 0b00000000, */
|
||||||
27, 'G', 'a', 'r', 'r', 'e', 't', 't', '\'', 's', ' ',
|
PackBits_Literal(29),
|
||||||
|
26, 'G', 'a', 'r', 'r', 'e', 't', 't', '\'', 's', ' ',
|
||||||
'W', 'o', 'r', 'k', 's', 'h', 'o', 'p', ' ',
|
'W', 'o', 'r', 'k', 's', 'h', 'o', 'p', ' ',
|
||||||
'R', 'O', 'M', ' ', 'D', 'i', 's', 'k', 0
|
'S', 'D', ' ', 'D', 'i', 's', 'k', 0
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue
Block a user