diff --git a/Programs/CosmOS/README.md b/Programs/CosmOS/README.md index ebdb999..399d274 100644 --- a/Programs/CosmOS/README.md +++ b/Programs/CosmOS/README.md @@ -283,6 +283,37 @@ facility and as a test that CosmOS correctly restores its Stack and vector table every run; and `load` is how the monitor puts an arbitrary file in front of itself, which is a thing typing a name deliberately cannot do. +### Typing A Line: + +The shell reads what you type a key at a time and edits the line itself, which is why the +line can be moved about in at all. + +| Key | What it does | +| -- | -- | +| Left, Right | Move a character. | +| Home, End | Go to the start of the line or the end of it. | +| Backspace | Take out the character before the cursor. | +| Delete | Take out the one under it. | +| Return | Finish the line, wherever the cursor happens to be sitting. | + +Anything typed goes in where the cursor is, so a word left out of the middle of a line is +put back by moving there and typing it, and the rest of the line moves along. + +**This used to be three different things depending on where the machine was running.** On a +terminal the host held the line and did the echoing and the backspacing; behind a window the +console's own gatherer did it; from a file nothing did it at all. One job, three +implementations, and none of them here - which is why there was no way to move about in a +line, and nowhere for a history to live. Now the console delivers keys and says nothing +about what they mean, the same way it reports what a drive is and says nothing about what +should be on it, and the shell decides. + +The line holds 127 characters. It held 63 until the shell could edit one, which is when the +limit started to be felt: a copy between two disks with a directory on each is most of the +way there before anything has been said. + +Everything else that reads a line - an application calling `osReadLine`, the editor - is +unchanged and still gets a plain line with no editing in it. + ### Paths: Everywhere CosmOS takes a filename it will take a path: names with `/` between them, diff --git a/Programs/CosmOS/Source/cosmos.asm b/Programs/CosmOS/Source/cosmos.asm index 3f257ac..ceb19a0 100644 --- a/Programs/CosmOS/Source/cosmos.asm +++ b/Programs/CosmOS/Source/cosmos.asm @@ -188,7 +188,7 @@ promptWhere: ; ; So shellReadLine says it. It is the one place that knows. SETD.0 CommandLine - INIB 0d63 + INIB 0d127 CALL shellReadLine ; Running out of typing is how this ends. It is not the same as an empty line, which is @@ -389,7 +389,7 @@ shellReadQuiet: shellReadTyped: CALL sayPrompt - CALL readLine + CALL editLine RET ; ---- The same, for a caller that prints a prompt of its own ---- @@ -411,7 +411,512 @@ shellReadRaw: shellReadRawQuiet: RET shellReadRawTyped: - CALL readLine + CALL editLine + RET + +; ---- The line the person at the keyboard is typing ---- +; +; THREE DIFFERENT THINGS USED TO DO THIS JOB and which one you got depended on where the +; machine was running. On a terminal the host held the line and did the echoing and the +; backspacing; behind a window the console's own gatherer did it; from a file nothing did it +; at all. One job, three implementations, and none of them here - which is why there was no +; way to move about in a line and nowhere for a history to live. +; +; So the shell does it. The console delivers keys and says nothing about what they mean, the +; same way the disk says what a drive is and nothing about what should be on it. Where the +; cursor goes and what the line looks like afterwards are decisions, and decisions belong to +; whoever is reading. +; +; DP0 names a buffer and B says how many characters it holds, not counting the zero byte +; that ends it. Q is how long the line turned out to be. That is readLine's bargain exactly, +; so this drops in where that was called. +; +; ConsoleEndOfInput is set if the console ran out instead of a line being finished, which is +; readLine's other promise and the one the shell uses to know when to stop. +; +; ---- Why most keystrokes draw nothing but themselves ---- +; +; A character typed at the END of a line needs no cursor moved: printing it is the whole of +; the change. That is the case almost every keystroke is, and it matters beyond speed - +; moving the cursor by hand means writing the console's cursor registers, which a terminal +; is told about in an escape sequence. Redrawing on every keypress would fill every recorded +; transcript in the test suite with them. So the cheap path is the common one, and the line +; is only reprinted when something happened in the middle of it. +editLine: + SETD.1 EditBase + STD.0.1 + SETD.1 EditRoom + STB.1 + + RSTA + SETD.1 EditLength + STA.1 + SETD.1 EditAt + STA.1 + SETD.1 ConsoleEndOfInput + STA.1 + + ; Where the line begins, ASKED rather than assumed. The prompt has just been printed and + ; only the console knows where it left off. + INA 0x03 + SETD.1 EditRow + STA.1 + INA 0x04 + SETD.1 EditColumn + STA.1 + + ; How wide the screen is, which is what decides where a long line carries on. A machine + ; with nothing on that port answers zero, and a width of zero would make the walking below + ; never finish, so it is taken as the width this system asks for at boot. + INA 0x32 + BNA editWidthKnown + INIA 0d80 +editWidthKnown: + SETD.1 EditWidth + STA.1 + + ; Key mode, with the cursor the shell keeps. Nothing echoes from here on: everything that + ; appears below is put there by this routine. + INIA 0x05 + OUTA 0x02 + +editKey: + INA 0x00 + SETD.1 EditChar + STA.1 + + ; The ways out first, since they leave rather than change anything. XOR leaves the answer + ; in Q and A alone, so one read stands for the whole ladder. + INIB 0x0A + XOR + BRQ editDone + INIB 0x0D + XOR + BRQ editDone + INIB 0xFF + XOR + BRQ editEnded + + ; ---- And the key that means there is no more ---- + ; + ; Ctrl-D, which the terminal used to turn into the end of input all by itself and cannot any + ; more: that is a thing a terminal does while it is holding the line, and it is not holding + ; it now. So the shell does it, which is the same trade as the echoing and the backspacing. + ; + ; ONLY ON AN EMPTY LINE, which is the rule everywhere else it appears. In the middle of + ; something typed it means neither "stop" nor a character, so it means nothing. + INIB 0x04 + XOR + BNQ editNotEnd + SETD.1 EditLength + LDB.1 + BRB editEnded +editNotEnd: + + INIB 0x08 + XOR + BRQ editBack + INIB 0x86 + XOR + BRQ editDelete + INIB 0x82 + XOR + BRQ editLeft + INIB 0x83 + XOR + BRQ editRight + INIB 0x84 + XOR + BRQ editHome + INIB 0x85 + XOR + BRQ editEnd + + ; Anything else is a character if it is printable and nothing at all if it is not. The + ; console's own keys that this shell has no use for land here and are ignored rather than + ; typed, which is the whole reason they are above ASCII. + INIB 0x20 + CCF + SUB + BRC editKey + INIB 0x7F + CCF + SUB + BNC editKey + +; ---- Putting a character in ---- +editInsert: + SETD.1 EditLength + LDA.1 + SETD.1 EditRoom + LDB.1 + CCF + SUB + BNC editKey ; Full. The zero byte on the end is not counted in the room. + + ; A hole at the insertion point, made from the top down so nothing is overwritten before + ; it has been moved. + SETD.1 EditLength + LDA.1 + SETD.1 EditAt + LDB.1 + CCF + SUB + MVQB ; How many characters are above the insertion point. + SETD.1 EditBase + LDD.0.1 + SETD.1 EditLength + LDA.1 + DPUA.0 ; One past the last character. +editInsertShift: + BRB editInsertPut + DECD.0 + LDA.0 + INCD.0 + STA.0 + DECD.0 + DECB + BRI editInsertShift +editInsertPut: + SETD.1 EditChar + LDA.1 + STA.0 + + SETD.1 EditLength + LDA.1 + INCA + STA.1 + SETD.1 EditAt + LDA.1 + INCA + STA.1 + + ; At the end of the line, printing it IS the change. + SETD.1 EditLength + LDB.1 + CCF + SUB + BNQ editInsertRedraw + SETD.1 EditChar + LDA.1 + OUTA 0x00 + BRI editKey +editInsertRedraw: + CALL editRedraw + BRI editKey + +; ---- Taking one out ---- +; +; Backspace and Delete are different keys doing different things: one takes the character +; BEFORE the insertion point, the other the one under it. They meet at editTakeOut, which is +; the only part they share. +editBack: + SETD.1 EditAt + LDA.1 + BRA editKey ; Nothing before it. Rubbing out past the start of the line + ; would eat the prompt, which belongs to whoever printed it. + DECA + STA.1 + + ; Whether that was the last character decides how it disappears, and it has to be asked + ; before the buffer shortens under it. + SETD.1 EditLength + LDB.1 + DECB + CCF + SUB + BNQ editBackMiddle + + CALL editTakeOut + ; Rubbed out where it stands, which is what a terminal has always done for a backspace: no + ; cursor moved by hand, and so nothing said to the terminal but three ordinary bytes. + INIA 0x08 + OUTA 0x00 + INIA 0x20 + OUTA 0x00 + INIA 0x08 + OUTA 0x00 + BRI editKey +editBackMiddle: + CALL editTakeOut + CALL editRedraw + BRI editKey + +editDelete: + SETD.1 EditAt + LDA.1 + SETD.1 EditLength + LDB.1 + CCF + SUB + BRQ editKey ; Nothing under the cursor at the end of a line. + CALL editTakeOut + CALL editRedraw + BRI editKey + +; Takes the character at the insertion point out of the buffer and shortens it. Draws +; nothing: what that should look like is the caller's business and the two callers disagree. +editTakeOut: + SETD.1 EditBase + LDD.0.1 + SETD.1 EditAt + LDA.1 + DPUA.0 + SETD.1 EditLength + LDA.1 + SETD.1 EditAt + LDB.1 + CCF + SUB + MVQB + DECB ; One of those is the character going. +editTakeOutShift: + BRB editTakeOutDone + INCD.0 + LDA.0 + DECD.0 + STA.0 + INCD.0 + DECB + BRI editTakeOutShift +editTakeOutDone: + SETD.1 EditLength + LDA.1 + DECA + STA.1 + RET + +; ---- Moving about in it ---- +; +; Nothing on the screen changes, so nothing on the screen is redrawn: only the cursor moves. +editLeft: + SETD.1 EditAt + LDA.1 + BRA editKey + DECA + STA.1 + BRI editShow + +editRight: + SETD.1 EditAt + LDA.1 + SETD.1 EditLength + LDB.1 + CCF + SUB + BRQ editKey ; Already at the end. + SETD.1 EditAt + LDA.1 + INCA + STA.1 + BRI editShow + +editHome: + RSTA + SETD.1 EditAt + STA.1 + BRI editShow + +editEnd: + SETD.1 EditLength + LDA.1 + SETD.1 EditAt + STA.1 +editShow: + SETD.1 EditAt + LDA.1 + CALL editPlace + BRI editKey + +; ---- The end of a line, and the end of the typing ---- +editEnded: + INIA 0x01 + SETD.1 ConsoleEndOfInput + STA.1 + ; AND NO NEWLINE. Nobody pressed Return, so there is no line to end: the console simply + ; stopped having anything to say. Printing one here pushes whatever is said next down a row + ; for a reason nobody could see, which is what it did until this line was written. + BRI editFinish +editDone: + ; The newline belongs after the whole line, not after wherever the cursor was left sitting. + ; Asked first, because a line finished at its end - which is almost every line - needs no + ; cursor moved and so says nothing to the terminal. + SETD.1 EditAt + LDA.1 + SETD.1 EditLength + LDB.1 + CCF + SUB + BRQ editDoneEnd + LDA.1 + CALL editPlace +editDoneEnd: + CALL newLine +editFinish: + + ; Line mode, with the cursor still on: that is how boot left the console and how every + ; program that knows nothing of any of this expects to find it. + INIA 0x04 + OUTA 0x02 + + SETD.1 EditBase + LDD.0.1 + SETD.1 EditLength + LDA.1 + DPUA.0 + RSTA + STA.0 ; The zero byte that ends it. + + SETD.1 EditLength + LDA.1 + RSTB + CCF + ADD ; Q is how long the line is. + RET + +; ---- Putting the line back on the screen ---- +; +; The whole of it, every time, rather than the part that changed. A hundred and twenty odd +; characters is nothing to this machine, and the alternative is four separate cases that all +; have to agree about what is already up there. +editRedraw: + SETD.1 EditRow + LDA.1 + OUTA 0x03 + SETD.1 EditColumn + LDA.1 + OUTA 0x04 + + SETD.1 EditBase + LDD.0.1 + SETD.1 EditLength + LDB.1 +editRedrawNext: + BRB editRedrawTail + LDA.0 + OUTA 0x00 + INCD.0 + DECB + BRI editRedrawNext +editRedrawTail: + ; One space after it. A line that has just got shorter has a character left over on the + ; end, and printing over it costs less than working out whether there is one. + INIA 0x20 + OUTA 0x00 + + CALL editAnchor + SETD.1 EditAt + LDA.1 + CALL editPlace + RET + +; ---- Where the line starts, worked out backwards ---- +; +; The console has just been told to print, so it knows where printing ENDED, and the line +; began that many characters before it. Asking afterwards rather than trusting what was +; remembered is what makes this survive the screen SCROLLING: a line printed on the bottom +; row moves everything up by one, and a remembered row would be one too low from then on. +editAnchor: + INA 0x03 + SETD.1 EditWalkRow + STA.1 + INA 0x04 + SETD.1 EditWalkColumn + STA.1 + SETD.1 EditLength + LDA.1 + INCA ; The space was printed too. + SETD.1 EditWalkBack + STA.1 +editAnchorWalk: + SETD.1 EditWalkColumn + LDA.1 + SETD.1 EditWalkBack + LDB.1 + CCF + SUB + BRC editAnchorRowUp ; Further back than this row goes. + MVQA + SETD.1 EditWalkColumn + STA.1 + BRI editAnchorDone +editAnchorRowUp: + ; Off the front of this row, so take what the row used and carry on along the one above. + SETD.1 EditWalkBack + LDA.1 + SETD.1 EditWalkColumn + LDB.1 + INCB ; The column itself, and the step onto it. + CCF + SUB + MVQA + SETD.1 EditWalkBack + STA.1 + SETD.1 EditWidth + LDA.1 + DECA + SETD.1 EditWalkColumn + STA.1 + SETD.1 EditWalkRow + LDA.1 + BRA editAnchorTop + DECA + STA.1 + BRI editAnchorWalk +editAnchorTop: + ; The line began off the top of the screen, which means more was scrolled away than the + ; line is long. There is nothing sensible left to point at, so it starts in the corner. + RSTA + SETD.1 EditWalkColumn + STA.1 +editAnchorDone: + SETD.1 EditWalkRow + LDA.1 + SETD.1 EditRow + STA.1 + SETD.1 EditWalkColumn + LDA.1 + SETD.1 EditColumn + STA.1 + RET + +; A says how many characters along the line the cursor belongs. Puts it there, carrying onto +; the rows below when the line is longer than one row of the screen. +editPlace: + SETD.1 EditColumn + LDB.1 + CCF + ADD + MVQA + SETD.1 EditWalkColumn + STA.1 + SETD.1 EditRow + LDA.1 + SETD.1 EditWalkRow + STA.1 +editPlaceWrap: + SETD.1 EditWalkColumn + LDA.1 + SETD.1 EditWidth + LDB.1 + CCF + SUB + BRC editPlaceDone ; Inside the row. + MVQA + SETD.1 EditWalkColumn + STA.1 + SETD.1 EditWalkRow + LDA.1 + INCA + STA.1 + BRI editPlaceWrap +editPlaceDone: + SETD.1 EditWalkRow + LDA.1 + OUTA 0x03 + SETD.1 EditWalkColumn + LDA.1 + OUTA 0x04 RET ; ---- A command that did not work ---- @@ -4776,9 +5281,45 @@ DirSize: WidthLeft: 0x00 -; Sixty three characters and the zero byte that ends them. +; ---- What a line being typed is made of ---- +; +; All of it lives here rather than being passed about, because the routine that reads a line +; is a loop over keystrokes and there are four Data Pointers, two of which it needs for the +; buffer and the walking. +EditBase: + 0x00 0x00 +EditRoom: + 0x00 +EditLength: + 0x00 +EditAt: + 0x00 +EditRow: + 0x00 +EditColumn: + 0x00 +EditWidth: + 0x00 +EditChar: + 0x00 + +; Where the counting up and down the rows has got to. Separate from EditRow and EditColumn, +; which are where the LINE starts: one of the two things that reads these is working out +; that very answer, and a walk that wrote its intermediate steps into its own starting point +; would be walking away from a moving mark. +EditWalkRow: + 0x00 +EditWalkColumn: + 0x00 +EditWalkBack: + 0x00 + +; A hundred and twenty seven characters and the zero byte that ends them. It was sixty three +; until the shell learned to edit a line, which is when the limit started to be felt: a copy +; between two disks with a directory on each is most of the way there before anything has +; been said, and the line can now be moved about in, so a long one is worth having. CommandLine: - #Reserve 0d64 + #Reserve 0d128 #Vectors diff --git a/SplitBit Test Manual.md b/SplitBit Test Manual.md index 3350fa1..dbbf339 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`. 188 tests, of which 126 run, 35 +everything it printed against a file in `Tests/expected`. 189 tests, of which 127 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/agree.sh b/Tests/agree.sh index b975c9a..96cf6de 100755 --- a/Tests/agree.sh +++ b/Tests/agree.sh @@ -169,7 +169,10 @@ if cmp -s toCopy.dat copiedBack.dat; then else report FAIL "large native copy" "the host read back different bytes" fi -if grep -q '^> the same$' copied.txt; then +# Not anchored to a prompt any more. The shell echoes the line it was given and then ends +# it, so what a command prints now starts at the beginning of a line instead of following +# the "> " that asked for it. +if grep -q '^the same$' copied.txt; then report ok "native compare" "the streamed files agree" else report FAIL "native compare" "Compare did not call the copied files equal" diff --git a/Tests/expected/cfgFallback.out b/Tests/expected/cfgFallback.out index 50e7294..c7866da 100644 --- a/Tests/expected/cfgFallback.out +++ b/Tests/expected/cfgFallback.out @@ -2,15 +2,20 @@ stage two no /System/Boot/missing.bin trying the fallback CosmOS -> saved it +> Files +saved it read it back, 22 bytes: a file kept by asking renamed it deleted it and it is gone finished -> made -> /Notes> 0 files -/Notes> halted +> mkdir Notes +made +> cd Notes +/Notes> dir +0 files +/Notes> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmos.out b/Tests/expected/cosmos.out index bbd1bea..b88843b 100644 --- a/Tests/expected/cosmos.out +++ b/Tests/expected/cosmos.out @@ -1,5 +1,6 @@ CosmOS -> dir list what is on the disk +> help +dir list what is on the disk load read a program off the disk run [words] start what was loaded, and tell it those words [words] look where you are and then in /Apps, and start that @@ -14,7 +15,8 @@ rename 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 -> greeting.txt 17 +> dir +greeting.txt 17 filler1.txt 8 filler2.txt 8 filler3.txt 8 @@ -27,7 +29,10 @@ across.txt 700 empty.txt 0 aName22CharactersLong! 22 12 files -> > I do not know: frobnicate -> halted +> +> frobnicate +I do not know: frobnicate +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosBigDir.out b/Tests/expected/cosmosBigDir.out index 9de501d..e28a7b5 100644 --- a/Tests/expected/cosmosBigDir.out +++ b/Tests/expected/cosmosBigDir.out @@ -1,6 +1,8 @@ CosmOS no filesystem on the disk -> no filesystem on the disk -> halted +> dir +no filesystem on the disk +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosBlankDisk.out b/Tests/expected/cosmosBlankDisk.out index b529edb..a84fc5b 100644 --- a/Tests/expected/cosmosBlankDisk.out +++ b/Tests/expected/cosmosBlankDisk.out @@ -1,6 +1,9 @@ CosmOS -> drive: nothing this can read is in that drive -> 0 -> halted +> drive 1 +drive: nothing this can read is in that drive +> drive +0 +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosBreak.out b/Tests/expected/cosmosBreak.out index 3ba8dd2..64465a1 100644 --- a/Tests/expected/cosmosBreak.out +++ b/Tests/expected/cosmosBreak.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 -> two stops, and what the registers were at each +> load Break.sbx +loaded, starting at 4000 +> run +two stops, and what the registers were at each break at 4016 A 11 B 22 Q 00 status 00 DP0 2030 DP1 2000 DP2 2037 DP3 4000 SP FFFF @@ -11,6 +13,7 @@ DP0 2000 DP1 2037 DP2 2030 DP3 4000 SP FFF5 press a key carried on to the end finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosBuild.out b/Tests/expected/cosmosBuild.out index c209576..85ff880 100644 --- a/Tests/expected/cosmosBuild.out +++ b/Tests/expected/cosmosBuild.out @@ -1,27 +1,50 @@ CosmOS -> 0 files -> made -> made -> made -> Apps +> dir +0 files +> mkdir Apps +made +> mkdir Apps/Deep +made +> mkdir Notes +made +> dir +Apps Notes 0 files, 2 directories -> /Apps> Deep +> cd Apps +/Apps> dir +Deep 0 files, 1 directory -/Apps> cannot make that: check the path, the name, and whether it is taken -/Apps> made -/Apps> /Notes> Deep +/Apps> mkdir Deep +cannot make that: check the path, the name, and whether it is taken +/Apps> mkdir /Notes/Deep +made +/Apps> cd /Notes +/Notes> dir +Deep 0 files, 1 directory -/Notes> cannot remove that: it must be a directory, and empty -/Notes> removed -/Notes> that is a directory -/Notes> removed -/Notes> > cannot make that: check the path, the name, and whether it is taken -> cannot remove that: it must be a directory, and empty -> cannot remove that: it must be a directory, and empty -> removed -> removed -> 0 files -> halted +/Notes> rmdir /Apps +cannot remove that: it must be a directory, and empty +/Notes> rmdir /Apps/Deep +removed +/Notes> delete /Apps +that is a directory +/Notes> rmdir /Notes/Deep +removed +/Notes> cd / +> mkdir Apps/Deep/Inner +cannot make that: check the path, the name, and whether it is taken +> rmdir Apps/Deep/Inner +cannot remove that: it must be a directory, and empty +> rmdir Apps/Deep +cannot remove that: it must be a directory, and empty +> rmdir Apps +removed +> rmdir Notes +removed +> dir +0 files +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosClaim.out b/Tests/expected/cosmosClaim.out index fc599df..99456dd 100644 --- a/Tests/expected/cosmosClaim.out +++ b/Tests/expected/cosmosClaim.out @@ -1,10 +1,13 @@ CosmOS -> claiming more than was reserved was refused +> Claim +claiming more than was reserved was refused and the size it really came to was taken finished -> Claim.sbx 580 +> dir +Claim.sbx 580 claim.dat 266 2 files -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosCopyCompare.out b/Tests/expected/cosmosCopyCompare.out index b952297..d2f1739 100644 --- a/Tests/expected/cosmosCopyCompare.out +++ b/Tests/expected/cosmosCopyCompare.out @@ -1,30 +1,44 @@ CosmOS -> copied +> Copy /Input/empty.dat /Output/empty.dat +copied finished -> the same +> Compare /Input/empty.dat /Output/empty.dat +the same finished -> copied +> Copy /Input/exact.dat /Output/exact.dat +copied finished -> the same +> Compare /Input/exact.dat /Output/exact.dat +the same finished -> copied +> Copy /Input/tail.dat /Output/tail.dat +copied finished -> the same +> Compare /Input/tail.dat /Output/tail.dat +the same finished -> copied +> Copy /Input/large.dat /Output/large.dat +copied finished -> the same +> Compare /Input/large.dat /Output/large.dat +the same finished -> different +> Compare /Input/large.dat /Input/different.dat +different finished -> copy: cannot find the source +> Copy /Input/missing.dat /Output/missing.dat +copy: cannot find the source finished -> compare: cannot find the second file +> Compare /Input/large.dat /Input/missing.dat +compare: cannot find the second file finished -> copy: give me a source and destination +> Copy +copy: give me a source and destination finished -> compare: give me two files +> Compare /Input/large.dat +compare: give me two files finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosCrossDisk.out b/Tests/expected/cosmosCrossDisk.out index 1b98d67..b999df1 100644 --- a/Tests/expected/cosmosCrossDisk.out +++ b/Tests/expected/cosmosCrossDisk.out @@ -1,11 +1,18 @@ CosmOS -> > copied +> drive 1 +> Copy 1:/twoblocks.txt 0:/crossed.txt +copied finished -> 1 -> it says: from drive one +> drive +1 +> Say from drive one +it says: from drive one finished -> 1 -> > greet.sbx 211 +> drive +1 +> cd 0:/ +> dir +greet.sbx 211 hello.sbx 53 Life.sbx 1396 Snake.sbx 2164 @@ -26,6 +33,7 @@ inner.script 44 loop.script 35 crossed.txt 560 19 files, 1 directory -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosCwd.out b/Tests/expected/cosmosCwd.out index c30eda7..ddeab11 100644 --- a/Tests/expected/cosmosCwd.out +++ b/Tests/expected/cosmosCwd.out @@ -1,36 +1,56 @@ CosmOS -> Apps +> dir +Apps A B 0 files, 3 directories -> /A> Say.sbx 53 +> cd /A +/A> dir +Say.sbx 53 notes.txt 25 2 files -/A> these are the notes in A -finished -/A> /B> and these are the very different notes in B -finished -/B> it says: reached the one in Apps -finished -/B> /A> Hello, World! -finished -/A> > Apps -A -B -0 files, 3 directories -> /B> these are the notes in A -finished -/B> moved, and reading a bare name from there: +/A> Type notes.txt these are the notes in A finished -/B> and these are the very different notes in B +/A> cd /B +/B> Type notes.txt +and these are the very different notes in B finished -/B> no such file -/B> that is not a directory -/B> > Apps +/B> Say reached the one in Apps +it says: reached the one in Apps +finished +/B> cd /A +/A> Say reached the one in A +Hello, World! +finished +/A> cd .. +> dir +Apps A B 0 files, 3 directories -> halted +> cd /B +/B> Type ../A/notes.txt +these are the notes in A +finished +/B> Wander /A +moved, and reading a bare name from there: +these are the notes in A +finished +/B> Type notes.txt +and these are the very different notes in B +finished +/B> cd nosuchplace +no such file +/B> cd notes.txt +that is not a directory +/B> cd / +> dir +Apps +A +B +0 files, 3 directories +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosDeep.out b/Tests/expected/cosmosDeep.out index 136bab5..ba6083d 100644 --- a/Tests/expected/cosmosDeep.out +++ b/Tests/expected/cosmosDeep.out @@ -1,5 +1,14 @@ CosmOS -> /abcdefghijklmnopqrst01> /abcdefghijklmnopqrst01/abcdefghijklmnopqrst02> /abcdefghijklmnopqrst01/abcdefghijklmnopqrst02/abcdefghijklmnopqrst03> /abcdefghijklmnopqrst01/abcdefghijklmnopqrst02/abcdefghijklmnopqrst03/abcdefghijklmnopqrst04> /abcdefghijklmnopqrst01/abcdefghijklmnopqrst02/abcdefghijklmnopqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05> ...opqrst01/abcdefghijklmnopqrst02/abcdefghijklmnopqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05/abcdefghijklmnopqrst06> ...opqrst02/abcdefghijklmnopqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05/abcdefghijklmnopqrst06/abcdefghijklmnopqrst07> ...opqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05/abcdefghijklmnopqrst06/abcdefghijklmnopqrst07/abcdefghijklmnopqrst08> dir list what is on the disk +> cd abcdefghijklmnopqrst01 +/abcdefghijklmnopqrst01> cd abcdefghijklmnopqrst02 +/abcdefghijklmnopqrst01/abcdefghijklmnopqrst02> cd abcdefghijklmnopqrst03 +/abcdefghijklmnopqrst01/abcdefghijklmnopqrst02/abcdefghijklmnopqrst03> cd abcdefghijklmnopqrst04 +/abcdefghijklmnopqrst01/abcdefghijklmnopqrst02/abcdefghijklmnopqrst03/abcdefghijklmnopqrst04> cd abcdefghijklmnopqrst05 +/abcdefghijklmnopqrst01/abcdefghijklmnopqrst02/abcdefghijklmnopqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05> cd abcdefghijklmnopqrst06 +...opqrst01/abcdefghijklmnopqrst02/abcdefghijklmnopqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05/abcdefghijklmnopqrst06> cd abcdefghijklmnopqrst07 +...opqrst02/abcdefghijklmnopqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05/abcdefghijklmnopqrst06/abcdefghijklmnopqrst07> cd abcdefghijklmnopqrst08 +...opqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05/abcdefghijklmnopqrst06/abcdefghijklmnopqrst07/abcdefghijklmnopqrst08> help +dir list what is on the disk load read a program off the disk run [words] start what was loaded, and tell it those words [words] look where you are and then in /Apps, and start that @@ -14,6 +23,8 @@ rename 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 -...opqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05/abcdefghijklmnopqrst06/abcdefghijklmnopqrst07/abcdefghijklmnopqrst08> > halted +...opqrst03/abcdefghijklmnopqrst04/abcdefghijklmnopqrst05/abcdefghijklmnopqrst06/abcdefghijklmnopqrst07/abcdefghijklmnopqrst08> cd +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosDrivePath.out b/Tests/expected/cosmosDrivePath.out index dc1862f..ec77504 100644 --- a/Tests/expected/cosmosDrivePath.out +++ b/Tests/expected/cosmosDrivePath.out @@ -1,9 +1,20 @@ CosmOS -> /notes> 1 -/notes> > 0 -> /2things> 1 -/2things> > /2things> 1 -/2things> no such file -/2things> halted +> cd 1:/notes +/notes> drive +1 +/notes> cd 0:/ +> drive +0 +> cd 1:/2things +/2things> drive +1 +/2things> cd / +> cd 2things +/2things> drive +1 +/2things> cd 9:/ +no such file +/2things> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosDrives.out b/Tests/expected/cosmosDrives.out index 7b7452a..ce6aef6 100644 --- a/Tests/expected/cosmosDrives.out +++ b/Tests/expected/cosmosDrives.out @@ -1,6 +1,8 @@ CosmOS -> 0 -> greet.sbx 211 +> drive +0 +> dir +greet.sbx 211 hello.sbx 53 Life.sbx 1396 Snake.sbx 2164 @@ -20,12 +22,21 @@ outer.script 376 inner.script 44 loop.script 35 18 files, 1 directory -> > other.txt 28 +> drive 1 +> dir +other.txt 28 notes 2things twoblocks.txt 560 2 files, 2 directories -> /notes> > /notes> > /notes> drive: this machine has no such drive -/notes> halted +> cd /notes +/notes> drive 0 +> drive 1 +/notes> drive 0 +> drive 1 +/notes> drive 3 +drive: this machine has no such drive +/notes> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosEdit.out b/Tests/expected/cosmosEdit.out index 5d62735..2ed9233 100644 --- a/Tests/expected/cosmosEdit.out +++ b/Tests/expected/cosmosEdit.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 -> poem.txt, new file +> load Edit.sbx +loaded, starting at 4000 +> run poem.txt +poem.txt, new file > : : : : > : : > 1: alpha 2: INSERTED 3: beta @@ -10,12 +12,14 @@ CosmOS 3: beta > written, 22 bytes > finished -> poem.txt, 3 lines +> run poem.txt +poem.txt, 3 lines > 1: CHANGED 2: INSERTED 3: beta > there is no such line > finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosEditKeys.out b/Tests/expected/cosmosEditKeys.out new file mode 100644 index 0000000..98dec0e --- /dev/null +++ b/Tests/expected/cosmosEditKeys.out @@ -0,0 +1,17 @@ +CosmOS +> eco okecho ok  +ok +> Xecho okecho ok  +ok +> echo ok +ok +> echo okX  +ok +> echo kecho ok  +ok +> Xecho aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaecho aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ! +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa! +> exit +halted +Execution halted. +[exit 0] diff --git a/Tests/expected/cosmosEditLong.out b/Tests/expected/cosmosEditLong.out index bdbf6fa..9018d6d 100644 --- a/Tests/expected/cosmosEditLong.out +++ b/Tests/expected/cosmosEditLong.out @@ -1,14 +1,20 @@ CosmOS -> hello.asm, 31 lines +> Edit hello.asm +hello.asm, 31 lines > finished -> hello.asm, 31 lines +> Edit hello.asm +hello.asm, 31 lines > finished -> the last program left 0, which is: it did what it was asked +> Status +the last program left 0, which is: it did what it was asked finished -> a line in it is longer than this can edit, so it has not been opened +> Edit long.txt +a line in it is longer than this can edit, so it has not been opened finished -> the last program left 1, which is: it did not +> Status +the last program left 1, which is: it did not finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosFiles.out b/Tests/expected/cosmosFiles.out index d00c519..29d19d1 100644 --- a/Tests/expected/cosmosFiles.out +++ b/Tests/expected/cosmosFiles.out @@ -1,17 +1,26 @@ CosmOS -> one.txt 13 +> dir +one.txt 13 two.txt 14 2 files -> renamed -> first.txt 13 +> rename one.txt first.txt +renamed +> dir +first.txt 13 two.txt 14 2 files -> gone -> two.txt 14 +> delete first.txt +gone +> dir +two.txt 14 1 file -> no such file -> rename what to what? -> there is no such file, or that name is taken -> halted +> delete first.txt +no such file +> rename two.txt +rename what to what? +> rename two.txt two.txt +there is no such file, or that name is taken +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosGrid.out b/Tests/expected/cosmosGrid.out index fcbbcb8..9ace0d8 100644 --- a/Tests/expected/cosmosGrid.out +++ b/Tests/expected/cosmosGrid.out @@ -1,10 +1,15 @@ CosmOS -> it says: before Grid +> Say before Grid +it says: before Grid finished -> finished -> > it says: after Grid +> Grid +finished +> +> Say after Grid +it says: after Grid finished -> greet.sbx 211 +> dir +greet.sbx 211 hello.sbx 53 Life.sbx 1396 Snake.sbx 2164 @@ -24,6 +29,7 @@ outer.script 376 inner.script 44 loop.script 35 18 files, 1 directory -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosHello.out b/Tests/expected/cosmosHello.out index abdb6df..f3faba9 100644 --- a/Tests/expected/cosmosHello.out +++ b/Tests/expected/cosmosHello.out @@ -1,9 +1,13 @@ CosmOS -> loaded, starting at 4000 -> Hello, World! +> load hello.sbx +loaded, starting at 4000 +> run +Hello, World! finished -> Hello, World! +> run +Hello, World! finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosInvoke.out b/Tests/expected/cosmosInvoke.out index 47bbb38..28bd853 100644 --- a/Tests/expected/cosmosInvoke.out +++ b/Tests/expected/cosmosInvoke.out @@ -1,22 +1,33 @@ CosmOS -> it says: hello there +> Say hello there +it says: hello there finished -> it says: spelled out in full +> Say.sbx spelled out in full +it says: spelled out in full finished -> it says: once more +> run once more +it says: once more finished -> Say.sbx 156 +> dir +Say.sbx 156 dir.sbx 156 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 +> notes +not a program +> notes.sbx +not a program +> notes.txt +I do not know: notes.txt +> nosuchprogram +I do not know: nosuchprogram +> abcdefghijklmnopqr +I do not know: abcdefghijklmnopqr +> abcdefghijklmnopqrs +I do not know: abcdefghijklmnopqrs +> help +dir list what is on the disk load read a program off the disk run [words] start what was loaded, and tell it those words [words] look where you are and then in /Apps, and start that @@ -31,6 +42,7 @@ rename 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 +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosKeys.out b/Tests/expected/cosmosKeys.out index d766ffb..328f0ef 100644 --- a/Tests/expected/cosmosKeys.out +++ b/Tests/expected/cosmosKeys.out @@ -1,19 +1,29 @@ CosmOS -> loaded, starting at 4000 -> keys, by interrupt. q stops. +> load Keys.sbx +loaded, starting at 4000 +> run +keys, by interrupt. q stops. ab the console has been handed back finished -> > keys, by interrupt. q stops. +> +> run +keys, by interrupt. q stops. cd the console has been handed back finished -> > x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves -* bank 00 -* FE00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +> +> monitor +x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves +* b program +bank 00 +* x fe00 +FE00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ FE10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ FE20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ FE30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -* > halted +* exit +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosLife.out b/Tests/expected/cosmosLife.out index bfd2203..f3a3b14 100644 --- a/Tests/expected/cosmosLife.out +++ b/Tests/expected/cosmosLife.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 ->  # +> load Life.sbx +loaded, starting at 4000 +> run + # # ### diff --git a/Tests/expected/cosmosLifeKey.out b/Tests/expected/cosmosLifeKey.out index 8206a60..b9524a6 100644 --- a/Tests/expected/cosmosLifeKey.out +++ b/Tests/expected/cosmosLifeKey.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 ->  # +> load Life.sbx +loaded, starting at 4000 +> run + # # ### @@ -19,7 +21,8 @@ CosmOS stopped finished -> > +> +> halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosMonitor.out b/Tests/expected/cosmosMonitor.out index 37e4c7c..366ba4c 100644 --- a/Tests/expected/cosmosMonitor.out +++ b/Tests/expected/cosmosMonitor.out @@ -1,10 +1,16 @@ CosmOS -> x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves -* b -* there is no such bank -* loaded, starting at 4000 -* bank 00 -* 4000 47 00 20 00 SETD.0 2000 +> monitor +x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves +* b nonsense +b +* b 9 +there is no such bank +* load greet.sbx +loaded, starting at 4000 +* b program +bank 00 +* d 4000 +4000 47 00 20 00 SETD.0 2000 4004 72 10 SWI 10 4006 47 00 20 44 SETD.0 2044 400A 72 10 SWI 10 @@ -12,23 +18,32 @@ CosmOS 4010 27 1F INIB 1F 4012 72 11 SWI 11 4014 47 00 20 5D SETD.0 205D -* 4000 47 00 20 00 72 10 47 00 20 44 72 10 47 00 20 7A G. .r.G. Dr.G. z +* x 4000 +4000 47 00 20 00 72 10 47 00 20 44 72 10 47 00 20 7A G. .r.G. Dr.G. z 4010 27 1F 72 11 47 00 20 5D 72 10 47 00 20 7A 72 10 '.r.G. ]r.G. zr. 4020 47 00 20 65 72 10 20 72 12 00 00 00 00 00 00 00 G. er. r........ 4030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -* bank 01 -* 2000 61 20 70 72 6F 67 72 61 6D 2C 20 6C 6F 61 64 65 a program, loade +* b data +bank 01 +* x 2000 +2000 61 20 70 72 6F 67 72 61 6D 2C 20 6C 6F 61 64 65 a program, loade 2010 64 20 6F 66 66 20 61 20 64 69 73 6B 2C 20 72 75 d off a disk, ru 2020 6E 6E 69 6E 67 20 6F 6E 20 74 68 65 20 73 79 73 nning on the sys 2030 74 65 6D 20 74 68 61 74 20 6C 6F 61 64 65 64 20 tem that loaded -* bank 02 -* 0000 01 FF 00 00 00 00 00 00 01 FF 00 00 00 00 00 00 ................ +* b 2 +bank 02 +* x 0 +0000 01 FF 00 00 00 00 00 00 01 FF 00 00 00 00 00 00 ................ 0010 03 FF 08 00 00 00 00 00 01 20 01 00 00 00 00 00 ......... ...... 0020 00 FF 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 ................ 0030 00 FF 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 ................ -* that bank will not be written -* bank 00 -* * 8000 26 48 INIA 48 +* s 0 FF +that bank will not be written +* b program +bank 00 +* s 8000 26 48 D1 00 26 0A D1 00 18 12 +* d 8000 +8000 26 48 INIA 48 8002 D1 00 OUTA 00 8004 26 0A INIA 0A 8006 D1 00 OUTA 00 @@ -36,7 +51,8 @@ CosmOS 8009 12 AND 800A 00 ? 800B 00 ? -* Fault: 0x00 at Program Address 0x800A is not an instruction. +* g 8000Fault: 0x00 at Program Address 0x800A is not an instruction. + H Execution halted. [exit 1] diff --git a/Tests/expected/cosmosMore.out b/Tests/expected/cosmosMore.out index 1ec36fb..e1c3c41 100644 --- a/Tests/expected/cosmosMore.out +++ b/Tests/expected/cosmosMore.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 -> first line +> load More.sbx +loaded, starting at 4000 +> run readable.txt +first line second line line 00: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 01: ABCDEFGHIJKLMNOPQRSTUVWXYZ @@ -24,7 +26,8 @@ line 18: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 19: ABCDEFGHIJKLMNOPQRSTUVWXYZ -- more -- finished -> first line +> run readable.txt +first line second line line 00: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 01: ABCDEFGHIJKLMNOPQRSTUVWXYZ @@ -58,7 +61,8 @@ line 27: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 28: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 29: ABCDEFGHIJKLMNOPQRSTUVWXYZ finished -> first line +> run readable.txt +first line second line line 00: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 01: ABCDEFGHIJKLMNOPQRSTUVWXYZ @@ -84,6 +88,7 @@ line 19: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 20: ABCDEFGHIJKLMNOPQRSTUVWXYZ -- more -- finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosNoDisk.out b/Tests/expected/cosmosNoDisk.out index 0c7e54b..b6946a1 100644 --- a/Tests/expected/cosmosNoDisk.out +++ b/Tests/expected/cosmosNoDisk.out @@ -1,6 +1,7 @@ CosmOS no filesystem on the disk -> no filesystem on the disk +> dir +no filesystem on the disk > halted Execution halted. diff --git a/Tests/expected/cosmosPress.out b/Tests/expected/cosmosPress.out index b42f3b5..0beaef5 100644 --- a/Tests/expected/cosmosPress.out +++ b/Tests/expected/cosmosPress.out @@ -1,5 +1,6 @@ CosmOS -> a line, then keys. q stops. +> Press +a line, then keys. q stops. 61 62 63 64 keys: 80 up @@ -8,6 +9,8 @@ keys: 5A Z done finished -> > halted +> +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosPressKeys.out b/Tests/expected/cosmosPressKeys.out index b42f3b5..0beaef5 100644 --- a/Tests/expected/cosmosPressKeys.out +++ b/Tests/expected/cosmosPressKeys.out @@ -1,5 +1,6 @@ CosmOS -> a line, then keys. q stops. +> Press +a line, then keys. q stops. 61 62 63 64 keys: 80 up @@ -8,6 +9,8 @@ keys: 5A Z done finished -> > halted +> +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosRamDisk.out b/Tests/expected/cosmosRamDisk.out index 3a5d02d..ca77a2c 100644 --- a/Tests/expected/cosmosRamDisk.out +++ b/Tests/expected/cosmosRamDisk.out @@ -1,10 +1,16 @@ CosmOS -> > 0 files -> copied +> drive 1 +> dir +0 files +> Copy 0:/Say.sbx 1:/Say.sbx +copied finished -> Say.sbx 156 +> dir +Say.sbx 156 1 file -> 1 -> halted +> drive +1 +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosRun.out b/Tests/expected/cosmosRun.out index b4afbb4..43b9382 100644 --- a/Tests/expected/cosmosRun.out +++ b/Tests/expected/cosmosRun.out @@ -1,6 +1,8 @@ CosmOS -> nothing is loaded -> greet.sbx 211 +> run +nothing is loaded +> dir +greet.sbx 211 hello.sbx 53 Life.sbx 1396 Snake.sbx 2164 @@ -20,16 +22,23 @@ outer.script 376 inner.script 44 loop.script 35 18 files, 1 directory -> load what? -> no such file -> not a program -> loaded, starting at 4000 -> a program, loaded off a disk, running on the system that loaded it +> load +load what? +> load nosuch.sbx +no such file +> load notes.txt +not a program +> load greet.sbx +loaded, starting at 4000 +> run +a program, loaded off a disk, running on the system that loaded it what should I call you? hello, Anachronaut. that is all I do. finished -> a program, loaded off a disk, running on the system that loaded it +> run +a program, loaded off a disk, running on the system that loaded it what should I call you? hello, Claude. that is all I do. finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosSay.out b/Tests/expected/cosmosSay.out index 73df381..8c6e031 100644 --- a/Tests/expected/cosmosSay.out +++ b/Tests/expected/cosmosSay.out @@ -1,11 +1,16 @@ CosmOS -> loaded, starting at 4000 -> nothing was said +> load Say.sbx +loaded, starting at 4000 +> run +nothing was said finished -> it says: notes.txt +> run notes.txt +it says: notes.txt finished -> it says: a longer thing with spaces +> run a longer thing with spaces +it says: a longer thing with spaces finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosScript.out b/Tests/expected/cosmosScript.out index 13e8235..1314d6a 100644 --- a/Tests/expected/cosmosScript.out +++ b/Tests/expected/cosmosScript.out @@ -1,5 +1,6 @@ CosmOS -> > echo saying what it is doing +> do hi.script +> echo saying what it is doing saying what it is doing > Say from a script it says: from a script @@ -9,6 +10,7 @@ finished > Say and again it says: and again finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosScriptBad.out b/Tests/expected/cosmosScriptBad.out index 157fecf..b500aef 100644 --- a/Tests/expected/cosmosScriptBad.out +++ b/Tests/expected/cosmosScriptBad.out @@ -1,13 +1,18 @@ CosmOS -> > Say before +> do bad.script +> Say before it says: before finished > nosuchcommand I do not know: nosuchcommand stopped: that line did not work -> do: that is not a script - it wants #! on the first line -> do: cannot find it -> do: give me the name of a script -> halted +> do plain.script +do: that is not a script - it wants #! on the first line +> do nothere.script +do: cannot find it +> do +do: give me the name of a script +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosScriptEdges.out b/Tests/expected/cosmosScriptEdges.out index 07cbf8a..97d1212 100644 --- a/Tests/expected/cosmosScriptEdges.out +++ b/Tests/expected/cosmosScriptEdges.out @@ -1,10 +1,13 @@ CosmOS -> > Say across the block boundary +> do cross.script +> Say across the block boundary it says: across the block boundary finished -> > Say with no newline after me +> do nonl.script +> Say with no newline after me it says: with no newline after me finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosScriptNest.out b/Tests/expected/cosmosScriptNest.out index f4f8c80..82503bf 100644 --- a/Tests/expected/cosmosScriptNest.out +++ b/Tests/expected/cosmosScriptNest.out @@ -1,5 +1,6 @@ CosmOS -> > echo outer in block one +> do outer.script +> echo outer in block one outer in block one > do inner.script > echo inner one @@ -8,7 +9,8 @@ inner one inner two > echo outer resumed in block one outer resumed in block one -> > echo self +> do loop.script +> echo self self > do loop.script > echo self @@ -22,6 +24,7 @@ self > do loop.script do: scripts are only four deep stopped: that line did not work -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosServices.out b/Tests/expected/cosmosServices.out index cfce289..025c06a 100644 --- a/Tests/expected/cosmosServices.out +++ b/Tests/expected/cosmosServices.out @@ -1,12 +1,15 @@ CosmOS -> loaded, starting at 4000 -> saved it +> load Files.sbx +loaded, starting at 4000 +> run +saved it read it back, 22 bytes: a file kept by asking renamed it deleted it and it is gone finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosSettle.out b/Tests/expected/cosmosSettle.out index fd75c38..f4f66b2 100644 --- a/Tests/expected/cosmosSettle.out +++ b/Tests/expected/cosmosSettle.out @@ -1,8 +1,10 @@ CosmOS this is the fallback: what boot.cfg asks for did not start -> the disk says the last start did not arrive, so this is the fallback +> Settle +the disk says the last start did not arrive, so this is the fallback settled: the next start will use the configuration again finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosSettled.out b/Tests/expected/cosmosSettled.out index 7a23aaa..75ac36e 100644 --- a/Tests/expected/cosmosSettled.out +++ b/Tests/expected/cosmosSettled.out @@ -1,6 +1,8 @@ CosmOS -> already settled: the next start will use the configuration +> Settle +already settled: the next start will use the configuration finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosSlowDisk.out b/Tests/expected/cosmosSlowDisk.out index a118e46..e63e057 100644 --- a/Tests/expected/cosmosSlowDisk.out +++ b/Tests/expected/cosmosSlowDisk.out @@ -1,5 +1,6 @@ CosmOS -> greet.sbx 211 +> dir +greet.sbx 211 hello.sbx 53 Life.sbx 1396 Snake.sbx 2164 @@ -19,9 +20,12 @@ outer.script 376 inner.script 44 loop.script 35 18 files, 1 directory -> loaded, starting at 4000 -> it says: the disk took its time +> load Say.sbx +loaded, starting at 4000 +> run the disk took its time +it says: the disk took its time finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosSnake.out b/Tests/expected/cosmosSnake.out index 20c1cd8..d3fe86c 100644 --- a/Tests/expected/cosmosSnake.out +++ b/Tests/expected/cosmosSnake.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 -> +----------------+ +> load Snake.sbx +loaded, starting at 4000 +> run ++----------------+ | | | | | | diff --git a/Tests/expected/cosmosSource.out b/Tests/expected/cosmosSource.out index c244cfe..bfe6011 100644 --- a/Tests/expected/cosmosSource.out +++ b/Tests/expected/cosmosSource.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 -> ; This is a basic hello world program for the SplitBit CPU. +> load readTest.sbx +loaded, starting at 4000 +> run hello.asm +; This is a basic hello world program for the SplitBit CPU. ; We'll create a loop that outputs each byte of our string to Output 0, the text console. #Program @@ -22,6 +24,7 @@ End: "Hello, World!" ---- lines: 21 finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosStartup.out b/Tests/expected/cosmosStartup.out index 8240048..71a7388 100644 --- a/Tests/expected/cosmosStartup.out +++ b/Tests/expected/cosmosStartup.out @@ -4,7 +4,10 @@ CosmOS ready. > echo and loud again and loud again and quiet again at the end -> > typed by hand -> halted +> clear +> echo typed by hand +typed by hand +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosStartupBad.out b/Tests/expected/cosmosStartupBad.out index 65f6819..2bf3fb9 100644 --- a/Tests/expected/cosmosStartupBad.out +++ b/Tests/expected/cosmosStartupBad.out @@ -1,6 +1,9 @@ CosmOS startup.sh is there but does not begin with #!, so it was not run -> > typed by hand -> halted +> clear +> echo typed by hand +typed by hand +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosStatus.out b/Tests/expected/cosmosStatus.out index 32c19f4..ad458fd 100644 --- a/Tests/expected/cosmosStatus.out +++ b/Tests/expected/cosmosStatus.out @@ -1,16 +1,23 @@ CosmOS -> it says: it worked +> Say it worked +it says: it worked finished -> the last program left 0, which is: it did what it was asked +> Status +the last program left 0, which is: it did what it was asked finished -> type: give me a file name +> Type +type: give me a file name finished -> the last program left 2, which is: it was asked wrongly +> Status +the last program left 2, which is: it was asked wrongly finished -> type: cannot find the file, error 2 +> Type /nothing/here.txt +type: cannot find the file, error 2 finished -> the last program left 1, which is: it did not +> Status +the last program left 1, which is: it did not finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosStream.out b/Tests/expected/cosmosStream.out index 52b681d..0aa600c 100644 --- a/Tests/expected/cosmosStream.out +++ b/Tests/expected/cosmosStream.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 -> big.txt is 329 blocks +> load Stream.sbx +loaded, starting at 4000 +> run +big.txt is 329 blocks read 329 blocks, checksum 57368, stopped with 3 small.txt streamed is 15216, read whole is 15216 the same @@ -11,6 +13,7 @@ the new name answers 0 a name that was never there answers 2 a block past the end answers 3 finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosTokens.out b/Tests/expected/cosmosTokens.out index 5d4ac5a..4f29671 100644 --- a/Tests/expected/cosmosTokens.out +++ b/Tests/expected/cosmosTokens.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 -> 4 keyword 0 [#Program] +> load tokenTest.sbx +loaded, starting at 4000 +> run hello.asm +4 keyword 0 [#Program] 6 label: 0 [Start:] 7 instr 2 [LDA] 8 instr 1 [BRA] @@ -20,6 +22,7 @@ CosmOS 20 string 14 [Hello, World!] ---- no more tokens finished -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosTree.out b/Tests/expected/cosmosTree.out index ddbc56b..4782c5f 100644 --- a/Tests/expected/cosmosTree.out +++ b/Tests/expected/cosmosTree.out @@ -1,30 +1,49 @@ CosmOS -> Apps +> dir +Apps rooted.txt 21 1 file, 1 directory -> loaded, starting at 4000 -> it says: the shallow one +> load /Apps/Say.sbx +loaded, starting at 4000 +> run the shallow one +it says: the shallow one finished -> loaded, starting at 4000 -> Hello, World! +> load /Apps/Deep/Say.sbx +loaded, starting at 4000 +> run the deep one +Hello, World! finished -> loaded, starting at 4000 -> it says: the shallow one again +> load /Apps/./Deep/../Say.sbx +loaded, starting at 4000 +> run the shallow one again +it says: the shallow one again finished -> loaded, starting at 4000 -> Hello, World! +> load /Apps/Deep/../../Apps/./Deep/Say.sbx +loaded, starting at 4000 +> run the deep one the long way round +Hello, World! finished -> no such file -> no such file -> that is a directory -> no such file -> no such file -> no such file -> that is a directory -> gone -> Apps +> load /rooted.txt/Say.sbx +no such file +> load /Apps/Missing/Say.sbx +no such file +> load /Apps +that is a directory +> load /Apps/abcdefghijklmnopqrstuvw +no such file +> load / +no such file +> load /Apps/Deep/../.. +no such file +> delete /Apps +that is a directory +> delete /Apps/Deep/Say.sbx +gone +> dir +Apps rooted.txt 21 1 file, 1 directory -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosTreeWrite.out b/Tests/expected/cosmosTreeWrite.out index 38e8d43..c7c5966 100644 --- a/Tests/expected/cosmosTreeWrite.out +++ b/Tests/expected/cosmosTreeWrite.out @@ -1,15 +1,20 @@ CosmOS -> Folder +> dir +Folder Edit.sbx 2243 1 file, 1 directory -> loaded, starting at 4000 -> note.txt, new file +> load Edit.sbx +loaded, starting at 4000 +> run note.txt +note.txt, new file > : : : > written, 67 bytes > finished -> Folder +> dir +Folder Edit.sbx 2243 note.txt 67 2 files, 1 directory -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosType.out b/Tests/expected/cosmosType.out index 47fbf12..fedc460 100644 --- a/Tests/expected/cosmosType.out +++ b/Tests/expected/cosmosType.out @@ -1,6 +1,8 @@ CosmOS -> loaded, starting at 4000 -> first line +> load Type.sbx +loaded, starting at 4000 +> run readable.txt +first line second line line 00: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 01: ABCDEFGHIJKLMNOPQRSTUVWXYZ @@ -33,11 +35,15 @@ line 27: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 28: ABCDEFGHIJKLMNOPQRSTUVWXYZ line 29: ABCDEFGHIJKLMNOPQRSTUVWXYZ finished -> finished -> type: cannot find the file, error 2 +> run empty.txt finished -> type: give me a file name +> run missing.txt +type: cannot find the file, error 2 finished -> halted +> run +type: give me a file name +finished +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/cosmosTyped.out b/Tests/expected/cosmosTyped.out index 092a91c..6ab4839 100644 --- a/Tests/expected/cosmosTyped.out +++ b/Tests/expected/cosmosTyped.out @@ -1,5 +1,6 @@ CosmOS -> dir list what is on the disk +> halp   melp    elp +dir list what is on the disk load read a program off the disk run [words] start what was loaded, and tell it those words [words] look where you are and then in /Apps, and start that @@ -14,6 +15,7 @@ rename 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 +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/onceAsked.out b/Tests/expected/onceAsked.out index 289a758..acb33dd 100644 --- a/Tests/expected/onceAsked.out +++ b/Tests/expected/onceAsked.out @@ -1,9 +1,12 @@ CosmOS -> next start: /System/Boot/bare.bin, once +> Once /System/Boot/bare.bin +next start: /System/Boot/bare.bin, once finished -> System +> dir /System/Boot +System Apps 0 files, 2 directories -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/rebootDirect.out b/Tests/expected/rebootDirect.out index f5b9084..8632dca 100644 --- a/Tests/expected/rebootDirect.out +++ b/Tests/expected/rebootDirect.out @@ -1,6 +1,8 @@ CosmOS -> starting again +> Reboot +starting again CosmOS -> halted +> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/rebootOnce.out b/Tests/expected/rebootOnce.out index cbf6447..08a03b7 100644 --- a/Tests/expected/rebootOnce.out +++ b/Tests/expected/rebootOnce.out @@ -1,8 +1,10 @@ stage two CosmOS -> next start: /System/Boot/bare.bin, once +> Once /System/Boot/bare.bin +next start: /System/Boot/bare.bin, once finished -> starting again +> Reboot +starting again stage two just this once: /System/Boot/bare.bin bare metal: no system, just this diff --git a/Tests/expected/romBoot.out b/Tests/expected/romBoot.out index 402617e..bc027b8 100644 --- a/Tests/expected/romBoot.out +++ b/Tests/expected/romBoot.out @@ -1,14 +1,19 @@ stage two CosmOS -> saved it +> Files +saved it read it back, 22 bytes: a file kept by asking renamed it deleted it and it is gone finished -> cannot make that: check the path, the name, and whether it is taken -> /Notes> 0 files -/Notes> halted +> mkdir Notes +cannot make that: check the path, the name, and whether it is taken +> cd Notes +/Notes> dir +0 files +/Notes> exit +halted Execution halted. [exit 0] diff --git a/Tests/expected/selfBoot.out b/Tests/expected/selfBoot.out index d52025d..bf05c04 100644 --- a/Tests/expected/selfBoot.out +++ b/Tests/expected/selfBoot.out @@ -1,14 +1,19 @@ stage two CosmOS -> saved it +> Files +saved it read it back, 22 bytes: a file kept by asking renamed it deleted it and it is gone finished -> made -> /Notes> 0 files -/Notes> halted +> mkdir Notes +made +> cd Notes +/Notes> dir +0 files +/Notes> exit +halted Execution halted. [exit 0] diff --git a/Tests/input/cosmosEditKeys.in b/Tests/input/cosmosEditKeys.in new file mode 100644 index 0000000..8a8a00e --- /dev/null +++ b/Tests/input/cosmosEditKeys.in @@ -0,0 +1,7 @@ +eco ok„ƒƒh +Xecho ok„† +echo o„…k +echo okX +echo k‚o +Xecho aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa„†…! +exit diff --git a/Tests/lint-baseline.txt b/Tests/lint-baseline.txt index 7554eb3..1183ee7 100644 --- a/Tests/lint-baseline.txt +++ b/Tests/lint-baseline.txt @@ -16,7 +16,7 @@ Programs/CosmOS/Assembler/token.asm redundant-setd 2 Programs/CosmOS/Assembler/tokenTest.asm redundant-setd 1 Programs/CosmOS/Source/config.asm redundant-assignment 1 Programs/CosmOS/Source/cosmos.asm redundant-assignment 1 -Programs/CosmOS/Source/cosmos.asm redundant-setd 9 +Programs/CosmOS/Source/cosmos.asm redundant-setd 10 Programs/CosmOS/Source/sbfs.asm branch-to-next 1 Programs/CosmOS/Source/sbfs.asm redundant-assignment 4 Programs/CosmOS/Source/sbfs.asm redundant-setd 1 diff --git a/Tests/manifest b/Tests/manifest index cbfef25..2a7a698 100644 --- a/Tests/manifest +++ b/Tests/manifest @@ -305,6 +305,16 @@ cosmosPress | CosmOS/Source/cosmos.asm | run | cosmosPre # end - the window's path through the gatherer - and it has its own copy of the line mode # rule, so it needs its own test. The two recordings should agree, which is the point. cosmosPressKeys | CosmOS/Source/cosmos.asm | run | - | - | disks/cosmos.img | cosmosPress.in +# 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 +# machine printed on the way and that the line the shell finally acted on was right. +# +# The escape sequences in it are the point rather than noise: moving the cursor by hand is +# what a terminal is TOLD about, and they are the only evidence of where the shell thinks it +# is. The last line is eighty five characters at a prompt in column two, so the cursor has to +# be found on the row below - the one case the arithmetic exists for. +cosmosEditKeys | CosmOS/Source/cosmos.asm | run | cosmosEditKeys.in | - | disks/cosmos.img # The shell taking things off a disk and calling them something else, which is the last of # CosmOS's original four verbs to be built and the first time anything has changed a disk # from the shell. Its own image, because it changes what is on it: a fixture named with a