D5: move in, and give the assembler somewhere to look

The demo disk is three directories instead of thirty nine names in one list
with cosmos.asm sitting between fileStream.asm and sbfs.asm:

  /Apps    what you run
  /Source  what you name to the assembler
  /Lib     what those include

The split is by ROLE rather than by which directory the host keeps a file in.
Everything in /Lib is named by an #Include somewhere and by nothing else, which
is what makes it a library rather than a source.

THAT LAYOUT WAS NOT POSSIBLE UNTIL NOW, and finding out why is what this rung
actually cost. An include on the machine was a bare name resolved where you
stood, so every source that calls a service had to sit in the same directory as
services.asm - which is every source worth having. The first arrangement of
this disk put the examples in a directory of their own and none of them would
assemble.

So the native assembler has a search path: beside you, then /Lib. The same rule
the shell already uses for a program it does not recognise, applied to the
thing that reads source, and the same reasoning for it being two fixed places
rather than a list - a list needs somewhere to live between one boot and the
next, and there is no such place yet. It also brings the native assembler
nearer the host one, which has searched -I directories since before there was a
machine to run this on.

The reader's per-file state grew from 293 bytes to 301, because the name it
keeps is a path now and every block of a file is asked for by it. Six of those
would no longer fit the room set aside, so the include list moved up a page.
Both numbers are written down in two places on purpose and both were changed.

dir said cosmos.asm was 17,460 bytes. It is 82,996. The size came out of the
block count's LOW BYTE shifted up and the tail beneath it, which is sixteen
bits, so anything from 256 blocks upward came back as itself less 65,536 - a
plausible number, and wrong. Files that big say their size in blocks now.
Printing the true figure wants decimal printing twenty four bits wide, which is
a page of console.asm to say something nobody reads more precisely than "big".

The Assembler Manual's line about SBFS being flat was the last thing in the
repository still claiming it, and docs.sh now looks for that phrase and three
like it in all four documents. Not a section that is wrong - one clause inside
a paragraph that is otherwise right, which is the shape this kind of staleness
takes.

The duplicate puts are gone with the wildcard that caused them, so building the
disk is quiet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-08-25 10:04:12 -04:00
co-authored by Claude Opus 5
parent da91a36d92
commit 06bdbf7728
8 changed files with 189 additions and 41 deletions
+55 -4
View File
@@ -189,13 +189,53 @@ srcInclude:
CALL srcRemember
CALL srcPush
; TWO PLACES, TRIED IN ORDER: where you are, and then /Lib. The same rule the shell uses
; for a program it does not recognise, which is where it came from - a name means the
; one beside you if there is one, and the system's otherwise.
;
; It is what a search path is for, and the host assembler has had one since before there
; was a machine to run this on. Without it every source that calls a service has to sit
; in the same directory as services.asm, and the disk cannot be organised at all.
SETD.0 IncWanted
SETD.1 SrcName
CALL srcKeepName
CALL srcRewind
BRQ srcIncludeIn
CALL srcInLibrary
CALL srcRewind
BNQ srcIncludeGone
srcIncludeIn:
RET ; Q is zero, out of srcRewind.
; SrcName becomes the same name inside the library directory. Built here rather than kept
; as a second buffer, because what has to survive is the name the file was ASKED for -
; that is what the include-once list holds, and a file found in the library on one line
; and beside you on another is still the same include.
srcInLibrary:
SETD.0 SrcLibrary
SETD.1 SrcName
srcLibraryPrefix:
LDA.0
BRA srcLibraryName
STA.1
INCD.0
INCD.1
BRI srcLibraryPrefix
srcLibraryName:
SETD.0 IncWanted
srcLibraryCopy:
LDA.0
STA.1
BRA srcLibraryDone
INCD.0
INCD.1
BRI srcLibraryCopy
srcLibraryDone:
RET
srcIncludeSkip:
RSTA
RSTB
@@ -483,8 +523,12 @@ srcKeepEnd:
; ---- The current file, as one block so that it can be put aside in one piece ----
;
SrcState:
; THIRTY TWO RATHER THAN THE TWENTY THREE A NAME NEEDS, because what goes here is a PATH:
; an include not found beside you is looked for in the library, and "/Lib/" plus a name of
; twenty two plus the zero that ends it is twenty eight. Every block of the file is asked
; for by this name, so it has to be the one that resolves, not the one that was typed.
SrcName:
#Reserve 0d23
#Reserve 0d32
SrcBlocks:
0x00 0x00
SrcIndex:
@@ -504,12 +548,19 @@ SrcEnded:
SrcBuffer:
#Reserve 0d256
; 292 bytes: a name of 23, six numbers of two, one single byte, and the buffer. NOTHING MAY
; BE ADDED IN THE MIDDLE OF THE BLOCK ABOVE without changing this to match.
; 301 bytes: a name of 32, six numbers of two, one single byte, and the buffer. NOTHING MAY
; BE ADDED IN THE MIDDLE OF THE BLOCK ABOVE without changing this to match, and the room
; set aside for six of them in scratch.asm has to be at least six times it.
SrcStateBytes:
0x01 0x24
0x01 0x2D
SrcDepthLimit:
0d6
; Where an include is looked for when it is not beside you. One fixed place rather than a
; list somebody sets, for the same reason the shell has one fixed place for programs: a
; list would need somewhere to live between one boot and the next.
SrcLibrary:
"/Lib/"
SrcOne:
0x00 0x01