Let the console edit a line, and let a file be a keyboard
BACKSPACE REACHED THE SHELL. A terminal in line mode does not hand a program every keystroke: it collects a line, rubs out a backspace, and delivers the finished thing at Return. CosmOS has always relied on that, and behind a window there is no terminal to do it, so the raw 0x08 went into the command buffer. Correcting a typo produced a line that looked perfectly right on the screen and matched no command at all - "I do not know: help". So the console does it, because behind a window the console IS the terminal. In key mode it does not, and must not: a program in key mode asked for every keystroke as it happens. CosmOS now asks for eighty columns at boot. Its own help text is seventy-four characters wide, and dir, the monitor and the assembler's messages all assume room. The machine still wakes up in the smaller mode, which is right for a machine - it is the system that knows what shape of screen its own output needs, and a game that wants forty columns says so. AND A FILE CAN BE A KEYBOARD, which is the part that matters beyond today. The console behind a window is not the console behind a terminal, and until now the difference was unreachable: it broke twice in two days and a person typing found it both times. --keyboard installs the same hook a window does, so the same path runs, and the manifest has a column for it. cosmosTyped types "halp", backs over it, arrives at "help", and requires the help to come out. Verified by removing the rub-out, which loses the whole help text. It does not test the window. Voyager's key queue and everything about presenting frames are still out of reach. It tests the console, which is where the logic is. Along the way: VOY_OBJS was missing from the dependency include, so voyager.o never rebuilt when a header changed. EmulatorOptions grew a field, Voyager kept an object that disagreed about the size of the struct, and smashed its stack on every run. A clean build hides it and 'make sanitize' cleans first, so that would never have found it either. Tests/voyager.sh did, by failing all 115 tests that start the machine - which is the differential test earning its keep on a bug that has nothing to do with what it was built to check. 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
761c11a66b
commit
978aec4809
@@ -0,0 +1,16 @@
|
||||
CosmOS
|
||||
> dir list what is on the disk
|
||||
load <file> read a program off the disk
|
||||
run [words] start what was loaded, and tell it those words
|
||||
<name> [words] look where you are and then in /Apps, and start that
|
||||
cd [path] go to a directory, or to the root with nothing after it
|
||||
mkdir <path> make a directory
|
||||
rmdir <path> remove an empty one
|
||||
delete <file> take it off the disk
|
||||
rename <file> <to> call it something else
|
||||
monitor look at memory, change it, and jump into it
|
||||
help this
|
||||
exit stop, or leave the monitor if you are in it
|
||||
> halted
|
||||
Execution halted.
|
||||
[exit 0]
|
||||
@@ -0,0 +1,2 @@
|
||||
halpmelpelp
|
||||
exit
|
||||
+16
-1
@@ -4,7 +4,7 @@
|
||||
# One test per line, fields separated by '|'. Blank lines and lines starting
|
||||
# with '#' are ignored.
|
||||
#
|
||||
# name | source | mode | stdin | limit | disk
|
||||
# name | source | mode | stdin | limit | disk | keys
|
||||
#
|
||||
# source is relative to Programs/. Everything assembles from there with
|
||||
# Libraries/ on the include path, and the binary is written into Tests/build.
|
||||
@@ -25,6 +25,13 @@
|
||||
# nothing a test writes can be seen by the next one. Leave it off for a machine with no
|
||||
# disk, which is most of them. A trailing :ro attaches it write protected.
|
||||
#
|
||||
# keys names a file in Tests/input to be fed to the console as a KEYBOARD rather than as
|
||||
# standard input, and the difference is the point. Standard input reaches a console that
|
||||
# believes a terminal is handling the line editing, which is true when one is. A keyboard
|
||||
# reaches a console that knows it has to do the editing itself - gathering a line, rubbing
|
||||
# out a backspace, handing it over only at Return - which is what happens behind a window,
|
||||
# where there is no terminal to do any of it.
|
||||
#
|
||||
# A disk name with a directory in it, such as disks/sbfs.img, is one of the images that
|
||||
# Tests/makedisks.sh builds with SplitDisk before the run. Those are used as they stand,
|
||||
# so a test can read a filesystem written by the other implementation of the format.
|
||||
@@ -442,6 +449,14 @@ wedgedImage | Boot/wedged.asm | assemble | -
|
||||
# about a problem it will not let you fix. Settle is a program rather than a shell word:
|
||||
# one job, reached through SWI, replaceable, and callable by anything that comes to call
|
||||
# programs in sequence.
|
||||
# ---- The console doing a terminal's job ----
|
||||
#
|
||||
# Behind a window nothing is handling the line editing, so the console does it. Typing "halp",
|
||||
# backing over it, and arriving at "help" has to reach the shell as "help" - it used to arrive
|
||||
# with the backspaces still in it, which made a corrected line unrecognisable while looking
|
||||
# perfectly right on the screen.
|
||||
cosmosTyped | CosmOS/Source/cosmos.asm | run | - | - | disks/cosmos.img | cosmosTyped.keys
|
||||
|
||||
cosmosSettle | CosmOS/Source/cosmos.asm | run | settle.in | 90000000 | disks/settle.img
|
||||
# Saying so when there is nothing to settle is as much a part of it as doing it.
|
||||
cosmosSettled | CosmOS/Source/cosmos.asm | run | settle.in | 90000000 | disks/settled.img
|
||||
|
||||
+17
-1
@@ -171,14 +171,16 @@ uncolour() {
|
||||
sed -i -E 's/\x1b\[[0-9;]*m//g' "$1"
|
||||
}
|
||||
|
||||
while IFS='|' read -r name src mode stdin limit disk; do
|
||||
while IFS='|' read -r name src mode stdin limit disk keys; do
|
||||
name="$(trim "$name")"
|
||||
[ -z "$name" ] && continue
|
||||
case "$name" in \#*) continue ;; esac
|
||||
src="$(trim "$src")"
|
||||
mode="$(trim "$mode")"; stdin="$(trim "$stdin")"
|
||||
limit="$(trim "$limit")"; disk="$(trim "$disk")"
|
||||
keys="$(trim "${keys:-}")"
|
||||
[ -z "$disk" ] && disk="-"
|
||||
[ -z "$keys" ] && keys="-"
|
||||
|
||||
wanted "$name" || continue
|
||||
|
||||
@@ -231,6 +233,20 @@ while IFS='|' read -r name src mode stdin limit disk; do
|
||||
# clock, and --cycles for programs that never halt on their own, which
|
||||
# bounds them by cycle count rather than by wall clock.
|
||||
EMUARGS=(--fast "${EMULATOR_EXTRA[@]}")
|
||||
# ---- A file standing in for a keyboard ----
|
||||
#
|
||||
# Not the same as standard input, and that is the whole point of it. Input from a
|
||||
# file reaches a console that believes a terminal is doing the line editing; a
|
||||
# keyboard reaches one that knows it has to do the editing itself, which is what
|
||||
# happens behind a window. The second had no test at all until it broke twice.
|
||||
if [ "$keys" != "-" ]; then
|
||||
if [ ! -f "$INPUT/$keys" ]; then
|
||||
FAIL=$((FAIL + 1)); FAILED_NAMES+=("$name")
|
||||
report "FAIL" "$name" "missing keyboard fixture $keys"
|
||||
continue
|
||||
fi
|
||||
EMUARGS+=(--keyboard "$INPUT/$keys")
|
||||
fi
|
||||
[ "$limit" != "-" ] && EMUARGS+=(--cycles "$limit")
|
||||
# A disk starts fresh for every run, so a test cannot pass because of what a
|
||||
# previous one left lying on it. The emulator makes the image if it is
|
||||
|
||||
Reference in New Issue
Block a user