Flex .DSK file format

A project log for 6809 SBC

A 6809-based SBC with DES encryption hardware.

philmacphailPhil.macphail 06/09/2022 at 11:010 Comments

I found an archive of Flex software at this website which was the missing link for me. I had been looking for the Flex operating system for a while, and had slowed work on the SBC due to lack of success. This was more than I hoped for, and started to look at the archive in detail. My first question was what is the format of the .DSK files? There is some information on the web, but thought it best to work it out for myself. It turned-out to be quite simple, and I can see a way to transfer images to my computer in quite a simple way. But first, the investigation process. I read a .DSK file into Matlab which gave me an array of single-character data. I checked that the size of the array was a multiple of 256 (a Flex sector) and it was, confirming the file contains a raw image of a disk. The process of ‘reconstructing’ the disk in Matlab was a simple sequence of steps -
1. Reshape the array into n by 256 entries. This gives me an array of sectors that can now be examined to find the number of tracks and sectors on the original disk.
2. Track zero, sector 3 of a disk contains the System Information Record (SIR), and bytes $26 and $27 contain the number of tracks and sectors of the disk. This information is contained in the 3rd sector in the array created by step one, and extracting this information means the array can be reshaped again to give an array that can be indexed as Disk(Track, Sector, Data).

Having an array that mirrors the physical layout of the original disk now permits the directory to be read. Track 0, Sector 5 is the first directory sector, and the contents of the sector are outlined here It was quite simple to decode the directory, print it, and check to see if it overflows onto another sector, when the same process can be repeated. I am now able to view the directory of any disk image, and select one with Flex on it to copy to my SBC.
I have uploaded the code here, and it should work with GNU Octave with minimal changes, although I haven’t tried.
The next steps.
It should be quite simple to extend the Matlab program to send a sector to the SBC, then instruct the SBC to write them to the CF card. I can already set the LBA address, write and verify a sector, so this is quite a small step. Repeating this for all sectors will therefore transfer a disk image to the CF card. With this done, I should be able to then modify the Flex code with my routines and give me a working Flex computer. Getting closer, but still quite a bit to do.