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:
co-authored by
Claude Opus 5
parent
da91a36d92
commit
06bdbf7728
+48
-30
@@ -112,44 +112,62 @@ cosmos: $(COSMOS) $(APPS) $(NATIVE_ASM)
|
||||
# and twenty eight more names. The superblock has carried this number per disk since the
|
||||
# format was written, so nothing but this line knows what it is.
|
||||
$(COSMOS_DISK): $(APPS) $(NATIVE_ASM) testPrograms/stringKeyword.asm \
|
||||
CosmOS/Apps/hello.asm CosmOS/Apps/Say.asm CosmOS/Apps/Keys.asm \
|
||||
CosmOS/Source/services.asm CosmOS/Source/console.asm \
|
||||
$(wildcard CosmOS/Apps/*.asm) \
|
||||
$(wildcard CosmOS/Source/*.asm) $(wildcard CosmOS/Assembler/*.asm)
|
||||
@mkdir -p $(@D)
|
||||
rm -f $@
|
||||
$(DISKTOOL) format $@ 4096 24
|
||||
@for app in $(APPS); do $(DISKTOOL) put $@ $$app; done
|
||||
$(DISKTOOL) put $@ $(NATIVE_ASM)
|
||||
@# SOURCE goes on as well, because an assembler with nothing to assemble is a
|
||||
@# demonstration of nothing.
|
||||
@# THREE DIRECTORIES, WHICH IS WHAT A CLEAN INSTALL LOOKS LIKE: what you run, what you
|
||||
@# assemble, and what those include. It was thirty nine files in one list with
|
||||
@# cosmos.asm sitting between fileStream.asm and sbfs.asm.
|
||||
@#
|
||||
@# hello.asm and Say.asm are the APPLICATION versions, so each assembles to a .sbx
|
||||
@# written straight over the one the host tool put there - which means the next
|
||||
@# thing loaded is a program the machine built itself, in the same breath.
|
||||
@# The split is by ROLE rather than by which directory the host keeps them in. /Source
|
||||
@# holds the things you name to the assembler and /Lib the things they pull in, which is
|
||||
@# a distinction the host makes with -I and the machine now makes with a search path of
|
||||
@# its own: an include is looked for beside you and then in /Lib. Without that, every
|
||||
@# source that calls a service would have to sit in the same directory as services.asm
|
||||
@# and there would be nothing to organise.
|
||||
$(DISKTOOL) mkdir $@ /Apps
|
||||
$(DISKTOOL) mkdir $@ /Source
|
||||
$(DISKTOOL) mkdir $@ /Lib
|
||||
@# What you run. /Apps is the second place the shell looks when a word it does not know
|
||||
@# turns out to be a program, so anything in here starts by name from anywhere.
|
||||
@for app in $(APPS); do \
|
||||
$(DISKTOOL) put $@ $$app /Apps/`basename $$app` >/dev/null || exit 1; done
|
||||
$(DISKTOOL) put $@ $(NATIVE_ASM) /Apps/Asm.sbx
|
||||
@# What you assemble. All of it, because an assembler with nothing to assemble is a
|
||||
@# demonstration of nothing:
|
||||
@#
|
||||
@# Keys.asm is the one that brings a vector of its own, so assembling it exercises the
|
||||
@# version two header and the Vector Segment: the loader installs its handler, the
|
||||
@# console interrupts into it, and the shell takes the vector back at exit.
|
||||
@#
|
||||
@# strings.asm is the odd one out on purpose: it has no #Include and no #Base, so it
|
||||
@# comes out as a boot image rather than a loadable program, and the difference
|
||||
@# between the two is visible on one disk.
|
||||
$(DISKTOOL) put $@ CosmOS/Apps/hello.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Apps/Say.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Apps/Keys.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Source/services.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Source/console.asm
|
||||
$(DISKTOOL) put $@ testPrograms/stringKeyword.asm strings.asm
|
||||
@# And the whole of CosmOS, and the whole of the assembler, so that the machine can
|
||||
@# build the system it is running on and then build the thing that built it:
|
||||
@#
|
||||
@# > load Asm.sbx
|
||||
@# > run cosmos.asm
|
||||
@# > run Asm.asm
|
||||
@# > cd /Source
|
||||
@# /Source> Asm cosmos.asm the system it is running on
|
||||
@# /Source> Asm Asm.asm and the thing that built it
|
||||
@#
|
||||
@# Both come out byte for byte what the host tool makes from the same source.
|
||||
@for f in CosmOS/Source/*.asm CosmOS/Assembler/*.asm; do \
|
||||
$(DISKTOOL) put $@ $$f >/dev/null; done
|
||||
@#
|
||||
@# Keys.asm brings a vector of its own, so assembling it exercises the version two
|
||||
@# header and the Vector Segment: the loader installs its handler, the console
|
||||
@# interrupts into it, and the shell takes the vector back at exit.
|
||||
@#
|
||||
@# strings.asm is the odd one out on purpose. It has no #Include and no #Base, so it
|
||||
@# comes out as a boot image rather than a loadable program, and the difference between
|
||||
@# the two is visible on one disk.
|
||||
$(DISKTOOL) put $@ CosmOS/Source/cosmos.asm /Source/cosmos.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Assembler/Asm.asm /Source/Asm.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Assembler/readTest.asm /Source/readTest.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Assembler/tokenTest.asm /Source/tokenTest.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Apps/hello.asm /Source/hello.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Apps/Say.asm /Source/Say.asm
|
||||
$(DISKTOOL) put $@ CosmOS/Apps/Keys.asm /Source/Keys.asm
|
||||
$(DISKTOOL) put $@ testPrograms/stringKeyword.asm /Source/strings.asm
|
||||
@# And what those include. Everything here is named by an #Include somewhere and by
|
||||
@# nothing else, which is exactly what makes it a library rather than a source.
|
||||
@for f in CosmOS/Source/console.asm CosmOS/Source/fileStream.asm \
|
||||
CosmOS/Source/sbfs.asm CosmOS/Source/services.asm CosmOS/Source/text.asm \
|
||||
CosmOS/Assembler/classify.asm CosmOS/Assembler/labels.asm \
|
||||
CosmOS/Assembler/numbers.asm CosmOS/Assembler/scratch.asm \
|
||||
CosmOS/Assembler/source.asm CosmOS/Assembler/table.asm \
|
||||
CosmOS/Assembler/token.asm CosmOS/Assembler/vectors.asm; do \
|
||||
$(DISKTOOL) put $@ $$f /Lib/`basename $$f` >/dev/null || exit 1; done
|
||||
|
||||
# The system as well as the disk. Building only the image leaves whatever cosmos.bin was
|
||||
# there before, or none at all, and then the disk is booted with a system that does not
|
||||
|
||||
Reference in New Issue
Block a user