v1.3.6: Disk writes! #25

Merged
bcox merged 7 commits from version-1.3.6 into main 2026-04-12 00:04:13 +00:00
Owner

This PR implemets disk writes for SBC7, and includes a new "fstest" example that exercises the new ROM routines.

This PR implemets disk writes for SBC7, and includes a new "fstest" example that exercises the new ROM routines.
The bump-version script now loops over all src/examples/*.s files
instead of only updating charset.s, so sinewave.s (and any future
examples with version strings) are updated automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New syscalls: SYS_FS_OPENW (16), SYS_FS_CREATE (17), SYS_FS_WRITE (18),
SYS_FS_REMOVE (19), SYS_FS_MKDIR (20), SYS_FS_RMDIR (21), SYS_FS_SEEK (22).
Fix SYS_FS_FREE (12) to actually scan the FAT instead of returning 0.

Architecture: bank 2 dispatches via two-phase thunks (bank 3 resolves
paths, bank 4 acts). Bank 5 holds write/seek/close overflow.
OPENW returns file size in DSK_LBA_0-3 for immediate SEEK-to-EOF append.
FS_FILE_MODE in zero page tracks read-only vs read/write mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix hardcoded _print_rtc address in rom.s (shifted from &2B:22 to
&2B:42 after bank 2 grew with write syscall thunks).

Add src/examples/fstest.s: exercises create, write, read-back, mkdir,
overwrite, append (openw+seek+write), rmdir, remove, and free-space.
Prints PASS/FAIL per test and ALL PASSED summary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move FS_FILE_MODE from &00:71 (FARCALL stub!) to &00:30 (unused RST 6)
- Move FAIL_COUNT from &00:40 (interrupt trampoline!) to &00:32
- Move read/write buffers from slot 2 (remapped by EXTCALL) to slot 4
- Fix sector-within-cluster offset: (pos[1]>>2)&3, not pos[1]&3
- Fix T7 append test: appended data is in same cluster at offset 512
- Add run-example-disk recipe for examples needing a disk image

All 8 fstest tests now pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix _fs_resolve_path returning too early on intermediate directory
  components (was short-circuiting on TESTDIR instead of descending
  to look for INNER).
- Fix mkdir writing sectors 0,2,3,4 instead of 0,1,2,3 (SYS_DSK_WRITE
  already increments the LBA, don't double-increment).
- Add _dir_set_directory_bit workaround for attr persistence issue.
- Fix sector-within-cluster offset in bank 5 write handler.
- Fix fstest: FAIL_COUNT at &00:32 (not trampoline), buffers in slot 4,
  single-cluster append verify, subdirectory test path.
- Add run-example-disk justfile recipe.

T5 (subdirectory create+readback) still fails: _dir_create_entry writes
attr=$12 to the sector buffer but disk shows $10.  All other tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
_fat_flush and _fat_ensure_cached set FS_ARG_GH to FS_FATCACHE for
disk I/O but never restored it.  This caused _dir_create_entry to
copy a null filename (FS_ARG_GH pointed to zeroed FAT cache instead
of the user's path string).

Fix: save/restore FS_ARG_GH around all FAT cache disk operations,
in both bank 4 and bank 5.

Also: fix resolve_path early return on intermediate directory
components, fix mkdir sector write off-by-one.

All 8 fstest tests now pass, including subdirectory create+readback.
Second consecutive run also passes (cleanup works correctly).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add fstest to MiSTer H7X build and factory disk
All checks were successful
PR Check / test (pull_request) Successful in 11m32s
PR Check / build-rpm (pull_request) Successful in 19m23s
bb74f0884f
The Makefile examples target already picks it up via wildcard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bcox merged commit 897d7b1af7 into main 2026-04-12 00:04:13 +00:00
bcox deleted branch version-1.3.6 2026-04-12 00:04:19 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bcox/sbc7!25
No description provided.