1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
Copyright (C) 2025-2026 Harley Travis <yoshi128k@gmail.com>.
This software (including source code) is licensed under the BSD Zero Clause
License. See the Copying.TXT file for details.
These files contain the code required for the low-level floppy disk driver.
It is integrated with TempleOS block device API, allowing floppy disks to be
used as RedSea volumes.
The development history of this project can be found at:
https://git.yoshi128k.tk/cgit/templeos-floppy-driver
To install the driver:
1. #include Install.HC in a terminal window; it will copy all the source code
and patches to the proper directories on your disk.
2. Refer to Instructions.TXT for instructions on applying the patches and
installing the driver, but do not do the Adam patches yet! Since I have not yet
implemented any sort of patch-like utility, you will have to do the patches
manually. Luckily, all of the needed modifications can be done by commenting out
the sections of code mentioned and/or #including the patch files.
3. Recompile the kernel with BootHDIns() and reboot (or run BootRAM()).
4. Only when the kernel has been patched and recompiled can you do the Adam
patches. at which point you can reboot or run BootRAM(). You can also run
BootHDIns() again if you want to mount your floppy drive(s) on startup (it works;
I checked).
Your system will have been patched to unmask IRQ6 and update the IDT to point it
to an appropriate stub.
The low-level functions of the driver will also be made available for your use,
but using the BlkRead() and BlkWrite() functions is preferred if you wish to do
low-level reading and writing.
With the patches installed as shipped, drives W-Z (which normally are assigned
to CD/DVD drives) will be assigned to floppy drives. Mount() does exactly what
it says it does!
Currently, only the RedSea file system is supported. You can format floppies with
the Fmt() function. A full format will take considerably longer than a quick
format; on my system, using 1.44 Meg disks, it took just over 80 seconds! A
quick format, on the other hand, took about 5 seconds.
As long at the initialization process works, you can do whatever you want with
your floppy drive(s). If you don't have a disk inserted, or the disk does not
match what you configured TempleOS to expect, it will show up as "NULL." If the
disk is the correct type, but doesn't have a valid RedSea boot sector on it, it
will show up as "UNKNOWN."
Make sure to run DskChg() whenever you swap disks; it will recheck the file
system and clear the read cache. Shut down any time you want, except during
disk reads or writes (as is per usual, just make sure the drive light is off).
Do not worry if the drive is not on track 0; your BIOS should recalibrate the
drive during the Power-On Self-Test.
--A note about DMA--
If things went to plan, I would have use PIO to do data transfers to and from
the disk. However, they didn't, and my dev system would freeze when attempting
to read from tracks beyond 0 (the drive would make a seek noise, at which point
it froze).
In Terry's demands document, he wrote:
"We don't want to do DMA."
This is a bit ambiguous, as there are two main forms of DMA in the PC world:
1. ISA DMA, used by the floppy controller and ISA expansion cards.
2. PCI Busmastering, which is used by newer hardware and is very different from
ISA DMA.
TheTinkerer on the TOS Discord suggested that Terry *may* have been more
tolerant of ISA DMA, but I would still consider my usage of it to be at least
somewhat blasphemous (though it is not mentioned in the Charter).
|