mirror of
https://github.com/sheumann/NetDisk.git
synced 2024-12-21 03:30:02 +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
|
short i,m
|
||||||
lda >STATEREG ;get original state reg.
|
lda >STATEREG ;get original state reg.
|
||||||
tax
|
tax
|
||||||
|
php
|
||||||
|
sei
|
||||||
lda >LCBANK1 ;force LC bank 1
|
lda >LCBANK1 ;force LC bank 1
|
||||||
lda >LCBANK1
|
lda >LCBANK1
|
||||||
|
plp
|
||||||
long i,m
|
long i,m
|
||||||
txa
|
txa
|
||||||
rtl
|
rtl
|
||||||
@ -21,8 +24,11 @@ ForceLCBank2 start
|
|||||||
short i,m
|
short i,m
|
||||||
lda >STATEREG ;get original state reg.
|
lda >STATEREG ;get original state reg.
|
||||||
tax
|
tax
|
||||||
|
php
|
||||||
|
sei
|
||||||
lda >LCBANK2 ;force LC bank 2
|
lda >LCBANK2 ;force LC bank 2
|
||||||
lda >LCBANK2
|
lda >LCBANK2
|
||||||
|
plp
|
||||||
long i,m
|
long i,m
|
||||||
txa
|
txa
|
||||||
rtl
|
rtl
|
||||||
@ -32,8 +38,11 @@ ForceRomIn start
|
|||||||
short i,m
|
short i,m
|
||||||
lda >STATEREG ;get original state reg.
|
lda >STATEREG ;get original state reg.
|
||||||
tax
|
tax
|
||||||
|
php
|
||||||
|
sei
|
||||||
lda >ROMIN ;force ROM in to Language Card space
|
lda >ROMIN ;force ROM in to Language Card space
|
||||||
lda >ROMIN
|
lda >ROMIN
|
||||||
|
plp
|
||||||
long i,m
|
long i,m
|
||||||
txa
|
txa
|
||||||
rtl
|
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 */
|
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) {
|
void InitDIBs(void) {
|
||||||
for (unsigned i = 0; i < NDIBS; i++) {
|
for (unsigned i = 0; i < NDIBS; i++) {
|
||||||
@ -51,7 +55,7 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Driver_Read:
|
case Driver_Read:
|
||||||
//TODO
|
retVal = DoRead(dp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Driver_Write:
|
case Driver_Write:
|
||||||
@ -63,20 +67,7 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
|||||||
case Driver_Status:
|
case Driver_Status:
|
||||||
switch (dp->statusCode) {
|
switch (dp->statusCode) {
|
||||||
case Get_Device_Status:
|
case Get_Device_Status:
|
||||||
if (dp->requestCount < 2) {
|
retVal = DoStatus(dp);
|
||||||
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;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Get_Config_Parameters:
|
case Get_Config_Parameters:
|
||||||
@ -121,7 +112,7 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
|||||||
case Driver_Control:
|
case Driver_Control:
|
||||||
switch (dp->controlCode) {
|
switch (dp->controlCode) {
|
||||||
case eject:
|
case eject:
|
||||||
//TODO
|
retVal = DoEject(dp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case setConfigParameters:
|
case setConfigParameters:
|
||||||
@ -174,7 +165,7 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Driver_Shutdown:
|
case Driver_Shutdown:
|
||||||
//TODO
|
retVal = DoShutdown(dp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -185,3 +176,36 @@ Word DriverDispatch(Word callNum, struct GSOSDP *dp) {
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
#pragma databank 0
|
#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