Skip to content

Feature: libdiskimage and diskinfo - #96

Merged
DrPitre merged 4 commits into
nitros9project:mainfrom
tlindner:feature/libdiskimage
Nov 1, 2026
Merged

DrPitre merged 4 commits into
nitros9project:mainfrom
tlindner:feature/libdiskimage

Conversation

@tlindner

@tlindner tlindner commented Nov 1, 2026

Copy link
Copy Markdown
Member

Adds libdiskimage, a common API for DMK, SDF, JVC, VDK and raw disk images: identify, create, sector and stream access, with write protect honored unless overridden.
Adds the diskinfo command, which reports an image's format and track layout, including deleted data marks and data CRC errors.
Not yet used by decb, os9 or the other tools; adds unit tests, including byte-identical checks against MAME's blank RS-DOS DMK and SDF images.

tlindner and others added 4 commits October 31, 2026 12:48
Add a library that opens DMK, JVC, SDF and raw (256 byte sectors, 18 per
track) images through one API: identify, open, close, query geometry,
read and write sectors, and streams over all logical sectors. Nothing
uses it yet; decb, libdecb, os9 and librbf can move to it later.

Only raw images can grow. _diskimage_create makes new images, with a
short side 0 of track 0 on DMK, SDF and raw, and sector interleave on
DMK and SDF.

Short track 0 on raw images is read from LSN0 and follows the layout in
_os9_lsn_fseek, where the file keeps all 18 slots of track 0.

SDF offsets and density follow dmk2sdf: the data offset is the first data
byte after the mark, and density comes from the track bytes because
dmk2sdf never sets the single density bit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a blank RS-DOS disk in DMK and SDF, made by MAME, as test data, and
test that _diskimage_create reproduces both byte for byte. The library
also reads them back correctly.

Matching them changes every created DMK and SDF track: a $00 starts the
track, 8 zeros precede each ID instead of 12, the gap after each sector
is 24 unless it must shrink to fit, and the DMK track length is $18EA.
19 sectors of 256 bytes now fit on a track.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
diskinfo reports an image's format and track layout, grouping tracks
with the same layout. libdiskimage gains the VDK format, honors write
protect on DMK, SDF and VDK images, and adds an open flag to override it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@DrPitre
DrPitre merged commit 8179239 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