diff --git a/Programs/CosmOS/Source/cosmos.asm b/Programs/CosmOS/Source/cosmos.asm index d851f28..02d2cb3 100644 --- a/Programs/CosmOS/Source/cosmos.asm +++ b/Programs/CosmOS/Source/cosmos.asm @@ -168,6 +168,20 @@ promptSay: LDA.0 BNA quitRanOut + ; ---- How this line went, assumed good until something says otherwise ---- + ; + ; Cleared here rather than set at the end of each command, and that is what makes this + ; affordable. There are thirty seven ways back to this prompt and only fourteen of them + ; are failures, so marking the failures costs fourteen lines and marking the successes + ; would cost twenty three - and the twenty three would have to be found again every time + ; a command grew a new way to finish. A command that says nothing worked. + ; + ; A PROGRAM SETS THIS ITSELF, from handleExit, and it runs after this point - so what a + ; program made of its work is what stands, not the zero written here before it started. + SETD.1 LineFailed + RSTA + STA.1 + SETD.0 CommandLine CALL textSplit @@ -268,6 +282,17 @@ promptSay: CALL textSame BRQ doAssemble +; ---- A command that did not work ---- +; +; The one place a failure is recorded, so that the thing reading lines out of a file can +; tell whether to go on. It says nothing: whatever sent us here has already said what was +; wrong in words, and a number after that is noise. See LastStatus. +commandFailed: + INIA 0x01 + SETD.1 LineFailed + STA.1 + BRI prompt + promptUnknown: ; Nothing built in matched, so the disk is asked before anybody is told they are wrong. A ; word this shell does not know is very often the name of a program sitting right there, @@ -337,7 +362,7 @@ promptSayUnknown: SETD.0 CommandLine CALL printString CALL newLine - BRI prompt + BRI commandFailed ; Running out of console leaves the cursor part way along a line, because there was no ; return at the end to move it on. Somebody who typed "exit" has already pressed one, and @@ -544,7 +569,7 @@ dirNoDisk: SETD.0 NoDisk CALL printString CALL newLine - BRI prompt + BRI commandFailed ; DP0 names a string. Q is how many spaces pad it out to twenty four columns. A name ; already that long gets one space, so that it cannot run into the number after it. @@ -724,13 +749,13 @@ loadFailed: LDD.0.1 CALL printString CALL newLine - BRI prompt + BRI commandFailed loadNothingNamed: SETD.0 LoadWhat CALL printString CALL newLine - BRI prompt + BRI commandFailed ; ---- loadProgram ---- ; @@ -1504,7 +1529,7 @@ fileNoDisk: fileComplain: CALL printString CALL newLine - BRI prompt + BRI commandFailed ; ---- run ---- ; @@ -1552,7 +1577,7 @@ runNothing: SETD.0 NothingLoaded CALL printString CALL newLine - BRI prompt + BRI commandFailed ; DP0 is a string, DP1 is where it should go, and B is how much room there is counting ; the zero on the end. What does not fit is left behind, and what is written is a string @@ -2264,6 +2289,12 @@ handlePrintNumber: ; that failed has already said so in words, and a number beside that would be noise. It is ; here for the thing that cannot read words - whatever comes to run programs in sequence and ; has to decide whether to run the next one. +; +; IT IS NOT LineFailed, and the difference is worth keeping. This one is a PROGRAM'S answer +; and belongs to whoever asks for it, which the shell's own status command does and a test +; records. Zeroing it as each line began - which is what the script reader wanted - wiped +; the answer before the command that reports it could read its own line. Two questions, two +; bytes. handleLastStatus: SETD.2 LastStatus LDA.2 @@ -2333,6 +2364,15 @@ handleExit: SETD.1 LastStatus STA.1 + ; And the line that started it failed, if the program says it did. The script reader asks + ; one question - did this line work - and a program answering "no" is one of the ways it + ; can be answered. + BRA exitWorked + INIA 0x01 + SETD.1 LineFailed + STA.1 +exitWorked: + SETD.1 SystemStack LDD.0.1 MVDS.0 @@ -2445,13 +2485,13 @@ bankNotThere: SETD.0 NoSuchBank CALL printString CALL newLine - BRI prompt + BRI commandFailed bankWhat: SETD.0 BankUsage CALL printString CALL newLine - BRI prompt + BRI commandFailed ; x [address] - sixty four bytes. d [address] - eight instructions. Without an address ; either carries on from where the last one stopped, so reading through memory is one @@ -2603,12 +2643,12 @@ dumpBadWhere: SETD.0 ExamineUsage CALL printString CALL newLine - BRI prompt + BRI commandFailed dumpNoBank: SETD.0 NoSuchBank CALL printString CALL newLine - BRI prompt + BRI commandFailed ; s