diff --git a/XTMax/Drivers/SD.SYS b/XTMax/Drivers/SD.SYS index ebeab06..9e70e2e 100644 Binary files a/XTMax/Drivers/SD.SYS and b/XTMax/Drivers/SD.SYS differ diff --git a/XTMax/Drivers/SD286.SYS b/XTMax/Drivers/SD286.SYS new file mode 100644 index 0000000..8131fd6 Binary files /dev/null and b/XTMax/Drivers/SD286.SYS differ diff --git a/XTMax/Drivers/SDPP/.gitignore b/XTMax/Drivers/SDPP/.gitignore index 37ebf5e..8b3e801 100644 --- a/XTMax/Drivers/SDPP/.gitignore +++ b/XTMax/Drivers/SDPP/.gitignore @@ -1,3 +1,4 @@ *.obj *.map +*.sys log.txt diff --git a/XTMax/Drivers/SDPP/.vscode/tasks.json b/XTMax/Drivers/SDPP/.vscode/tasks.json index b9c2cd2..568385c 100644 --- a/XTMax/Drivers/SDPP/.vscode/tasks.json +++ b/XTMax/Drivers/SDPP/.vscode/tasks.json @@ -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}" }, diff --git a/XTMax/Drivers/SDPP/DRIVER.C b/XTMax/Drivers/SDPP/DRIVER.C index 0e27393..dddd357 100644 --- a/XTMax/Drivers/SDPP/DRIVER.C +++ b/XTMax/Drivers/SDPP/DRIVER.C @@ -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)) { diff --git a/XTMax/Drivers/SDPP/HEADER.ASM b/XTMax/Drivers/SDPP/HEADER.ASM index 585c20e..42925f6 100644 --- a/XTMax/Drivers/SDPP/HEADER.ASM +++ b/XTMax/Drivers/SDPP/HEADER.ASM @@ -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. diff --git a/XTMax/Drivers/SDPP/MAKEFILE b/XTMax/Drivers/SDPP/MAKEFILE index af3ce4b..37ed1c3 100644 --- a/XTMax/Drivers/SDPP/MAKEFILE +++ b/XTMax/Drivers/SDPP/MAKEFILE @@ -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 diff --git a/XTMax/Drivers/SDPP/SD.SYS b/XTMax/Drivers/SDPP/SD.SYS deleted file mode 100644 index ebeab06..0000000 Binary files a/XTMax/Drivers/SDPP/SD.SYS and /dev/null differ diff --git a/XTMax/Drivers/SDPP/SDMM.C b/XTMax/Drivers/SDPP/SDMM.C index 9e39e15..c0d286c 100644 --- a/XTMax/Drivers/SDPP/SDMM.C +++ b/XTMax/Drivers/SDPP/SDMM.C @@ -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();