Understanding HFE file format structure

General discussion forum - for all that doesn't fit in any other category.
Post Reply
YvonneHX1
Posts: 1
Joined: Wed Feb 05, 2025 12:33 am

Understanding HFE file format structure

Post by YvonneHX1 »

Hi all, I'm trying to understand the HFE file format since I'm writing an C++ program to make a change in the embedded floppy disk (change volume label). I've read the HFE-file-format.html page on this website but I don't understand the Third part description for the track data. I would expect the first track of the actual floppy image to start in this part at an offset of 0x400 but this doesn't seem to be the case. This part doesn't start with the bootstrap of the boot sector of the floppy image (yes, I did do the bits transmission trick).
Any help would be much appreciated.
Jeff
Site Admin
Posts: 8324
Joined: Fri Oct 20, 2006 12:12 am
Location: Paris
Contact:

Re: Understanding HFE file format structure

Post by Jeff »

YvonneHX1 wrote: Wed Feb 05, 2025 12:44 am Hi all, I'm trying to understand the HFE file format since I'm writing an C++ program to make a change in the embedded floppy disk (change volume label). I've read the HFE-file-format.html page on this website but I don't understand the Third part description for the track data. I would expect the first track of the actual floppy image to start in this part at an offset of 0x400 but this doesn't seem to be the case. This part doesn't start with the bootstrap of the boot sector of the floppy image (yes, I did do the bits transmission trick).
Any help would be much appreciated.
The HFE bitstream data part is the physical MFM/FM/GCR floppy bit cells magnetic flux. You "can't" directly see the final user data, you need to find the sector headers and "demodulate/decode" the data with the proper routine. And nothing is aligned !

You can use the HxC library to read / write sectors : https://github.com/jfdelnero/HxCFloppyE ... n/libhxcfe

https://github.com/jfdelnero/HxCFloppyE ... libhxcfe.h

For example with the FDC like functions :

hxcfe_insertDiskFDC
hxcfe_readSectorFDC
hxcfe_writeSectorFDC
hxcfe_deinitFDC

Or you can code "from scratch" some routines to :

- Find some sync point (ID MARK),
- Decode the sector header
- Check the CRC
- Check that this is the right sector, if this is the case :
- Find the next data mark sync
- Decode the sector data
- Check the CRC
- Finally do the data modification
- Update the CRC
- Encode the updated sector data
- Put the encoded bit stream right after the data mark sync.

Nothing is aligned, and you need to work at the bit level.

Simple, isn't it ? ;)

I may code a "simple" example later to show how to do this.

EDIT : I forgot another project, for QuickDisk HFE image :
https://github.com/jfdelnero/HXCFE_QuickDisk_Toolkit
There are some "bare-metal" helpers examples.
Post Reply