[Rpcemu] Patch for floppy reading on ADFS 3.34 and later

Sprow webpages at sprow.co.uk
Mon Jan 20 13:34:45 PST 2014


Hi,
Since the Iyonix era RISC OS 5's ADFS has made use of the verify sectors
command in order to speed up verifying a sector, which ADFS does just before
mounting a disc (and a few other situations).

As a result, ADFS in RISC OS 5 for the IOMD family also uses the verify
sectors command, but as RPCEmu doesn't emulate that clicking on the floppy
drive icon gives a "Bad FDC command" error and quits. Bad.

The following patch implements that missing command. It's actually
remarkably similar to the read sectors command, except there's no data
transfer phase (in the real hardware the 37C665 swallows it all).

I've tested this by grabbing the empty 800k floppy image from marutan.net
(now it's back online) mounting it in RISC OS 5.21, and writing a 600k
sprite image into it, rebooting, and reading it back.

Cheers,
Sprow.


--- fdc-0-8-11/c	2014-01-20 21:21:26.0 +0000
+++ fdc-verify/c	2014-01-20 21:21:26.0 +0000
@@ -25,6 +25,7 @@
 	FD_CMD_WRITE_DATA_MFM		= 0x45,
 	FD_CMD_READ_DATA_MFM		= 0x46,
 	FD_CMD_READ_ID_MFM		= 0x4a,
+	FD_CMD_VERIFY_DATA_MFM		= 0x56
 };
 
 static void fdcsend(uint8_t val);
@@ -223,6 +224,7 @@
                                         break;
 
                                 case FD_CMD_READ_DATA_MFM:
+                                case FD_CMD_VERIFY_DATA_MFM:
                                         fdc.commandpos=0;
                                         fdccallback=1000;
                                         fdc.st0=fdc.parameters[0]&7;
@@ -317,6 +319,7 @@
 
                 case FD_CMD_WRITE_DATA_MFM:
                 case FD_CMD_READ_DATA_MFM:
+                case FD_CMD_VERIFY_DATA_MFM:
                         fdc.params=8;
                         fdc.curparam=0;
                         fdc.status=0x90;
@@ -598,6 +601,27 @@
                 }
                 break;
 
+        case FD_CMD_VERIFY_DATA_MFM:
+//                printf("Verify data callback %i\n",fdc.commandpos);
+                fdc.sector=fdc.parameters[5]; /* Verified OK (amazing!),
jump straight to the end */
+                switch (fdc.commandpos)
+                {
+                        case 0: fdcsend(fdc.st0); break;
+                        case 1: fdcsend2(fdc.st1); break;
+                        case 2: fdcsend2(fdc.st2); break;
+                        case 3: fdcsend2(fdc.track); break;
+                        case 4: fdcsend2((fdc.parameters[0]&4)?1:0); break;
+                        case 5: fdcsend2(fdc.sector); break;
+                        case 6:
+                        fdcsend2(3);
+                        fdc.incommand=0;
+                        fdc.params=fdc.curparam=0;
+                        fdccallback=0;
+                        break;
+                }
+                fdc.commandpos++;
+                break;
+
         case FD_CMD_READ_ID_MFM:
                 if (fdc.sector >= drives[fdc.st0 & 1].discsectors) {
                         fdc.sector = 0;




More information about the Rpcemu mailing list