.TITLE CLE - Command Line Editor .IDENT /2.00q/ ; Description: CLE is an interactive command line editor for RSX, developed ; and tested under M+ V2.1. It works with MCR, DCL, and CCL. ; With CLE, the user is able to edit his command line before or ; even after dispatching the CLI and it "remembers" the last ; several commands which can be recalled, edited, and resubmitted ; as well. CLE function keys & keys are described below. ; ; Command edit functions Command recall functions ; ; LEFTARROW backup 1 character UPARROW backup 1 command ; RIGHTARROW advance 1 character DOWNARROW advance 1 command ; GOLD_LEFT backup to begin of cmd GOLD_UP backup to oldest cmd ; GOLD_RIGHT advance to end of command GOLD_DOWN advance to newest cmd ; ^A overstrike/insert ; DELETE delete 1 character left PF1 GOLD ; ^D delete 1 char at cursor PF2 help ; ^B delete to begin of cmd PF3 show status ; ^E delete to end of command PF4 show all commands ; ^R redisplay command ^K CLE/VMS keys ; ^U cancel command ^Z exit CLE ; ; VMS keys ; ; ^D backup 1 character ^B backup 1 command ; ^F advance 1 character ; ^H backup to begin of cmd ; ^E advance to end of command ; ^A overstrike/insert ; ^R redisplay command ^K CLE/VMS keys ; ^U delete to begin of cmd ^Z exit CLE ; ; Author: Steven L. Jobes, Mayo Foundation ; January, 1986 ; ; Credits: The philosophy of running a task to simply accept characters ; from the keyboard, buffer them and provide editing capabilities ; and buffer recall, then spawn the CLI to execute the command, ; was inspired by a task submitted to the DECUS library by ; F. Kuster of Zurich, Switzerland, who credits D. Sponza with the ; first idea. ; ; Disclaimer: * * * * * * * * * * * * * * * * * * * * * * ; This software is provided free of charge by Mayo Foundation. It ; is supplied on an "as-is" basis without warranty, express or ; implied, of any nature whatsoever. Neither the author nor Mayo ; Foundation shall bear any responsibility or liability for errors ; in this software or its documentation or for any loss or damage ; resulting from its use. Use of this software shall indicate its ; acceptance by the user according to these terms and the user ; hereby acknowledges that any statement or representation to the ; contrary is null and void. ; * * * * * * * * * * * * * * * * * * * * * * .PAGE ; Maintenance: 17-NOV-86 SLJ V2.00 Made the following changes/enhancments: ; - implement line 24 status ; - add VMS keys ; - make uparrow & downarrow like VMS ; - don't save identical command ; - redefine PF3 ; ; Notes: 1. If a character is inserted or deleted to the left of a ; horizontal tab ("011) or if a tab is inserted to the left of ; any character, the command line will be displayed improperly ; though passed to the CLI correctly. can be used ; to redisplay the command line. ; 2. CLE must wait for completion. So pressing while a ; command is executing will generate a CLI prompt, not a CLE ; prompt. And the command entered at the CLI prompt can not ; be edited. ; 3. Line 24 status option (conditional on symbol LINE24) requires ; VT100 or VT2XX terminal. Turning off this conditional ; removes all VT100/VT2XX-specific code, allowing CLE to be ; used with other CRTs, yet status can be displayed using PF3. ; 4. CONTROL-C ABORT, under versions of RSX which support it, ; should be disabled for CLE use. ; 5. Some kind of problem exists between CLE and SET /UIC with ; named directory support. Not fully investigated. ; ; Registers: Registers are used throughout this task as follows: ; R0 Scratch ; R1 Cursor (CURS) position in CMD ; R2 Left-most unused (LMUU) position in CMD ; R3 Scratch, except as noted ; R4 Addr of oldest command in FIFO ; R5 Addr of next command in FIFO .PAGE .NLIST BEX ;LINE24 = 1 ;If defined, line 24 is status OVRMOD = 1 ;If defined, overstrike mode default VMSKEY = 1 ;If defined, VMS keys default FIFOL = 300. ;FIFO bufr length (OK to change) CMDL = 78. ;Command line bufr length B.BYE = 1 ;Set if logging off B.GOLD = 2 ;Set if GOLD on B.ATT = 4 ;Set if attached B.OVER = 10 ;Set if overstrike on B.KEYS = 20 ;Set if VMS keys on B.FOUN = 200 ;Set if cmd found F.REV = -4 ;FIFO reverse link offset F.FOR = -2 ;FIFO forward link offset .MCALL DIR$,EXIT$S,GCII$,QIOW$,QIOW$S,SPWN$,STSE$S .MCALL JEQ,POP,PUSH .MCALL .PCODE,.PDATA,.IDATA .MACRO QIO A,L ;QIO addr[,len] MOV A,WRTDPB+Q.IOPL .iif nb MOV L,WRTDPB+Q.IOPL+2 DIR$ #WRTDPB .ENDM .PDATA ATTDPB: QIOW$ IO.ATT,5,1 ;Attach DPB DETDPB: QIOW$ IO.DET,5,1 ;Detach DPB GCIDPB: GCII$ CII,4 ;GCII DPB RDDPB: QIOW$ IO.RST!TF.RNE,5,1,,IOSB,, ;Read DPB .IDATA SPNDPB: SPWN$ CLI...,,,,,1,,,CMD ;Spawn DPB WRTDPB: QIOW$ IO.CCO,5,1,,,,<,,0> ;Write DPB .PCODE START: QIOW$S #SF.GMC,#5,#1,,,,<#SCP,#2> ;Get characteristics TSTB SCP+1 ;Is it a CRT ? JEQ EXIT ;No MOV #FIFO+4,R5 ;Init next cmd pointer MOV R5,CCPT ;Init current cmd pointer MOV R5,R4 ;Init TOP pointer MOV #DUMY+4,F.REV(R4) ;Link to dummy record MOV R4,DUMY+4+F.FOR ;Link dummy record CLR STAT ;Init status .iif df OVRMOD BIS #B.OVER,STAT ;Overstrike default .iif df VMSKEY BIS #B.KEYS,STAT ;VMS keys default .if df LINE24 JSR PC,UMOD ;Update mode JSR PC,UKEY ;Update keys JSR PC,UNUM ;Update numbers QIO #VT3,#VT3L ;Display .endc PROMPT: QIO #PTXT,#3 ;Prompt user MOV #CMD,R1 ;CURS pointer MOV R1,R2 ;LMUU pointer BIT #B.ATT,STAT ;Attached ? BNE NEXT ;Yes DIR$ #ATTDPB ;Attach TI: BIS #B.ATT,STAT ;Attached NEXT: BIC #B.GOLD,STAT ;Clear GOLD on indicator NEXT1: DIR$ #RDDPB ;Read 1 character MOVB IOSB+1,R0 ; BIC #177600,R0 ;7-bit ASCII CMPB R0,#177 ; ? BEQ DEL1LF ;Yes BIC #177740,R0 ;Word offset into table BEQ INSERT ;Not key ASL R0 ;Byte offset into table BIT #B.KEYS,STAT ;VMS keys ? BEQ 1$ ;No JMP @VTABL(R0) ;Jump via VMS flavor table 1$: JMP @CTABL(R0) ;Jump via original recipe table HORTAB: MOVB #11,ICH ;ASCII horz tab ;Fall through INSERT: CMP R2,#CMD+CMDL ;Room to insert ? BLO 1$ ;Yes QIO #DING,#1 ;No, ring the bell BR NEXT ; 1$: CMP R1,#CMD ;New line ? BNE 2$ ;No CMPB ICH,#40 ;Space ? BEQ NEXT ;Yes CMPB ICH,#11 ;Horz tab ? BEQ NEXT ;Yes 2$: BIT #B.OVER,STAT ;Overstrike on ? BNE OVERST ;Yes MOV R2,R3 ;Calc chars to shift SUB R1,R3 ; BEQ 4$ ;None MOV R2,R0 ;Shift right 3$: MOVB -(R0),1(R0) ; SOB R3,3$ ; 4$: MOVB ICH,(R1) ;New character INC R2 ;LMUU pointer JSR PC,UPDT ;Display EOL INC R1 ;CURS pointer DEC R3 ;Places to backspace BEQ NEXT ;None JSR PC,BKSP ;Position cursor BR NEXT ;Next character OVERST: MOVB ICH,(R1) ;New character QIO R1,#1 ;Display it CMP R1,R2 ;Really overstriking ? BLO 1$ ;Yes INC R2 ;Appending, bump LMUU ptr 1$: INC R1 ;CURS pointer BR NEXT ;Next character RETYPE: QIO #CTRLR,#2 ; QIO #PTXT,#3 ;Prompt MOV #CMD,R1 ;CURS pointer JMP G.RARW ; CANCEL: QIO #CTRLU,#2 ; JMP PROMPT ;Prompt DEL1LF: CMP R1,#CMD ;Begin of bufr ? BEQ NEXT ;Yes DEC R1 ;CURS pointer MOV #1,R3 ;Backspace 1 place JSR PC,BKSP ;Position cursor ;Fall through DEL1AC: MOVB #40,(R2) ;Space at end MOV R2,R3 ;Calc chars to shift SUB R1,R3 ; JEQ NEXT ;None MOV R1,R0 ;Shift left 1$: MOVB 1(R0),(R0)+ ; SOB R3,1$ ; JSR PC,UPDT ;Display EOL JSR PC,BKSP ;Reposition cursor DEC R2 ;LMUU pointer JMP NEXT ;Next character DELBOL: MOV R1,R3 ;Calc chars to delete SUB #CMD,R3 ; JEQ NEXT ;None PUSH R3 ;Remember 1$: MOVB #40,(R2)+ ;Append spaces SOB R3,1$ ; QIO #PTXT+1,#2 ;Reprompt JSR PC,UPDT ;Display EOL JSR PC,BKSP ;Reposition cursor MOV #CMD,R0 ;Shift left 2$: MOVB (R1)+,(R0)+ ; SOB R3,2$ ; MOV #CMD,R1 ;CURS pointer ASL (SP) ;LMUU pointer SUB (SP)+,R2 ; JMP NEXT ;Next character DELEOL: MOV R2,R3 ;Calc chars to delete SUB R1,R3 ; BLE 2$ ;None MOV R1,R2 ;Overlay with spaces 1$: MOVB #40,(R2)+ ; SOB R3,1$ ; JSR PC,UPDT ;Display EOL JSR PC,BKSP ;Reposition cursor 2$: MOV R1,R2 ;LMUU pointer JMP NEXT ;Next character ESCAPE: DIR$ #RDDPB ;Read next byte CMPB ICH,#'[ ;"[" ? BEQ 1$ ;Yes CMPB ICH,#'O ;"O" ? BEQ 1$ ;Yes CMPB IOSB+1,#33 ; ? JEQ EXECUT ;Yes JMP NEXT ;Dunno then 1$: DIR$ #RDDPB ;Read next byte MOVB ICH,R0 ; BIC #177740,R0 ;Calc offset into jump table ASL R0 ; JMP @ETABL(R0) ;Jump accordingly .enabl lsb DARW: BIT #B.GOLD,STAT ;GOLD on ? BNE G.DARW ;Yes MOV CCPT,R0 ;Cur cmd pointer MOV F.FOR(R0),R0 ;Advance 1 cmd BR 1$ ;Common code G.DARW: MOV F.REV(R5),R0 ;Last cmd pointer BR 1$ ;Common code UARW: BIT #B.GOLD,STAT ;GOLD on ? BNE G.UARW ;Yes MOV CCPT,R0 ;Cur cmd pointer MOV F.REV(R0),R0 ;Back up 1 cmd BR 1$ ;Common code G.UARW: MOV R4,R0 ;TOP pointer 1$: QIO #PTXT+1,#2 ;Reprompt MOV #CMD,R1 ;Addr CMD bufr TST R0 ;CMD stored here ? BEQ 3$ ;No MOV R0,CCPT ;Cur cmd pointer TST (R0) ;Maybe BEQ 3$ ;No PUSH R2 ;Save last cmd's end pos MOV R1,R2 ;Addr CMD bufr 2$: MOVB (R0)+,(R2)+ ;Load CMD with FIFO cmd BNE 2$ ; DEC R2 ;Drop zero byte JSR PC,UPDT ;Display EOL MOV R2,R1 ;This cmd's end pos POP R2 ;Last cmd's end pos 3$: .iif df LINE24 JSR PC,UNUM ;Update numbers .iif df LINE24 QIO #VT4,#VT4L ;Display BR DELEOL ;Delete to end of line .dsabl lsb RARW: BIT #B.GOLD,STAT ;GOLD on ? BNE G.RARW ;Yes CMP R1,R2 ;At end ? JEQ NEXT ;Yes QIO R1,#1 ;Position cursor INC R1 ;CURS pointer JMP NEXT ; G.RARW: JSR PC,UPDT ;Display EOL MOV R2,R1 ;CURS pointer JMP NEXT ; LARW: BIT #B.GOLD,STAT ;GOLD on ? BNE G.LARW ;Yes CMP R1,#CMD ;At begin ? JEQ NEXT ;Yes DEC R1 ;CURS pointer MOV #1,R3 ;Backspace 1 place JSR PC,BKSP ;Position cursor JMP NEXT ; G.LARW: QIO #PTXT+1,#2 ;Reprompt MOV #CMD,R1 ;CURS pointer JMP NEXT ; .enabl lsb MODE: MOV #B.OVER,R0 ;Overstrike/insert mode XOR R0,STAT ;Toggle .if df LINE24 JSR PC,UMOD ;Update mode BR 1$ ;Common code .iff JMP NEXT ; .iftf KEYS: MOV #B.KEYS,R0 ;CLE/VMS keys XOR R0,STAT ;Toggle .ift JSR PC,UKEY ;Update keys 1$: QIO #VT4,#VT4L ;Display .endc JMP NEXT ; .dsabl lsb PF1: BIS #B.GOLD,STAT ;GOLD on JMP NEXT1 ; PF2: DIR$ #DETDPB ;Detach TI: BIC #B.ATT,STAT ;Not attached MOV #HTXT,R0 ;Addr help cmd line MOV #CMD,R2 ;Addr cmd bufr 1$: MOVB (R0)+,(R2)+ ;Load bufr with cmd BNE 1$ ; QIO #PTXT+1,#1 ; SUB #CMD,R2 ;Calc length MOV R2,SPNDPB+S.PWCL ; DIR$ #SPNDPB ;Spawn to CLI STSE$S #1 ;Stop for CLI JMP PROMPT ; .if df LINE24 PF3: JMP NEXT ;Ignore it .iff PF3: QIO #PTXT,#2 ; JSR PC,UMOD ;Update mode JSR PC,UKEY ;Update keys JSR PC,UNUM ;Update numbers QIO #VT5,#VT5L ;Display status JMP PROMPT ; .endc PF4: MOV R4,R0 ;TOP pointer 1$: TST F.FOR(R0) ;Anything there ? JEQ PROMPT ;No QIO #PTXT,#2 ; MOV R0,R3 ;Find end of cmd 2$: TSTB (R3)+ ; BNE 2$ ; SUB R0,R3 ;Calc length QIO R0,R3 ;Display MOV F.FOR(R0),R0 ;Next forward BR 1$ ;Again EXECUT: DIR$ #DETDPB ;Detach TI: BIC #B.ATT,STAT ;Not attached CMP R2,#CMD ;Anything ? JEQ PROMPT ;No MOV #CMD,R0 ;Addr cmd line MOV (R0)+,R3 ;Is it BYE ? BIC #120240,R3 ; CMP R3,#"BY ; BNE 1$ ;No MOVB (R0)+,R3 ;Maybe BIC #177640,R3 ; CMPB R3,#'E ; BNE 5$ ;No DIR$ #GCIDPB ;Get CLI name CMP CII,#^RMCR ;Is it MCR ? BNE 5$ ;No BR 2$ ; 1$: CMP R3,#"LO ;Is it LO ? BNE 5$ ;No DIR$ #GCIDPB ;Get CLI name CMP CII,#^RDCL ;Is it DCL ? BNE 5$ ;No 2$: BIS #B.BYE,STAT ; 5$: QIO #PTXT+1,#1 ; CLRB (R2) ;Terminate cmd SUB #CMD,R2 ;Calc length MOV R2,SPNDPB+S.PWCL ; DIR$ #SPNDPB ;Spawn to CLI BIT #B.BYE,STAT ;Logging off ? BNE EXIT ;Yes STSE$S #1 ;Stop for CLI CMP R4,R5 ;1st time ? BEQ 12$ ;Yes MOV #CMD,R0 ;Addr this cmd MOV F.REV(R5),R1 ;Addr last cmd MOV R2,R3 ;Length 7$: CMPB (R1)+,(R0)+ ;Same as last ? BNE 8$ ;No SOB R3,7$ ;Maybe BR 16$ ;Yes 8$: MOV R5,R0 ;Start addr ADD R2,R0 ;Plus cmd length ADD #8.,R0 ;Plus 2 nulls, plus 6 BIC #1,R0 ;Maybe only 1 null 9$: CMP R5,R4 ;Is START < TOP ? BLO 10$ ;Yes CMP R0,#FIFOV ;Will it overflow ? BLOS 12$ ;No MOV #FIFO+4,R0 ;Wrap 10$: CMP R0,R4 ;Will there be room ? BLO 12$ ;Yes MOV F.FOR(R4),R4 ;New TOP MOV #DUMY+4,F.REV(R4) ;Link to dummy record MOV R4,DUMY+4+F.FOR ;Link dummy record BR 9$ ;Check again 12$: MOV R5,R3 ;Addr this cmd MOV #CMD,R0 ;Addr cmd to copy 13$: MOVB (R0)+,(R5)+ ;Copy cmd to FIFO BNE 13$ ; BIT #1,R5 ;Even addr ? BEQ 14$ ;Yes CLRB (R5)+ ;Is now 14$: CMP R5,#FIFOV ;Overflow ? BLOS 15$ ;No MOV #FIFO,R5 ;Wrap around FIFO 15$: ADD #4,R5 ;Plus 4 for pointers MOV R5,F.FOR(R3) ;This cmd's fwd ptr MOV R3,F.REV(R5) ;Next cmd's rev ptr CLR F.FOR(R5) ;Next cmd's fwd ptr CLR (R5) ;Zero next cmd 16$: MOV R5,CCPT ;Current cmd ptr .iif df LINE24 JSR PC,UNUM ;Update numbers .iif df LINE24 QIO #VT3,#VT3L ;Display JMP PROMPT ; EXIT: .iif df LINE24 QIO #VT2,#VT2L ;Reset scroll region EXIT$S ;Exit to CLI .PAGE ; UPDT to write & move cursor forward ; Input: R1 cursor position ; R2 left-most unused position ; Output: R1,R2 preserved ; R3 length of I/O ; UPDT: MOV R2,R3 ;Calc length SUB R1,R3 ; BEQ 1$ ;None QIO R1,R3 ;Display EOL 1$: RTS PC ; BKSP to backspace ; will reposition cursor if called following UPDT ; Input: R3 places to backspace ; Output: registers preserved ; BKSP: QIO #BS,R3 ;Reposition cursor RTS PC ; UMOD to update mode field (overstrike/insert) in status buffer ; Input: none ; Output: R0,R3 destroyed ; other registers preserved ; UMOD: PUSH R1 ;Save important registers BIT #B.OVER,STAT ;Overstrike on ? BNE 1$ ;Yes MOV #ITXT,R1 ;Inserting BR 2$ ; 1$: MOV #OTXT,R1 ;Overstriking 2$: MOV #VT3A,R0 ;Addr in line 24 MOV #10.,R3 ;Length 3$: MOVB (R1)+,(R0)+ ;Copy text SOB R3,3$ ; POP R1 ;Restore registers RTS PC ; UKEY to update keys field (CLE/VMS) in status buffer ; Input: none ; Output: R0 destroyed ; other registers preserved ; UKEY: MOV #VT3B,R0 ;Addr in line 24 BIT #B.KEYS,STAT ;VMS keys on ? BNE 1$ ;Yes MOVB #'C,(R0)+ ;Indicate CLE MOVB #'L,(R0)+ ; MOVB #'E,(R0) ; BR 2$ ; 1$: MOVB #'V,(R0)+ ;Indicate VMS MOVB #'M,(R0)+ ; MOVB #'S,(R0) ; 2$: RTS PC ; UNUM to update command numbers in status buffer ; Input: none ; Output: R0,R3 destroyed ; other registers preserved ; UNUM: PUSH ;Save important registers CLRB LCNO ;Init last cmd number BIC #B.FOUN,STAT ;Clear bit MOV #DUMY+4,R0 ;Addr dummy cmd 1$: CMP R0,CCPT ;Current cmd ? BNE 2$ ;No BIS #B.FOUN,STAT ;Indicate found MOVB LCNO,CCNO ;Remember pos 2$: MOV F.FOR(R0),R0 ;Next cmd TST (R0) ;Anything there ? BEQ 3$ ;No, done INCB LCNO ;Bump counter BR 1$ ;Again 3$: MOV #VT3C,R0 ;Addr in output BIT #B.FOUN,STAT ;Find it ? BEQ 4$ ;No MOVB CCNO,R1 ;Current cmd number CLR R2 ; CALL $CBDMG ;Make it ASCII MOVB #'/,(R0)+ ;Delimiter 4$: MOVB LCNO,R1 ;Last cmd number CLR R2 ; CALL $CBDMG ;Make it ASCII MOV #VT3C+6,R3 ;Calc nulls needed SUB R0,R3 ; 5$: CLRB (R0)+ ;Pad output SOB R3,5$ ; POP ;Restore registers RTS PC .PAGE .PDATA ; VMS flavor jump table ; VTABL: .WORD INSERT ;Single character .WORD MODE ;^A toggle mode .WORD UARW ;^B recall .WORD NEXT ;^C .WORD LARW ;^D move left .WORD G.RARW ;^E move to end of line .WORD RARW ;^F move right .WORD NEXT ;^G .WORD G.LARW ;^H move to start of line .WORD HORTAB ;^I horizontal tab .WORD NEXT ;^J erase word (not supported) .WORD KEYS ;^K CLE/VMS keys .WORD NEXT ;^L .WORD EXECUT ;^M .WORD NEXT,NEXT,NEXT,NEXT ;^N,^O,^P,^Q .WORD RETYPE ;^R redisplay .WORD NEXT,NEXT ;^S,^T .WORD DELBOL ;^U erase to start of line .WORD NEXT,NEXT ;^V,^W .WORD DELBOL ;^X erase to start of line .WORD NEXT ;^Y .WORD EXIT ;^Z exit .WORD ESCAPE ;33 .WORD NEXT,NEXT,NEXT,NEXT ;34,35,36,37 ; Original recipe jump table ; CTABL: .WORD INSERT ;Single character .WORD MODE ;^A toggle mode .WORD DELBOL ;^B delete to begin of line .WORD NEXT ;^C .WORD DEL1AC ;^D delete 1 char at cursor .WORD DELEOL ;^E delete to end of line .WORD NEXT,NEXT,NEXT ;^F,^G,^H .WORD HORTAB ;^I horizontal tab .WORD NEXT ;^J .WORD KEYS ;^K CLE/VMS keys .WORD NEXT ;^L .WORD EXECUT ;^M .WORD NEXT,NEXT,NEXT,NEXT ;^N,^O,^P,^Q .WORD RETYPE ;^R redisplay .WORD NEXT,NEXT ;^S,^T .WORD CANCEL ;^U cancel .WORD NEXT,NEXT,NEXT,NEXT ;^V,^W,^X,^Y .WORD EXIT ;^Z exit .WORD ESCAPE ;33 .WORD NEXT,NEXT,NEXT,NEXT ;34,35,36,37 .PAGE ; jump table ; ETABL: .WORD NEXT ; .WORD UARW ;A uparrow .WORD DARW ;B downarrow .WORD RARW ;C rightarrow .WORD LARW ;D leftarrow .WORD NEXT,NEXT,NEXT,NEXT ;E,F,G,H .WORD NEXT,NEXT,NEXT,NEXT ;I,J,K,L .WORD NEXT,NEXT,NEXT ;M,N,O .WORD PF1 ;P PF1 .WORD PF2 ;Q PF2 .WORD PF3 ;R PF3 .WORD PF4 ;S PF4 .WORD NEXT,NEXT,NEXT,NEXT ;T,U,V,W .WORD NEXT,NEXT,NEXT ;X,Y,Z .WORD NEXT,NEXT,NEXT,NEXT,NEXT ;33-37 .PAGE .IDATA ; Each command dispatched to the CLI is placed in FIFO, a first-in/first-out ; ring buffer with an overflow area. These are variable-length records, linked ; forward and reverse. DUMY is a null record always linked into FIFO at the ; oldest command saved so that CCPT which is modified by uparrow and downarrow, ; works properly. ; ; REV FOR CMD ;This illustrates how the forward and ; +---+---+---+ ;reverse pointers work. Note the first ; DUMY | 0 | B | 0 | ;and last records linked are null. ; +---+---+---+ ;Each command is terminated by a null ; A ;byte or word. ; ; REV FOR CMD REV FOR CMD REV FOR CMD ; +---+---+-----------+---+---+---+-----------+---+---+---+---+------ ; FIFO | A | C | 1st cmd | 0 | B | D | 2nd cmd | 0 | C | 0 | 0 | ; +---+---+-----------+---+---+---+-----------+---+---+---+---+------ ; B C D ; DUMY: .BLKW 3 ;Dummy record FIFO: .BLKB FIFOL ;FIFO bufr FIFOV: .BLKB CMDL+2/2*2+4 ;FIFO overflow CCPT: .WORD 0 ;Current cmd pointer SCP: .BYTE TC.SCP,0 ;GMC bufr CII: .BLKW 2 ;GCII bufr IOSB: .BLKW 2 ;I/O status block STAT: .WORD 0 ;Status word CMD: .BLKB CMDL+2 ;Command line ICH: .BYTE 0 ;Input character CCNO: .BYTE 0 ;Current cmd number LCNO: .BYTE 0 ;Last cmd number .if df LINE24 VT3: .ASCII <33>"D" ;Index .ASCII <33>"M" ;Reverse index VT4: .ASCII <33>"7" ;Save cursor .ASCII <33>"[1;23r" ;Set scrolling region .ASCII <33>"[24;1H" ;Position cursor .ASCII <33>"[7m" ;Reverse video .iftf VT5: .ASCII "Mode: " VT3A: .BLKB 10. ;Mode .ASCII " Keys: " VT3B: .BLKB 3 ;Keys .ASCII " Cmds: " VT3C: .BLKB 6 ;Cmd numbers VT5L =.-VT5 .ift .ASCII <33>"[K" ;Erase to end of line .ASCII <33>"[0m" ;Clear character attributes .ASCII <33>"8" ;Restore cursor VT4L =.-VT4 VT3L =.-VT3 .endc .EVEN .PDATA BS: .REPT CMDL ;Backspace bufr .BYTE 10 .ENDR PTXT: .ASCII <12><15>")" ;Prompt DING: .BYTE 7 ;Bell CTRLR: .ASCII "^R" ; CTRLU: .ASCII "^U" ; HTXT: .ASCIZ "HELP/CLE" ;Help text .if df LINE24 VT2: .ASCII <33>"7" ;Save cursor .ASCII <33>"[1;24r" ;Set scrolling region .ASCII <33>"8" ;Restore cursor .ASCII <33>"[J" ;Erase to end of screen VT2L =.-VT2 .endc OTXT: .ASCII "Overstrike" ITXT: .ASCII "Insert " .EVEN .END START