Skip to contentSkip to conversation

FDC: Fix data transfer len

PATCH New Hervé Poussineau 1 participant 1 message Apr 29, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 FDC: Fix data transfer len

Hi,

In floppy controller, transfer data len is not correctly calculated.
We should read up to the last sector specified by the caller, and not up to the last sector of the floppy.

Attached patch fixes this issue.

Hervé

fdc.c +2 -2
Index: hw/fdc.c
===================================================================
@@ -1137,9 +1137,9 @@
     } else {
         int tmp;
         fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]);
-        tmp = (cur_drv->last_sect - ks + 1);
+        tmp = (fdctrl->fifo[6] - ks + 1);
         if (fdctrl->fifo[0] & 0x80)
-            tmp += cur_drv->last_sect;
+            tmp += fdctrl->fifo[6];
         fdctrl->data_len *= tmp;
     }
     fdctrl->eot = fdctrl->fifo[6];