... before I try to read the LDOS source code, do any references to the filesystem structures exist?
The LS-DOS native format is well-documented in both the Model 4 Tech Ref (Software section) and in the Programmer's Guide to TRSDOS/LS-DOS 6 (everything except the copy/backup limited protection systems, which are documented in Pete Cervasio's LS-DOS 6.3.1 source tree).
This actually
does help you, since the Model III TRSDOS format is somewhat similar, but where it is different it is quite different. The best source of information on the Model III format is actually a very difficult to find book called 'TRSDOS Commented' which I would love to have a copy scanned. The older Model I format is very similar to the LS-DOS 6 format, and it is also quite well documented in one or two of the 'and other Mysteries' books by IJG.
Yes, I know you're asking about Model II TRSDOS, but the basics of the filesystem are the same between almost any TRS-80 DOS (notable exceptions: TRSDOS II 4.x and Xenix). You have the concept of granules or grans (similar to the FAT format's clusters); you have a Granule Allocation Table that shows the status (free/allocated/bad) of every granule on the disk (the GAT is in the first sector of the directory track); you have a hash index table (HIT) in the second sector which allows you to find out which directory entry contains a particular filename (the filename is hashed; the hash is a pointer to a byte in the HIT that contains the directory entry number); each directory entry has filename, extension, and hashed user and owner passwords for the file as well as the granule allocation pointer chains (called 'extents' in the documentation). The specifics of the hashing functions, the size of each directory entry, whether the first sector is sector zero or sector one, and a few differences in flag bits and date/time stamps on files are the essential differences between the various TRS-80 formats.
On the Model III TRSDOS, the hashing functions are further obfuscated by the use of some of the undocumented Z80 instructions.
Unfortunately no one of whom I am aware has made public full documentation of the Model II TRSDOS's, but knowing what the Model III TRSDOS and the Model I TRSDOS-derived LDOS and LS-DOS are doing will help you plow through what each byte of the directory entry does, using a disk editor. Although, years ago I remember seeing a manual that listed the TRSDOS SVC's for the Model II TRSDOS; I'll have to do some looking...... as that same manual might just contain some information on the directory structure.
Mark, I'm looking with great interest at what you're doing with your Python code!
EDIT: Found the doc I was thinking of. See
http://electrickery.xs4all.nl/comp/trs80m2/doc/TandyModel2DiskOperatingSystemReferenceManual.pdf beginning on page 173. It does not appear to directly document the on-disk data structure, although a clue to the format is found in the SVC titled RAMDIR (page 225 of the PDF; page 261 of the printed manual).
For various reasons (backup limiting and copy protection being two of them; supporting people who messed up their disks be directly munging directory entries being a third one) Tandy was averse to documenting too many details (search for a post in comp.sys.tandy by Mike Yetsko about why his own fast copy routine had to run on TRSDOS 2.0 because the TRSDOS-II 4.x programmers obfuscated the direct disk access SVCs and call points). Later TRSDOS-II is pretty well-documented (the tech stuff:
http://electrickery.xs4all.nl/comp/trs80m2/doc/TRSDOS-II_RefMan_3-4.pdf ) and has the same RAMDIR SVC, and the same lack of information on the direct disk format, for the same reasons.
EDIT 2: See the appendix E of the second document on TRSDOS-II for the differences between the older TRSDOS and TRSDOS-II. There are substantial differences that are documented in the filesystem, including allocation by sectors instead of granules, sector-level badblock lockout instead of track-level, and much larger directories, with up to 1,220 files available. This implies a much different system. But, then again, TRSDOS-II was also usable on a hard disk.