TOS 1.04 & 1.62 updates for better FAT16 filesystem Versions numbered: 1.05, 1.63, 1.56 and 1.66 will be available
of Atari ST TOS in working with hard disks are pretty well known:
despite it is intended to be compatible with widely used DOS FAT16
disks, partitions - so with all swapped bytes in FAT, MBR , it is
compatible only in case of partitions under 32 MB size. There is
partition size limit of 512 MB in case of TOS 1.04 and higher. TOS uses
so called large sectors in case of partitions over 32 MB size, and it
is not efficient way. It means for instance that in case of some
partition in range of 257-511 MB, when need to read only 512 bytes from
drive, it must read 8 KB, because it is logical sector size. And today,
with modern storage, most of people create larger partitions.
I was thinking about improving this already some 10 years ago. I seen
approx. what is the problem in TOS 1.04 with FAT16 filesystem. Main
problem is that sector addressing is with 16-bit variable instead
32-bit one. Other problem is using signed variable for cluster number,
so max cluster count is not 2 pow 16, but just 2 pow 15 - what means
max some 32500 clusters - and worse, it means smaller max partition
Finally, I did this patching - it was extremely hard. Code is done with
some ancient C-compiler in 1989, and that was pretty hard to follow.
Certainly, things would be easier with complete C source of TOS 1.04,
but there is no such. There are some sources for TOS filesystem, but
here, we need all variables of TOS 1.04, otherwise whole RAM usage will
be messed up. So, I decided to perform all changes in disassembled TOS
1.04 S file, keeping all variables intact. There was place for
expanding 16-bit variable to 32-bit one in BCB and OFD structures. Most
of it happens on stack, and a6 link space anyway in C code. I done
changes at about 240 places, and resulting code would be longer, so
would not fit before AES, but luckily there was lot of addressing what
can be converted to short (TOS variables are mostly in lowest 32KB), so
I shortened it some 4 KBytes just by it, and that was only for part of
TOS. Harder part was making real 16-bit FAT to work, but it is OK now,
and with this:
Max partition size is now 1GB. It is better than Falcon's 1 GB, since clusters are shorter (16 KB vs. 32 KB)
It is DOS FAT 16 compatible, so no need for BigDOS or DOS/TOS
compatible partitioning - you may access DOS partitions (created by
Windows or some PC partitioning SW) up to 1GB. Of course, this can work
in same mode as original TOS 1.04 filesystem, so access to TOS(AHDI)
type partitions works still - and it can be better with proper driver -
then will access them in short sector mode.
No need for extra buffers, because no large sectors. That means that
RAM usage of hard disk driver may be only some 2-6 KB totally.
Of course, some extra buffers can make it faster, but now, it will be optional and not mandatory.
Disk access is more efficient because no large sectors. Max partition count remains same: 14 .
Updates in March 2018:
I did same with TOS 1.62, which is pretty much same as 1.04 (diff. is in handling extra STE HW) .
I plan to make 4 versions with this updated FAT16 filesystem:
1.05 - updated TOS 1.04, for ST, Mega ST machines. ROM start address is $FC0000 .
More place for diverse TOS mods - some 5KB free.
1.63 - updated TOS 1.62, for STE, Mega STE (added extra code for MSTE) .
1.56 - combination of updated 1.04 and TOS 2.06 Desktop, AES .
For STE, Mega STE . May work on ST too (recommended), but needs little
extra logic because ROM start must be at $E00000 .
1.66 - combination of updated 1.62 and TOS 2.06 Desktop, AES . For STE, Mega STE .
Video of booting with TOS 1.66 :
Note that UltraSatan displays not properly capacity of 16 GB card. I
created only 3 partitions in Win 7, because from some reason it could
not create extended partition. But that's not relevant, there will be
partitioner SW what will do it well on Atari.
The benefits: more efficient and faster work, because smaller logical
sector size. Larger partitition sizes are possible. Less RAM usage,
because no need for extra buffers. RAM usage of driver can be very low
- only 2KB !
This needed really thorough testings, so I did not rush with it. Now seems pretty much reliable and stable.
View of 1GB partition content:
here is first extra problem - above pic is done with TOS 2.06 combined
with this TOS 1.05 filesystem. In TOS 1.04 displaying of larger file
sizes in Text view mode works not - it crashes when is above 100 MB.
So, it will need some patch of Desktop part of 1.04 too ...
Luckily, no problems in Icon view mode.
And there is it in patched 1.04, with now added large file displaying fix:
Some people certainly noticed those crashes when used TOS 1.xx in
emulators, with GEMDOS hard disk emulation (so some DIR on PC assigned
for Atari logical drive, like C: ) - it crashes in Text view mode if
there are some very large files (above 100MB) . So, this fix is good
for it too.
I made simple test program which measures disk access data flow. Tested
with pretty much average SW - starting some medium long program what
loads couple shorter and longer files: with usual large logical
sectors of AHDI/TOS partition it was 294912 bytes loaded from disk.
Running same SW, from same place, but with 512 byte sectors resulted in
225792 bytes loaded from disk. Or 30% less . There is just too much
overhead with large sectors, especially in case of many shorter files,
or many short data chunk accessing.
Future plans: Making special hard disk driver, what will utilize this
real FAT16 capability of modded TOS. With some extra buffer settings as
option. RAM usage with regular buffers (which are always there in TOS)
can be some 2 KB only. Extra buffers can improve speed, so it's on user
when will activate them.
I may selling programmed chips with this modded TOS. There may be some
other patches too - like IDE autoboot support, special TOS AUTO
folder run patch for max RAM for user SW ...