; Status.asm ; Says what the last program made of what it was asked to do. ; ; The shell keeps the number and does not print it, because a program that failed has ; already said so in words and a number beside that would be noise. But a number nobody can ; see is a number nobody can trust, so this is how a person looks. ; ; 0 it did what it was asked ; 1 it did not ; 2 it was asked wrongly ; ; A program may give its own meanings if it says so, and Compare does: one there means the ; files differ, which is a result rather than a failure. ; ; Written by Anachronaut #Include services.asm #Program #Base 0x5000 start: SWI osLastStatus MVQA SETD.0 Was STA.0 SETD.0 Prefix SWI osPrintString ; A and B together, most significant first - so the status is the LOW half. Put in A the ; first time this was written, which printed a status of two as five hundred and twelve. RSTA SETD.0 Was LDB.0 SWI osPrintNumber ; And in words, for the three the system itself uses. SETD.0 Was LDA.0 BRA sayWorked INIB 0d1 XOR BRQ sayFailed SETD.0 Was LDA.0 INIB 0d2 XOR BRQ sayAsked BRI done sayWorked: SETD.0 WorkedText SWI osPrintString BRI done sayFailed: SETD.0 FailedText SWI osPrintString BRI done sayAsked: SETD.0 AskedText SWI osPrintString done: SETD.0 NewLine SWI osPrintString RSTA SWI osExit #Data #Base 0x3000 Prefix: "the last program left " WorkedText: ", which is: it did what it was asked" FailedText: ", which is: it did not" AskedText: ", which is: it was asked wrongly" NewLine: " " Was: 0x00