Skip to content

dgndos command & libdragondos - #97

Merged
DrPitre merged 11 commits into
nitros9project:mainfrom
tlindner:libdragondos
Nov 1, 2026
Merged

DrPitre merged 11 commits into
nitros9project:mainfrom
tlindner:libdragondos

Conversation

@tlindner

@tlindner tlindner commented Nov 1, 2026

Copy link
Copy Markdown
Member

Add libdragondos (built on top of libdiskimage).
Integrate libdragondos into libcoco.
Add dgndos command (built on top of libcoco and libdragondos).

tlindner and others added 11 commits November 1, 2026 08:10
All I/O goes through libdiskimage, and only the sectors an operation
touches are needed, so an image can lack any others. A directory track
sector that is missing or has a bad CRC is read from the copy on track 16.

Sector allocation and file extension follow $CD31 and $CBEC of the Dragon
DOS 1.0 ROM. Formatting a disk and saving the same files reproduces a disk
made by Dragon DOS in MAME, now in the test data, byte for byte.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Dragon DOS command is DSKINIT. The ROM's command table ends each word
with its high bit set, which hid the final T.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a DRAGONDOS path type and dispatch every _coco_ function to
libdragondos. _coco_identify_image looks for cassette images and OS-9
disks first, then _dragondos_identify checks the geometry bytes and that
the bitmap has the directory track and its copy in use. What remains is
still Disk BASIC.

The protect flag maps to FAP_WRITE, and _coco_readdir reports only entries
that begin a file. cocofuse handles the new type, and everything that
links libcoco now links libdragondos and libdiskimage, including DiskShed's
source list.

Fix an int overflow in _coco_identify_image's OS-9 check, which any disk
with a garbage LSN0 could hit, such as a Dragon DOS disk filled with $E5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Commands are attr, copy, dir, dskinit, dump, free, fstat, kill, list and
rename. fstat also reports the type, addresses and length in the header
that SAVE puts at the start of a file, as Dragon DOS records a file's type
nowhere else. dir lists what it can of a damaged directory, then reports
the first error.

libdragondos gains _dragondos_gs_size_entry, and TSReportError gains
messages for libdiskimage's EOS_SECT, EOS_WP and EOS_READ.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
_dragondos_entoken and _dragondos_detoken follow $8F67 and $8F08 of the
Dragon 64 BASIC ROM, using its token tables and those Dragon DOS adds. The
tables move here from libdecb, where nothing used them. A tokenized file
has the header SAVE writes, so text can reproduce a saved program exactly.

dgndos gains copy -t and list -t. It also no longer lets an error code above
255 wrap in its exit status, where EOS_OM would have looked like success.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Writing "dgndos copy file disk.vdk" where "disk.vdk," was meant would have
replaced the whole disk. A host file is now refused, even with -r, if its
extension is that of a disk image, it has the header of one, or it is at
least a track long and a whole number of sectors. Other host files are
replaced as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Dragon DOS file is one block after a 9 byte header, rather than Disk
BASIC's chain of blocks. dump -z now shows its data at its load address,
then its execution address and anything past its length. A first byte of
$55 tells it apart, which can't begin a Disk BASIC binary.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Running the ROM's create, write, close and kill routines in an emulator
gives the same disks as libdragondos, apart from bugs in the ROM that are
not reproduced, now listed in libdragondoswrite.c. Add tests holding the
directories the ROM makes, and tests of what those bugs would get wrong.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The SuperDOS E6 source in this repository, when assembled and run in an
emulator, gives the same disks as libdragondos. Its keywords and formats
match too, so nothing needs to change. It fixes two of the Dragon DOS 1.0
bugs that libdragondos doesn't reproduce, and leaves all sectors of an 80
track single sided disk free, as dgndos dskinit does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
appimagetool now stops if it can't make .DirIcon, which it only does from a
PNG or XPM in the top level of the AppDir. DiskShed only had an SVG for
Linux. Add a 256x256 PNG made from it, and copy it there in both workflows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dragon DOS disks formatted in MAME start each track with a longer preamble
holding an index mark, which puts every sector 67 bytes later than the layout
_diskimage_create records. Add _diskimage_create_index_mark for dskinit, and
leave other tools' images as they were.

A blank disk now matches the MAME image, except for the $FF left after each
sector the controller rewrote on the directory track and its copy.

Document the options of dgndos dump.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@DrPitre
DrPitre merged commit 72aad91 into nitros9project:main Nov 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants