Check the memory map against itself, not only against the code

The CosmOS README's Data row gave the system 0x0000-0x3FFF and a loaded
application 0x2000 and above: two columns of one row that cannot both be
true. Program was doubled to 0x3FFF when CosmOS outgrew its first map and
that number was copied into the Data row as well, where the answer is
0x1FFF.

docs.sh measured both segments against the CosmOS column and passed the
table anyway, because it never read the column beside it. A number checked
against the code and not against the number next to it is still unchecked,
so it now reads both and compares them - and compares two further copies of
the same fact that had gone stale on their own: the minimal application in
the README, still based where applications lived before the doubling, and
the map cosmos.asm opens with, which somebody reading the system reads
before they read the README.

Each of the three checks was confirmed by breaking the fact and watching it
fail; the first reproduces exactly the text this commit removes. While in
that header, the command list said five commands and CosmOS has eleven and
a search path besides, and "dump is next" outlived the monitor.
This commit is contained in:
Anachronaut
2026-08-25 22:54:14 -04:00
parent db3d349da8
commit aa7bdc6acd
3 changed files with 78 additions and 16 deletions
+9 -3
View File
@@ -439,7 +439,7 @@ CosmOS divides the two SplitBit address spaces by convention:
| Memory | CosmOS | Loaded application |
| -- | -- | -- |
| Program Memory | `0x0000` through `0x3FFF` | `0x4000` and above |
| Data Memory | `0x0000` through `0x3FFF` | `0x2000` and above |
| Data Memory | `0x0000` through `0x1FFF` | `0x2000` and above |
Both of CosmOS's halves were doubled once it outgrew the first ones. **The division is a
convention and nothing enforced it**, so CosmOS quietly grew past `0x1FFF` and the next
@@ -448,6 +448,12 @@ fails later, in whatever part of the shell the program happened to cover. `make
measures both segments against the numbers in this table, so the table is checked rather
than merely written down.
**The table is checked against itself as well.** The first version of that check read only
the CosmOS column, and so it passed a table whose Data row gave the system `0x3FFF` and an
application `0x2000` - two columns that cannot both be true, sitting next to each other.
Measuring one number against the code and never against the number beside it is how a
specification contradicts itself in public.
Applications state their actual Program and Data addresses with `#Base`. The SplitBit
assembler then writes an SBEX loadable image containing those addresses, the entry point,
the segment lengths, and any vectors the application needs. CosmOS does not relocate
@@ -475,7 +481,7 @@ A minimal CosmOS application therefore looks like this:
#Include services.asm
#Program
#Base 0x2000
#Base 0x4000
start:
SETD.0 Message
@@ -483,7 +489,7 @@ start:
SWI osExit
#Data
#Base 0x1000
#Base 0x2000
Message:
"Hello from CosmOS."