From 5644c24113728a3b1e70ab6039687c5c6d26d345 Mon Sep 17 00:00:00 2001 From: Anachronaut Date: Mon, 31 Aug 2026 12:30:09 -0400 Subject: [PATCH] CosmOS knows about all four drives A mounted disk is EIGHT BYTES - where its directory starts, how many blocks it is, how big the disk is, and where you are on it. They now sit together in the data segment, and changing drives is one copy out and one copy in. The other three thousand lines of filesystem go on reading the same four names they always have and never learn there is more than one disk, which is the whole reason this was affordable. The version is not in the record. It is checked at mount and thrown away, because a version one disk's zero parent already reads as "in the root". Every drive is mounted at boot: the controller says how many are plugged in and each is tried in turn. One with nothing in it, or a disk this cannot read, is left unmounted rather than stopping the others, so a machine with a good disk in drive 0 and a blank in drive 1 starts. 'drive' says which one, 'drive 1' goes to another, and the working directory goes with it - where you are on a disk is part of which disk you are on. A drive the machine has not got is refused, and refused differently from one that is there with nothing readable in it. Three things the assembly caught me on, all the same misunderstanding of what survives a call: - OR reads A and B, and the bit came back from sbfsDriveBit in Q, which RET does not disturb - but RET does put A back. The mounted mask never got set and drive 0 was reported unmountable. - MVQA then RSTA throws away the copy it just made, so doubling a bit doubled nothing. SHL does it in one instruction, because A and B are one register to it. - There is no move from A to B. INB reads a port straight into B, which is what the drive count comparison wanted. run.sh takes more than one image now, separated by a plus, since the machine has four drives and a test that could only name one could not check any of this. The buffer note is forgotten on a drive change and that is DELIBERATELY kept although nothing can currently reach it: only the file read-ahead consults it, a directory scan does not, and finding a file requires a scan which overwrites the note on the way past. Two disks were built with the same file at the same block to try to catch it and the answer was right either way. Three instructions to hold an invariant rather than a story about a bug - and the comment says so instead of claiming a fix. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW --- Programs/CosmOS/README.md | 28 ++++ Programs/CosmOS/Source/cosmos.asm | 76 ++++++++- Programs/CosmOS/Source/sbfs.asm | 264 +++++++++++++++++++++++++++++- SplitBit Test Manual.md | 4 +- Tests/expected/cosmosDrives.out | 27 +++ Tests/input/cosmosDrives.in | 11 ++ Tests/makedisks.sh | 10 ++ Tests/manifest | 12 ++ Tests/run.sh | 13 +- 9 files changed, 435 insertions(+), 10 deletions(-) create mode 100644 Tests/expected/cosmosDrives.out create mode 100644 Tests/input/cosmosDrives.in diff --git a/Programs/CosmOS/README.md b/Programs/CosmOS/README.md index 4ee1d09..1949520 100644 --- a/Programs/CosmOS/README.md +++ b/Programs/CosmOS/README.md @@ -234,6 +234,7 @@ CosmOS currently provides these built-in commands: | `do