Start a program by typing its name
A word the shell has no command for is now looked for on the disk as "<name>.sbx", and if it is there it is loaded and started exactly as load and run would do it. Whatever followed the word reaches the program through osArgument by the same route as whatever follows run, so "Say hello there" and "Type notes.txt" work without either program knowing how it was started. load and run are unchanged and both stay. load is how the monitor puts an arbitrary file in front of itself, which typing a name deliberately cannot do: the extension is added rather than assumed, so "notes.txt" looks for notes.txt.sbx and a text file is unreachable by name whatever is inside it. Three things this had to get right: The built-ins are tried first and always win. The search hangs off the end of the dispatch chain, so a file called dir.sbx cannot become dir, and the commands worth trusting when the disk is what you are doubting stay trustworthy. The invoke disk carries a working dir.sbx so that this is checked rather than asserted. A file that is found but is broken says so. "not a program" and "I do not know" are different answers, and giving the second about a file sitting on the disk would send somebody looking in the wrong place. loadProgram therefore hands back a status as well as a message, since only "no file of that name" can fairly be reported as anything other than a fault. doLoad became that subroutine rather than being copied. It ends in RET instead of a jump to the prompt, and each way of failing sets its number and its text together so a new one cannot leave half of the answer behind. cosmosBreak moves because Break prints the pointers it was handed and those are the shell's leftovers, which a CALL now puts back. 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
dbe58db660
commit
2b0aeeefd4
@@ -0,0 +1,30 @@
|
||||
CosmOS
|
||||
> it says: hello there
|
||||
finished
|
||||
> it says: spelled out in full
|
||||
finished
|
||||
> it says: once more
|
||||
finished
|
||||
> Say.sbx 155
|
||||
dir.sbx 155
|
||||
notes.txt 21
|
||||
notes.sbx 21
|
||||
4 files
|
||||
> not a program
|
||||
> not a program
|
||||
> I do not know: notes.txt
|
||||
> I do not know: nosuchprogram
|
||||
> I do not know: abcdefghijklmnopqr
|
||||
> I do not know: abcdefghijklmnopqrs
|
||||
> 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] load and start that program off the disk
|
||||
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]
|
||||
Reference in New Issue
Block a user