Super1 2.78 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
        TTL    => Super1

CliDPrompt    =  "CLI$Prompt",0
DefaultPrompt = "*"
        ALIGN

StartSuper ; Start entry for UtilModule
        BL      DEFHAN                  ; set error handler in case spooling
      [ International                   ; We are in USR mode and have no stack ...
        ADR     R0,KernelMessagesBlock+4
        ADR     R1,%FT11
        MOV     R2,#0
        SWI     XMessageTrans_Lookup
        MOVVS   R2,R1
01
        LDRB    R0,[R2],#1
        CMP     R0,#31
        SWIGT   OS_WriteC
        BGT     %BT01
        SWI     OS_NewLine
        SWI     OS_NewLine
        B       CLILOP
11
        =       "Supervisor",0
        ALIGN
      |
        SWI     OS_WriteS
        =       "Supervisor",10,13,10,13,0
        ALIGN
        B       CLILOP
      ]


CLIEXIT BL      DEFHN2                  ; restore all our world

GOSUPV  TEQP    PC, #0
        BL      DEFHAN                  ; including error handler!

CLILOP ROUT

        ADR     R0, CliDPrompt          ; try looking it up
        LDR     R1, =GeneralMOSBuffer
        MOV     R2, #?GeneralMOSBuffer
        MOV     R3, #0
        MOV     R4, #VarType_Expanded
        SWI     XOS_ReadVarVal
        ADRVS   r1, DefaultPrompt       ; gnot gthere or gnaff
        MOVVS   r2, #1
        MOV     r0, r1
        MOV     r1, r2
        SWI     OS_WriteN
        LDR     R0, =GeneralMOSBuffer
        LDR     R1, =?GeneralMOSBuffer-1
        MOV     R2, #" "
        MOV     R3, #255
        SWI     OS_ReadLine
        BCS     ESCAPE
        MOV     lr, pc                  ; construct lr for wallies to return to
        SWI     XOS_CLI
        BVC     CLILOP

        SWI     XOS_NewLine
        BL      PrintError
        B       CLILOP

        LTORG

ESCAPE  MOV     R0, #&7E
        SWI     OS_Byte                 ; May yield error
      [ International
        SWI     XOS_EnterOS             ; GO into SVC mode to get some stack
        SWI     OS_NewLine
        BLVC    WriteS_Translated
        =       "Escape:Escape",10,13,0
        ALIGN
        TEQP    PC,#0                   ; Back to user mode.
        MOV     R0,R0
      |
        SWI     OS_WriteS
        =       10,13, "Escape", 10,13, 0
        ALIGN
      ]
        B       CLILOP

        END