Rung 2: the machine starts itself off a disk
Stage one exists and works. It is 330 bytes of program and everything it knows is a thing that will be true forever: which port the disk is on, that a SplitBit disk begins with its own name, and where two numbers sit in that first block. Not what a file is, not what a directory is, not that SBFS has versions. It reads the live boot slot into Program Memory, jumps to the first byte, and prints one character and halts if there is nothing there. It is an ordinary boot image for now, so the whole chain runs on machinery that already exists and the emulator has not been touched. Nothing about it changes when it moves into ROM except who puts it in memory. SplitDisk gained "boot" to write a slot and "bootslot" to choose one, kept apart on purpose: writing a slot and starting from it are different decisions, and joining them would make every write a commitment. A slot is always written WHOLE, because one still holding the tail of what was there before is one whose contents depend on its history, and stage one reads all of it without knowing where the file stopped. Three recorded tests, and the pair is the point: two disks differing only in which slot the superblock names, with payloads that say different things. One prints "booted" and the other does not, so this is a test of CHOOSING a slot rather than a test that some bytes were read. The third boots a disk with no boot area and gets the one character a ROM has room for. Eight more host checks, including that a slot is padded whole. Two things worth recording. The first draft used #Align to put the scratch buffer at 0x8000 and produced a 33K file - thirty two kilobytes of zeroes in something meant to be a ROM. It is an address, not storage, which is exactly what the assembler's own scratch map exists to say. And SplitLint caught the second in code written an hour after the baseline that catches it. In the blit set-up, RSTA writes a source address of zero and then RSTA writes a bank number of zero - two unrelated quantities that are equal by accident, in the most safety critical file in the repository. It is marked with a reason rather than removed.
This commit is contained in:
@@ -244,6 +244,8 @@ increment, decrement, addition, and subtraction when their inputs are known.
|
||||
|
||||
| Command | What it does |
|
||||
| --- | --- |
|
||||
| `boot <image> <file> [slot]` | Write a file into a boot slot, padding the rest of it with zeroes. Slot 0 unless told otherwise. |
|
||||
| `bootslot <image> <slot>` | Choose which slot the machine starts from. One byte, on its own, so writing a slot and committing to it stay separate decisions. |
|
||||
| `format <image> [blocks] [dirblocks] [bootblocks]` | Lay down a fresh filesystem. 512 blocks and 8 of directory by default, which is 128K and room for 64 entries. A fourth number reserves a boot area of two slots that size. |
|
||||
| `list <image> [path]` | Show the whole disk, or one directory of it. |
|
||||
| `put <image> <file> [path]` | Put a host file onto it. Without a path it uses the file's own name, which is often longer than the 22 characters a name may be. |
|
||||
@@ -273,6 +275,14 @@ moving one byte in the superblock turns that into a machine that boots what it h
|
||||
`bootBlocks` and `directoryStart` describe the same fact from two sides, so a disk where
|
||||
they disagree is refused rather than guessed at.
|
||||
|
||||
`Programs/Boot/stage1.asm` is what starts a machine from one, and is written to end up in
|
||||
ROM: **330 bytes**, and everything it knows is a thing that will be true forever. Which
|
||||
port the disk is on, that a SplitBit disk begins with its own name, and where two numbers
|
||||
sit in that first block. It does not know what a file is, what a directory is, or that SBFS
|
||||
has versions - all of that lives in the boot area, on the disk, where it can be replaced.
|
||||
It reads the live slot into Program Memory, jumps to the first byte, and prints one
|
||||
character and stops if there is nothing to start.
|
||||
|
||||
SplitDisk speaks the same on disk format SplitBit does, so an image it makes is one the machine can read, and one the machine writes is one it can read back. It is a convenience rather than a necessity: SplitBit writes its own filesystem, and now assembles its own programs, so a disk can be filled without leaving the machine.
|
||||
|
||||
Files are laid down contiguously, so a disk can have free blocks without having them in one piece. When that happens `put` says so rather than putting part of a file on.
|
||||
|
||||
Reference in New Issue
Block a user