diff --git a/Programs/CosmOS/README.md b/Programs/CosmOS/README.md index 6e218bf..8c6bacc 100644 --- a/Programs/CosmOS/README.md +++ b/Programs/CosmOS/README.md @@ -263,6 +263,10 @@ prompt rather than at the shell. `x` and `d` share a position, and each leaves it after what it displayed, so either may be given without an address to continue from where the last one stopped. +**Everything the shell does still works in the monitor**, since it is a mode of the shell +rather than a different program: a program can be started by name, `dir` still lists, and a +word that is nothing at all is still told so. + For example: ```text diff --git a/Programs/CosmOS/Source/cosmos.asm b/Programs/CosmOS/Source/cosmos.asm index 354d966..5a89e55 100644 --- a/Programs/CosmOS/Source/cosmos.asm +++ b/Programs/CosmOS/Source/cosmos.asm @@ -331,6 +331,20 @@ promptWhere: CALL textSame BRQ doAssemble + ; ---- And a word the monitor does not know either ---- + ; + ; It goes where the shell's unknown words go, which is the disk, because the monitor is a + ; MODE of the shell rather than a different program and everything the shell can do is + ; still supposed to work in it. + ; + ; THERE WAS NOTHING HERE AT ALL, and the fall through was into sayPrompt - a routine, which + ; ended in a RET that had nothing of its own to return to. So it took whatever the Stack + ; held and went there. Sometimes that was 0x0003, in the middle of newLine, and the machine + ; stopped on a byte that is not an instruction; once it was inside sbfsFormat, and the + ; machine formatted the disk it had booted from. The tell was a SECOND prompt printed + ; before the wreckage, which is sayPrompt doing exactly what it is for on its way past. + BRI promptUnknown + ; Where you are, and then the prompt itself. A routine rather than a run of code in the loop, ; because the loop is no longer the only thing that needs it - see shellReadTyped. sayPrompt: diff --git a/SplitBit Test Manual.md b/SplitBit Test Manual.md index 88170ac..a66dbea 100644 --- a/SplitBit Test Manual.md +++ b/SplitBit Test Manual.md @@ -79,7 +79,7 @@ from `make`, not from here. ### 1. Recorded output `Tests/run.sh` assembles each program named in `Tests/manifest`, runs it, and compares -everything it printed against a file in `Tests/expected`. 196 tests, of which 134 run, 35 +everything it printed against a file in `Tests/expected`. 197 tests, of which 135 run, 35 only assemble, 16 are expected to fail to assemble, and 11 boot from ROM with no image given at all. diff --git a/Tests/expected/cosmosMonitorRun.out b/Tests/expected/cosmosMonitorRun.out new file mode 100644 index 0000000..5b58768 --- /dev/null +++ b/Tests/expected/cosmosMonitorRun.out @@ -0,0 +1,42 @@ +CosmOS +> monitor +x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves +* Say hello from the monitor +it says: hello from the monitor +finished +* Crash opcode +that byte is not an instruction, at 4081 + A 00 B 0F Q 00 +the program was stopped +* nonsense +I do not know: nonsense +* b program +bank 00 +* exit +> dir +greet.sbx 211 +hello.sbx 53 +Life.sbx 1396 +Snake.sbx 2164 +Keys.sbx 664 +Say.sbx 156 +Break.sbx 149 +Grid.sbx 559 +Press.sbx 872 +Mode.sbx 48 +Crash.sbx 632 +notes.txt 21 +Apps +hi.script 121 +bad.script 45 +plain.script 24 +cross.script 280 +nonl.script 38 +outer.script 376 +inner.script 44 +loop.script 35 +20 files, 1 directory +> exit +halted +Execution halted. +[exit 0] diff --git a/Tests/input/cosmosMonitorRun.in b/Tests/input/cosmosMonitorRun.in new file mode 100644 index 0000000..3a220da --- /dev/null +++ b/Tests/input/cosmosMonitorRun.in @@ -0,0 +1,8 @@ +monitor +Say hello from the monitor +Crash opcode +nonsense +b program +exit +dir +exit diff --git a/Tests/manifest b/Tests/manifest index 073b13b..f26d7a7 100644 --- a/Tests/manifest +++ b/Tests/manifest @@ -340,6 +340,16 @@ cosmosFault | CosmOS/Source/cosmos.asm | run | cosmosFau # monitor by jumping into the unwritten space above CosmOS and below where programs load, # which is zeroes - so it faults at once and corrupts nothing on the way. cosmosFaultSystem | CosmOS/Source/cosmos.asm | run | cosmosFaultSys.in | - | disks/cosmos.img +# A word the MONITOR does not know. There was nothing at the end of its command list, so an +# unrecognised word fell through into sayPrompt - a routine, whose RET then had nothing of its +# own to return to and went wherever the Stack happened to point. That was 0x0003 in the +# middle of newLine one time and inside sbfsFormat another, which formatted the disk the +# machine had booted from. +# +# So all three cases are here: a program run by name, a program that faults, and a word that +# is nothing at all. The monitor is a mode of the shell and everything the shell does is +# meant to work in it. +cosmosMonitorRun | CosmOS/Source/cosmos.asm | run | cosmosMonitorRun.in | - | disks/cosmos.img # The shell editing the line it is being given, which is the whole reason the keys were # made to arrive. Every line here is typed wrong and then corrected with a different key, and # every one of them comes out as the same command - so the recording says both what the