Give Programs/ one rule: a directory per kind, nothing loose
Five .asm files sat at the top of Programs/ beside six directories, with
nothing to say which a new file should join - and hello.asm, which is the
native assembler's first target and named in sixteen places, looked like a
stray.
Programs/
Examples/ what you read to learn: hello, printHello, inputTest,
replCalculator, and Fibonacci, primeSieve and gameOfLife
as sets of their own
Libraries/ included by name, no entry point of their own
Loader/ loader.asm, and the loadable program it reads
CosmOS/ the system, its applications and its assembler
testPrograms/ what 'make test' drives
Loader/ is the one worth explaining. loader.asm is not a demonstration: it
reads a program off a disk, puts the two pieces where the header asks, and
jumps to the entry. CosmOS grew out of it and does the same thing as one of
its commands. It is kept because backward compatibility with the simplest
version of the system is a standing goal, and it was sitting loose next to
the demos as though it were one.
Programs/loadable/ was a directory holding one file called hello.asm - a
third thing of that name, and the name said nothing about why it was there.
It is Loader/loadable.asm now, beside the loader that reads it.
Every reference moved with them: the makefile's program list, twelve
manifest lines, makedisks.sh, native.sh, and four paths across the README
and both manuals. Verified by deleting both build directories and running
the whole suite from nothing.
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
6dbb38b209
commit
ccf4b384e1
+2
-2
@@ -46,7 +46,7 @@ for i in 1 2 3 4 5 6 7 8; do "$TOOL" put "$DISKS/sbfs.img" "filler$i.txt" >/dev/
|
||||
# bytes, so that what gets loaded is always built from the source beside it.
|
||||
"$TOOL" format "$DISKS/load.img" 64 2 >/dev/null
|
||||
# The assembler writes a loadable program itself, because the source says where it goes.
|
||||
"$ROOT/Assembler" "$ROOT/Programs/loadable/hello.asm" -o "$WORK/hello.sbx" >/dev/null
|
||||
"$ROOT/Assembler" "$ROOT/Programs/Loader/loadable.asm" -o "$WORK/hello.sbx" >/dev/null
|
||||
"$TOOL" put "$DISKS/load.img" "$WORK/hello.sbx" >/dev/null
|
||||
|
||||
# A disk for CosmOS. greet.sbx asks the system for everything it does rather than talking
|
||||
@@ -170,7 +170,7 @@ awk 'BEGIN { for (i = 0; i < 50; i++) printf "small %05d\n", i }' > small.txt
|
||||
# oldest program in the repository: the first thing this machine ever ran is the first
|
||||
# thing it assembles for itself.
|
||||
"$TOOL" format "$DISKS/asm.img" 2048 4 >/dev/null
|
||||
cp "$ROOT/Programs/hello.asm" hello.asm
|
||||
cp "$ROOT/Programs/Examples/hello.asm" hello.asm
|
||||
"$TOOL" put "$DISKS/asm.img" hello.asm >/dev/null
|
||||
"$ROOT/Assembler" -I "$ROOT/Programs/CosmOS/Source" -I "$ROOT/Programs/CosmOS/Assembler" \
|
||||
"$ROOT/Programs/CosmOS/Assembler/readTest.asm" -o "$WORK/readTest.sbx" >/dev/null
|
||||
|
||||
+13
-13
@@ -30,16 +30,16 @@
|
||||
# on what a program prints.
|
||||
|
||||
# ---- Programs that halt on their own ----
|
||||
hello | hello.asm | run | - | -
|
||||
printHello | printHello.asm | run | - | -
|
||||
8bitFibonacci | Fibonacci/8bitFibonacci.asm | run | - | -
|
||||
16bitFibonacci | Fibonacci/16bitFibonacci.asm | run | - | -
|
||||
32bitFibonacci | Fibonacci/32bitFibonacci.asm | run | - | -
|
||||
8bitSieve | primeSieve/8bitSieve.asm | run | - | -
|
||||
16bitSegmentedSieve | primeSieve/16bitSegmentedSieve.asm | run | - | -
|
||||
hello | Examples/hello.asm | run | - | -
|
||||
printHello | Examples/printHello.asm | run | - | -
|
||||
8bitFibonacci | Examples/Fibonacci/8bitFibonacci.asm | run | - | -
|
||||
16bitFibonacci | Examples/Fibonacci/16bitFibonacci.asm | run | - | -
|
||||
32bitFibonacci | Examples/Fibonacci/32bitFibonacci.asm | run | - | -
|
||||
8bitSieve | Examples/primeSieve/8bitSieve.asm | run | - | -
|
||||
16bitSegmentedSieve | Examples/primeSieve/16bitSegmentedSieve.asm | run | - | -
|
||||
# The four pointer rewrite. It emits exactly the same primes as the line above, which
|
||||
# is the whole point of keeping both: the pair is a direct before and after.
|
||||
16bitSegmentedSieveModern | primeSieve/16bitSegmentedSieveModern.asm | run | - | -
|
||||
16bitSegmentedSieveModern | Examples/primeSieve/16bitSegmentedSieveModern.asm | run | - | -
|
||||
mathTest | testPrograms/mathTest.asm | run | - | -
|
||||
printTest | testPrograms/printTest.asm | run | - | -
|
||||
int16print | Libraries/int16print.asm | run | - | -
|
||||
@@ -86,7 +86,7 @@ sbfsEditTest | testPrograms/sbfsEditTest.asm | run | -
|
||||
# Loading a program off a disk and running it. Everything below this line existed before
|
||||
# the loader did; the only new part is the sixteen bytes on the front of a loadable
|
||||
# program saying where it goes.
|
||||
loader | loader.asm | run | - | - | disks/load.img
|
||||
loader | Loader/loader.asm | run | - | - | disks/load.img
|
||||
|
||||
# Storage. The image is made fresh for each run, so block 3 starts as zeroes.
|
||||
diskTest | testPrograms/diskTest.asm | run | - | - | disk.img
|
||||
@@ -348,20 +348,20 @@ asm-tokenTest | CosmOS/Assembler/tokenTest.asm | assemble | -
|
||||
asm-scratch | CosmOS/Assembler/scratch.asm | assemble | - | -
|
||||
|
||||
# ---- Programs driven by console input ----
|
||||
inputTest | inputTest.asm | run | inputTest.in | -
|
||||
inputTest | Examples/inputTest.asm | run | inputTest.in | -
|
||||
inputTestOld | testPrograms/inputTest.asm | run | inputTest.in | -
|
||||
replCalculator | replCalculator.asm | run | replCalculator.in | -
|
||||
replCalculator | Examples/replCalculator.asm | run | replCalculator.in | -
|
||||
|
||||
# ---- Programs that run forever by design, bounded by a cycle count ----
|
||||
# 3,000,000 cycles is about fourteen generations of the glider, which puts
|
||||
# evolveBoard and its pointer juggling through its paces many times over.
|
||||
16x16Life | gameOfLife/16x16Life.asm | run | - | 3000000
|
||||
16x16Life | Examples/gameOfLife/16x16Life.asm | run | - | 3000000
|
||||
# The four pointer rewrite, on the same budget so the two can be compared directly.
|
||||
# Note that this cannot show a speed difference: frameDelay is 255 by 255 and swamps
|
||||
# the simulation, so both versions render the same fourteen generations and produce
|
||||
# identical bytes. What it checks is that the rewrite still evolves the board the same
|
||||
# way, which is what a regression test is for.
|
||||
16x16LifeModern | gameOfLife/16x16LifeModern.asm | run | - | 3000000
|
||||
16x16LifeModern | Examples/gameOfLife/16x16LifeModern.asm | run | - | 3000000
|
||||
|
||||
# ---- Libraries: no entry point, so only check that they assemble ----
|
||||
# The CosmOS libraries assemble on their own, unlike print.asm below, which cannot: it
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ mkdir -p "$WORK"
|
||||
-o "$WORK/Asm.sbx" "$ROOT/Programs/CosmOS/Assembler/Asm.asm" >/dev/null || exit 1
|
||||
|
||||
"$TOOL" format "$WORK/native.img" 2048 4 >/dev/null
|
||||
"$TOOL" put "$WORK/native.img" "$ROOT/Programs/hello.asm" hello.asm >/dev/null
|
||||
"$TOOL" put "$WORK/native.img" "$ROOT/Programs/Examples/hello.asm" hello.asm >/dev/null
|
||||
"$TOOL" put "$WORK/native.img" "$WORK/Asm.sbx" Asm.sbx >/dev/null
|
||||
|
||||
# The applications, and the file of service names they all include. These are the reason
|
||||
@@ -86,7 +86,7 @@ done
|
||||
check "it wrote a file" grep -q "wrote hello.bin" "$WORK/session.txt"
|
||||
|
||||
# ---- And the file is the one the host assembler makes ----
|
||||
"$ASM" -o "$WORK/reference.bin" "$ROOT/Programs/hello.asm" >/dev/null
|
||||
"$ASM" -o "$WORK/reference.bin" "$ROOT/Programs/Examples/hello.asm" >/dev/null
|
||||
"$TOOL" get "$WORK/native.img" hello.bin "$WORK/native.bin" >/dev/null 2>&1
|
||||
if [ -f "$WORK/native.bin" ]; then
|
||||
REPORT="$(wc -c < "$WORK/native.bin" | tr -d ' ') bytes"
|
||||
|
||||
Reference in New Issue
Block a user