; HELP pacakge - version 29.12.88

               XDEF    LinkTop
               XDEF    HelpText

               XDEF    ComalStr
               XDEF    PckStr

               include 'ram:package.i'

; Initialisation section
               MOVE.L  D0,A0                  ; Package structure
               MOVE.L  A0,PckStr              ; Save package struckture
               MOVE.L  PckCmlStr(A0),ComalStr ; .. and  Comal structure
               MOVE.L  #LinkTop,PckTopId(A0)  ; Set address of top link
               MOVE.L  #Signal,PckSignal(A0)  ; .. and Signal routine
               MOVE.L  #ConIn,PckConIn(A0)    ; Address of ConIn
               MOVE.B  #4,PckPrior(A0)        ; Set priority
               BSET    #PckConInBit,PckFlag+1(A0) ; .. and ConIn-flag
               CLR.W   D0                     ; Status
               RTS                            ; Return

; Signal routine
Signal:        CMP.W   #5,D0           ; Change to mode ?
               BCC.S   ChgConInFlg     ; Yes -> branch
               RTS

ChgConInFlg:   MOVE.L  PckStr,A0
               CMP.W   #7,D0           ; .. or to execute mode ?
               BCC.S   SetConInFlg     ; Yes -> branch
               BCLR    #PckConInBit,PckFlag+1(A0) ; Cear ConIn-flag
               RTS

SetConInFlg:   BSET    #PckConInBit,PckFlag+1(A0) ; Set ConIn-flag
               RTS

; ConIn routine
ConIn0:        MOVE.L  #HelpText,D2
               MOVE.L  #HelpLen,D3
               JSR     CONOUT(A0)      ; Output Help-text
; Routine entrance
ConIn:         MOVE.L  ComalStr,A0
               JSR     CONIN(A0)       ; Get character to D0.B
               CMP.B   #$94,D0         ; 'Help' ?
               BEQ.S   ConIn0          ; Yes -> output help-text
               RTS

               SECTION HelpData,DATA

LinkTop:       DC.L    0               ; No procedures

HelpText:      DC.B    'Help-tasten er ikke til megen nytte ..',10,13
               DC.B    '.. men den kan maaske blive det!',10,13
HelpLen:       EQU     *-HelpText

               SECTION HelpBlock,BSS
;
; Internal workspace
;
ComalStr:      DS.L    1               ; Address of Comal structure
PckStr:        DS.L    1               ; .. package structure

               END 

