Super1 2.85 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
; 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

Jeffrey Lee's avatar
Jeffrey Lee committed
17
CliDPrompt    =  "CLI$$Prompt",0
Neil Turton's avatar
Neil Turton committed
18 19 20 21 22 23
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 ...
Jeffrey Lee's avatar
Jeffrey Lee committed
24
        LDR     R0,=ZeroPage+KernelMessagesBlock+4
Neil Turton's avatar
Neil Turton committed
25 26 27 28 29 30 31
        ADR     R1,%FT11
        MOV     R2,#0
        SWI     XMessageTrans_Lookup
        MOVVS   R2,R1
01
        LDRB    R0,[R2],#1
        CMP     R0,#31
Kevin Bracey's avatar
Kevin Bracey committed
32 33 34 35
        BLT     %FT02
        SWI     OS_WriteC
        B       %BT01
02      SWI     OS_NewLine
Neil Turton's avatar
Neil Turton committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
        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

Kevin Bracey's avatar
Kevin Bracey committed
51 52
GOSUPV
        WritePSRc 0, R0
Neil Turton's avatar
Neil Turton committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
        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
Kevin Bracey's avatar
Kevin Bracey committed
72 73
        MOV     R4, #0
        SWI     OS_ReadLine32
Neil Turton's avatar
Neil Turton committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
        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
Robert Sprowson's avatar
Robert Sprowson committed
90 91
        BVS     %FT01
        BL      WriteS_Translated
Neil Turton's avatar
Neil Turton committed
92 93
        =       "Escape:Escape",10,13,0
        ALIGN
Robert Sprowson's avatar
Robert Sprowson committed
94
01
Kevin Bracey's avatar
Kevin Bracey committed
95
        WritePSRc 0, R0                 ; Back to user mode.
Neil Turton's avatar
Neil Turton committed
96 97 98 99 100 101 102 103
      |
        SWI     OS_WriteS
        =       10,13, "Escape", 10,13, 0
        ALIGN
      ]
        B       CLILOP

        END