mirror of
https://github.com/sheumann/NetDisk.git
synced 2024-09-10 10:54:34 +00:00
Split out non-trivial driver ops into separate functions.
This commit is contained in:
parent
9e9e7be0f8
commit
e6b1c304d3
@ -10,8 +10,11 @@ ForceLCBank1 start
|
||||
short i,m
|
||||
lda >STATEREG ;get original state reg.
|
||||
tax
|
||||
php
|
||||
sei
|
||||
lda >LCBANK1 ;force LC bank 1
|
||||
lda >LCBANK1
|
||||
plp
|
||||
long i,m
|
||||
txa
|
||||
rtl
|
||||
@ -21,8 +24,11 @@ ForceLCBank2 start
|
||||
short i,m
|
||||
lda >STATEREG ;get original state reg.
|
||||
tax
|
||||
php
|
||||
sei
|
||||
lda >LCBANK2 ;force LC bank 2
|
||||
lda >LCBANK2
|
||||
plp
|
||||
long i,m
|
||||
txa
|
||||
rtl
|
||||
@ -32,8 +38,11 @@ ForceRomIn start
|
||||
short i,m
|
||||
lda >STATEREG ;get original state reg.
|
||||
tax
|
||||
php
|
||||
sei
|
||||
lda >ROMIN ;force ROM in to Language Card space
|
||||
lda >ROMIN
|
||||
plp
|
||||
long i,m
|
||||
txa
|
||||
rtl
|
||||
|
58
driver.c
58
driver.c
@ -10,6 +10,10 @@ struct DIBList dibList = {NDIBS};
|
||||
|
||||
struct GSOSDP *gsosDP = (void*)0x00BD00; /* GS/OS direct page ptr */
|
||||
|
||||
static Word DoRead(struct GSOSDP *dp);
|
||||
static Word DoStatus(struct GSOSDP *dp);
|
||||
static Word DoEject(struct GSOSDP *dp);
|
||||
static Word DoShutdown(struct GSOSDP *dp);
|
||||
|
||||
void InitDIBs(void) {
|
||||
for (unsigned i = 0; i < NDIBS; i++) {
|
||||
@ -51,7 +55,7 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
||||
break;
|
||||
|
||||
case Driver_Read:
|
||||
//TODO
|
||||
retVal = DoRead(dp);
|
||||
break;
|
||||
|
||||
case Driver_Write:
|
||||
@ -63,20 +67,7 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
||||
case Driver_Status:
|
||||
switch (dp->statusCode) {
|
||||
case Get_Device_Status:
|
||||
if (dp->requestCount < 2) {
|
||||
dp->transferCount = 0;
|
||||
retVal = drvrBadParm;
|
||||
break;
|
||||
}
|
||||
//TODO handle actual disk, and disk-switched logic
|
||||
/* no disk in drive, ... */
|
||||
((DeviceStatusRec*)dp->statusListPtr)->statusWord = 0;
|
||||
if (dp->requestCount < 6) {
|
||||
dp->transferCount = 2;
|
||||
break;
|
||||
}
|
||||
((DeviceStatusRec*)dp->statusListPtr)->numBlocks = 0;
|
||||
dp->requestCount = 6;
|
||||
retVal = DoStatus(dp);
|
||||
break;
|
||||
|
||||
case Get_Config_Parameters:
|
||||
@ -121,7 +112,7 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
||||
case Driver_Control:
|
||||
switch (dp->controlCode) {
|
||||
case eject:
|
||||
//TODO
|
||||
retVal = DoEject(dp);
|
||||
break;
|
||||
|
||||
case setConfigParameters:
|
||||
@ -174,7 +165,7 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
||||
break;
|
||||
|
||||
case Driver_Shutdown:
|
||||
//TODO
|
||||
retVal = DoShutdown(dp);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -185,3 +176,36 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
||||
return retVal;
|
||||
}
|
||||
#pragma databank 0
|
||||
|
||||
|
||||
static Word DoRead(struct GSOSDP *dp) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Word DoStatus(struct GSOSDP *dp) {
|
||||
if (dp->requestCount < 2) {
|
||||
dp->transferCount = 0;
|
||||
return drvrBadParm;
|
||||
}
|
||||
//TODO handle actual disk, and disk-switched logic
|
||||
/* no disk in drive, ... */
|
||||
((DeviceStatusRec*)dp->statusListPtr)->statusWord = 0;
|
||||
if (dp->requestCount < 6) {
|
||||
dp->transferCount = 2;
|
||||
return 0;
|
||||
}
|
||||
((DeviceStatusRec*)dp->statusListPtr)->numBlocks = 0;
|
||||
dp->requestCount = 6;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Word DoEject(struct GSOSDP *dp) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Word DoShutdown(struct GSOSDP *dp) {
|
||||
//TODO
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user