1
0
mirror of synced 2026-01-26 04:11:05 +00:00

Improvements to the SDPP driver. (#30)

* Mask unimplemented IOCTL message.

* Add build for 286+.

* Optimized IO for 8086.

* Adding pre-build drivers.
This commit is contained in:
Matthieu Bucchianeri
2025-01-03 18:40:38 -08:00
committed by GitHub
parent 374a343198
commit 53caec7569
9 changed files with 57 additions and 37 deletions

View File

@@ -1,3 +1,4 @@
*.obj
*.map
*.sys
log.txt

View File

@@ -6,7 +6,7 @@
{
"label": "Build in DOSBox",
"type": "shell",
"command": "..\\Driver_Build_Tools\\DOSBox\\DOSBox.exe -conf Build.conf",
"command": "..\\Driver_Build_Tools\\DOSBox\\DOSBox.exe -conf Build.conf && copy *.sys ..\\",
"options": {
"cwd": "${workspaceFolder}"
},

View File

@@ -256,13 +256,13 @@ PUBLIC void GenericIOCTL (rh_generic_ioctl_t far *rh)
case GET_ACCESS: ((access_flag_t far *) (rh->packet))->allowed = 1;
rh->rh.status = DONE;
return;
case GET_MEDIA_ID:
case SET_MEDIA_ID:
case SET_ACCESS:
case SET_PARAMETERS:
case FORMAT_TRACK:
rh->rh.status = DONE;
return;
case GET_MEDIA_ID:
default: ;
}
cdprintf("SD: unimplemented IOCTL - unit=%d, major=0x%2x, minor=0x%2x\n",
@@ -367,8 +367,14 @@ PUBLIC void Initialize (rh_init_t far *rh)
WORD brkadr, reboot[2]; int status, i;
/* The version number is sneakily stored in the device header! */
cdprintf("SD Card driver for XTMax\n based on SD pport device driver V%c.%c (C) 2014 by Dan Marks\n based on TU58 by Robert Armstrong\n",
header.name[6], header.name[7]);
cdprintf("SD Card driver V%c.%c for XTMax (%s)\n based on SD pport device driver (C) 2014 by Dan Marks\n based on TU58 by Robert Armstrong\n",
header.name[6], header.name[7],
#ifdef USE286
"80286+"
#else
"8086"
#endif
);
/* Parse the options from the CONFIG.SYS file, if any... */
if (!parse_options((char far *) rh->bpbtbl)) {

View File

@@ -129,7 +129,7 @@ _header DD -1 ; link to the next device
DW DGROUP:STRATEGY ; address of the strategy routine
DW DGROUP:INTERRUPT; " " " interrupt "
DB 1 ; number of drives
DB 'SDCDv11' ; DOS doesn't really use these bytes
DB 'SDCDv12' ; DOS doesn't really use these bytes
; The geometry (sectors/track, tracks/cylinder) defined in the BPB is rather
; arbitrary in the case of the TU58, but there are things to watch out for.

View File

@@ -3,24 +3,30 @@
CC=bcc -c -ms -Z -O -Ol -Oe
ASM=tasm -mx
.c.obj:
$(CC) $<
DEPS=cprint.c driver.c sd.c sdmm.c cprint.h diskio.h driver.h integer.h sd.h standard.h
all: sd.sys sd286.sys
.asm.obj:
$(ASM) $*
sd.sys: header.obj cprint.obj sd.obj sdmm.obj driver.obj
tlink -t -m -s -n header cprint sd sdmm driver, sd.sys
sd.sys: header.obj $(DEPS)
$(CC) cprint.c
$(CC) sd.c
$(CC) sdmm.c
$(CC) driver.c
tlink -t -m -s -n header cprint sd sdmm driver, $@
sd.com: header.obj cprint.obj sd.obj sdmm.obj driver.obj
tlink -t -m -s -n header cprint sd sdmm driver, sd.sys
rename sd.sys sd.com
sd286.sys: header.obj $(DEPS)
$(CC) -1 -DUSE286 cprint.c
$(CC) -1 -DUSE286 sd.c
$(CC) -1 -DUSE286 sdmm.c
$(CC) -1 -DUSE286 driver.c
tlink -t -m -s -n header cprint sd sdmm driver, $@
clean:
del *.obj
del sd.sys
del *.map
del *.sys
driver.obj: cprint.c sdmm.c driver.c cprint.c cprint.h standard.h driver.h sd.h
sd.obj: sd.c sd.h standard.h driver.h
sdmm.obj: sdmm.c diskio.h integer.h
header.obj: header.asm

Binary file not shown.

View File

@@ -187,14 +187,21 @@ void xmit_mmc (
UINT bc /* Number of bytes to send */
)
{
#if 1
BYTE d;
do {
d = *buff++; /* Get a byte to be sent */
outp(DATAPORT, d);
} while (--bc);
#ifndef USE286
_asm {
mov cx,bc
mov dx,DATAPORT
push ds
lds si,dword ptr buff
}
repeat:
_asm {
lodsb
out dx, al
loop repeat
pop ds
}
#else
// Requires to add `-2' in the CC command line in the Makefile.
_asm {
mov cx,bc
mov dx,DATAPORT
@@ -218,15 +225,21 @@ void rcvr_mmc (
UINT bc /* Number of bytes to receive */
)
{
#if 1
BYTE r;
do {
r = inp(DATAPORT);
*buff++ = r; /* Store a received byte */
} while (--bc);
#ifndef USE286
_asm {
mov cx,bc
mov dx,DATAPORT
push es
les di,dword ptr buff
}
repeat:
_asm {
in al, dx
stosb
loop repeat
pop es
}
#else
// Requires to add `-2' in the CC command line in the Makefile.
_asm {
mov cx,bc
mov dx,DATAPORT
@@ -268,9 +281,6 @@ static
void deselect (void)
{
outp(CONTROLPORT, 1); // CS high
#if 0
outp(DATAPORT, 0xFF); /* Dummy clock (force DO hi-z for multiple slave SPI) */
#endif
}
@@ -285,9 +295,6 @@ int select (void) /* 1:OK, 0:Timeout */
BYTE d;
outp(CONTROLPORT, 0); // CS low
#if 0
(void)inp(DATAPORT); /* Dummy clock (force DO enabled) */
#endif
if (wait_ready()) return 1; /* OK */
deselect();