summaryrefslogtreecommitdiff
path: root/KFloppy.HC
diff options
context:
space:
mode:
authorHarley Travis <harleytravis123@outlook.com>2026-05-26 18:05:55 -0500
committerHarley Travis <harleytravis123@outlook.com>2026-05-26 18:05:55 -0500
commit3198f0d5bbfea8692bf7ab9725cc298ae730d4d2 (patch)
tree206531adfa201010f450732e2739559d3070e7be /KFloppy.HC
parent92570c206cfd38ab8ee875bd76d69184665909d2 (diff)
downloadtempleos-floppy-driver-3198f0d5bbfea8692bf7ab9725cc298ae730d4d2.tar.gz
Update KFloppy.HC and ReadMe.TXT
I have corrected a copy-paste error I made while writing the multi-track write code that caused controller timeouts. I have also done further line length reduction. See ChangeLog.TXT for details.
Diffstat (limited to 'KFloppy.HC')
-rw-r--r--KFloppy.HC19
1 files changed, 12 insertions, 7 deletions
diff --git a/KFloppy.HC b/KFloppy.HC
index cfebfed..14f892c 100644
--- a/KFloppy.HC
+++ b/KFloppy.HC
@@ -1,6 +1,6 @@
/*
New, (hopefully) Less Messy Floppy Driver
- Copyright (C) 2025 Harley Travis <yoshi128k@gmail.com>.
+ Copyright (C) 2026 Harley Travis <yoshi128k@gmail.com>.
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See the Copying.TXT file for more details.
@@ -139,8 +139,9 @@ U0 FDCMotorOff(U16 base)
U0 FDCMotorPwrOffTimer()
{
- // You're supposed to run this function as a separate CTask. It will exit when the motor
- // exits the "wait" state (either because it has turned off or because something needs it to be on).
+ // You're supposed to run this function as a separate CTask. It will exit
+ // when the motor exits the "wait" state (either because it has turned off
+ // or because something needs it to be on).
// The driver only spawns this when the motor is moved from "on" to "wait".
while (fdc_mtr_state == FDC_MOTOR_WAIT) {
// Sanity check for if something wants the motor on at the last second
@@ -173,8 +174,10 @@ U0 FDCMotorCtrl(U16 base, Bool onoff)
}
fdc_mtr_ticks = 300; // 3 sec timeout before motor turns off
fdc_mtr_state = FDC_MOTOR_WAIT;
- // Only spawn the timer task of the motor is currently on; infinitely-looping tasks peg the CPU
- if (prev_mtr_state != FDC_MOTOR_WAIT) Spawn(&FDCMotorPwrOffTimer,,"FDCMotorPwrOffTimer");
+ // Only spawn the timer task of the motor is currently on.
+ // Infinitely-looping tasks peg the CPU!
+ if (prev_mtr_state != FDC_MOTOR_WAIT)
+ Spawn(&FDCMotorPwrOffTimer,,"FDCMotorPwrOffTimer");
}
}
@@ -242,7 +245,9 @@ I8 FDCReset(U16 base)
// Configure the FIFO
FDCSendCmd(base, FDC_CONFIGURE);
FDCSendCmd(base, 0x00); // 1st param is a 0
- FDCSendCmd(base, 0b01011011); // 2nd param: Implied seek on, FIFO on, Drive polling disabled, threshold = 12
+ // 2nd param:
+ // Implied seek on, FIFO on, Drive polling disabled, threshold = 12
+ FDCSendCmd(base, 0b01011011);
FDCSendCmd(base, 0x00); // 3rd param: write precomp = 0
// Lock the configuration
@@ -449,7 +454,7 @@ U0 FDCWriteMulti(U16 base, U8 cyl, U8 head, U8 sect, U8 trklen)
// Prepare the DMA controller
AdamLog("Preparing DMA\n");
FDCDMAInit(512*(trklen - sect + 1)*2);
- FDCDMAPrepRead();
+ FDCDMAPrepWrite();
FDCSendCmd(base, cmd);
FDCSendCmd(base, head << 2); // Drive 0, specified head