2017-09-27 15:40:31 +00:00
|
|
|
|
NEW
|
2019-06-02 08:58:46 +00:00
|
|
|
|
AUTO 3,1
|
2017-09-27 15:40:31 +00:00
|
|
|
|
*--------------------------------------
|
2019-01-26 21:46:39 +00:00
|
|
|
|
CL.Init >LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-01-26 21:46:39 +00:00
|
|
|
|
>STYA ZPCLBuf
|
|
|
|
|
txa
|
2021-05-14 20:58:20 +00:00
|
|
|
|
>STA.G CL.hBuf
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2019-01-26 21:46:39 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-14 07:21:56 +00:00
|
|
|
|
CL.PrintPrompt >PUSHW L.PS1
|
2023-05-16 16:53:52 +00:00
|
|
|
|
>PUSHW ZPCLBuf
|
2020-01-17 11:23:11 +00:00
|
|
|
|
>SYSCALL Expand
|
2018-09-13 15:29:02 +00:00
|
|
|
|
bcs .9
|
2020-02-14 07:21:56 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
>LDYA ZPCLBuf
|
|
|
|
|
jsr IO.EscOutYA
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPCLBuf)
|
2020-02-14 07:21:56 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.1 >LDYA L.MSG.PROMPT
|
2023-05-16 16:53:52 +00:00
|
|
|
|
jsr IO.OutYA
|
2018-09-13 15:29:02 +00:00
|
|
|
|
.9 rts
|
2017-10-26 06:41:57 +00:00
|
|
|
|
*--------------------------------------
|
2020-02-14 07:21:56 +00:00
|
|
|
|
CL.READN0A tax
|
2022-10-09 21:22:46 +00:00
|
|
|
|
CL.READN0X
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW ZPCLBuf
|
2019-10-31 13:18:38 +00:00
|
|
|
|
>PUSHW L.FMT.Byte
|
2020-02-14 07:21:56 +00:00
|
|
|
|
txa
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
2020-03-09 16:24:08 +00:00
|
|
|
|
>SYSCALL SPrintF
|
2019-10-31 13:18:38 +00:00
|
|
|
|
bcs .9
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G CL.bReady
|
|
|
|
|
* clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-11-09 16:39:01 +00:00
|
|
|
|
CL.CHARIN tax
|
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
>LDA.G CL.bEscMode \e ?
|
2019-11-04 07:21:40 +00:00
|
|
|
|
beq .4
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
cpx #'['
|
2019-10-31 13:18:38 +00:00
|
|
|
|
beq .8 \e[
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y Y=bEscMode
|
|
|
|
|
txa
|
|
|
|
|
|
2023-04-22 18:58:37 +00:00
|
|
|
|
ldx #IN.EscCharsCnt-1
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2023-04-22 18:58:37 +00:00
|
|
|
|
.1 cmp IN.EscChars,x
|
2019-11-04 07:21:40 +00:00
|
|
|
|
beq .2
|
2019-10-31 13:18:38 +00:00
|
|
|
|
|
2017-11-09 16:39:01 +00:00
|
|
|
|
dex
|
2019-11-04 07:21:40 +00:00
|
|
|
|
bpl .1
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2023-04-22 18:58:37 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts invalid \e[ sequence
|
2019-10-31 13:18:38 +00:00
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
.2 >LDA.G CL.MaxCnt
|
2019-11-04 07:21:40 +00:00
|
|
|
|
bne .3
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2023-04-22 18:58:37 +00:00
|
|
|
|
lda IN.EscCodes,x
|
2019-10-31 13:18:38 +00:00
|
|
|
|
bra CL.READN0A
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2019-11-04 07:21:40 +00:00
|
|
|
|
.3 txa
|
2017-11-09 16:39:01 +00:00
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jmp (J.ESC,x)
|
|
|
|
|
*--------------------------------------
|
2019-11-04 07:21:40 +00:00
|
|
|
|
.4 cpx #C.ESC
|
|
|
|
|
bne .5
|
2019-10-31 13:18:38 +00:00
|
|
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G CL.bEscMode
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
.5 >LDA.G CL.MaxCnt
|
2019-10-31 13:18:38 +00:00
|
|
|
|
beq CL.READN0X
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
cpx #C.SPACE
|
2017-11-09 16:39:01 +00:00
|
|
|
|
bcc CL.CHARIN.CTRL
|
|
|
|
|
|
2019-11-04 07:21:40 +00:00
|
|
|
|
cpx #C.DEL
|
2019-10-31 13:18:38 +00:00
|
|
|
|
bne CL.Insert
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Erase char BEFORE cursor
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
>LDA.G CL.Len
|
|
|
|
|
beq .8
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
>LDA.G CL.Ptr
|
|
|
|
|
beq .8
|
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
>LDA.G CL.bSilent
|
2019-11-04 07:21:40 +00:00
|
|
|
|
bmi .6
|
|
|
|
|
|
2023-04-22 18:58:37 +00:00
|
|
|
|
jsr CL.BS.OUT
|
|
|
|
|
|
|
|
|
|
lda #C.SPACE
|
2019-10-31 13:18:38 +00:00
|
|
|
|
>SYSCALL PutChar
|
2023-04-22 18:58:37 +00:00
|
|
|
|
|
|
|
|
|
jsr CL.BS.OUT
|
2019-10-31 13:18:38 +00:00
|
|
|
|
|
2019-11-04 07:21:40 +00:00
|
|
|
|
.6 >DEC.G CL.Ptr
|
2023-04-22 18:58:37 +00:00
|
|
|
|
|
2018-12-04 16:45:58 +00:00
|
|
|
|
jmp CL.DEL
|
2019-10-31 13:18:38 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.Insert >LDA.G CL.Len
|
2021-05-11 18:44:13 +00:00
|
|
|
|
>CMP.G CL.MaxCnt
|
2019-10-31 13:18:38 +00:00
|
|
|
|
beq .8 Buffer full, discard...
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
>STA.G CL.Len
|
|
|
|
|
|
|
|
|
|
pha
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
.1 ply
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPCLBuf),y Move from Ptr To end of buffer forward...
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPCLBuf),y
|
|
|
|
|
dey
|
|
|
|
|
phy
|
|
|
|
|
tya
|
|
|
|
|
>CMP.G CL.Ptr
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
ply Y=CL.Ptr
|
2019-11-04 07:21:40 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
* >LDA.G CL.Ptr
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
txa
|
|
|
|
|
sta (ZPCLBuf),y
|
|
|
|
|
>INC.G CL.Ptr
|
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
>LDA.G CL.bSilent
|
2019-10-31 13:18:38 +00:00
|
|
|
|
bmi .7
|
2019-11-04 07:21:40 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
txa
|
2021-05-14 20:58:20 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
>SYSCALL PutChar
|
2021-05-14 20:58:20 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
jsr CL.PrintEOL
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
.7 >LDA.G CL.MaxCnt READ N = 1, don't wait for CR
|
2019-10-31 13:18:38 +00:00
|
|
|
|
dec
|
|
|
|
|
bne .8
|
2019-11-04 07:21:40 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G CL.bReady
|
2019-11-04 07:21:40 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
.8 clc
|
2021-05-14 20:58:20 +00:00
|
|
|
|
.9 rts
|
2017-11-09 16:39:01 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-09 08:11:42 +00:00
|
|
|
|
CL.CHARIN.CTRL cpx #C.CR
|
2019-02-18 06:42:17 +00:00
|
|
|
|
beq .18
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2019-02-18 06:42:17 +00:00
|
|
|
|
cpx #C.EOF
|
2021-05-11 18:44:13 +00:00
|
|
|
|
beq .19
|
2019-10-18 11:41:27 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
cpx #C.TAB
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
jmp HIS.Select
|
|
|
|
|
|
|
|
|
|
.1 cpx #26 Ctrl-Z
|
2023-04-22 18:58:37 +00:00
|
|
|
|
beq CL.SUPPR
|
|
|
|
|
|
|
|
|
|
cpx #3 Ctrl-C
|
2019-10-31 13:18:38 +00:00
|
|
|
|
bne .8
|
2023-04-22 18:58:37 +00:00
|
|
|
|
|
|
|
|
|
jmp CL.CLR
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2019-10-18 15:07:14 +00:00
|
|
|
|
.18 jsr CheckLFAfterCR Check for any extra LF
|
2019-10-18 11:41:27 +00:00
|
|
|
|
bcs .9
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
.19 lda #$ff
|
2019-02-18 06:42:17 +00:00
|
|
|
|
>STA.G CL.bReady
|
2019-10-18 11:41:27 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
.8 clc
|
2019-10-18 11:41:27 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2023-04-22 18:58:37 +00:00
|
|
|
|
* Erase char UNDER cursor
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.SUPPR >LDA.G CL.Len
|
|
|
|
|
beq CL.PrintEOL.8
|
|
|
|
|
|
|
|
|
|
>LDA.G CL.Ptr
|
|
|
|
|
>CMP.G CL.Len
|
|
|
|
|
beq CL.PrintEOL.8
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.DEL pha CL.Ptr
|
|
|
|
|
|
|
|
|
|
.1 ply
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPCLBuf),y
|
|
|
|
|
dey
|
|
|
|
|
sta (ZPCLBuf),y
|
|
|
|
|
iny
|
|
|
|
|
phy
|
|
|
|
|
tya
|
|
|
|
|
|
|
|
|
|
>CMP.G CL.Len
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
>DEC.G CL.Len
|
|
|
|
|
|
|
|
|
|
>LDA.G CL.bSilent
|
|
|
|
|
bmi CL.PrintEOL.8
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.PrintEOL >LDA.G CL.Ptr
|
|
|
|
|
|
|
|
|
|
>CMP.G CL.Len
|
|
|
|
|
beq CL.PrintEOL.8
|
|
|
|
|
|
|
|
|
|
.1 pha
|
|
|
|
|
tay
|
|
|
|
|
lda (ZPCLBuf),y
|
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
pla
|
|
|
|
|
inc
|
|
|
|
|
>CMP.G CL.Len
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #C.SPACE
|
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
>LDA.G CL.Ptr
|
|
|
|
|
|
|
|
|
|
.3 >CMP.G CL.Len
|
|
|
|
|
beq .4
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
jsr CL.BS.OUT
|
|
|
|
|
pla
|
|
|
|
|
inc
|
|
|
|
|
bra .3
|
|
|
|
|
|
|
|
|
|
.4 jmp CL.BS.OUT
|
|
|
|
|
|
|
|
|
|
CL.PrintEOL.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.BS >LDA.G CL.Ptr
|
|
|
|
|
beq CL.BS.8
|
|
|
|
|
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
>LDA.G CL.bSilent
|
|
|
|
|
bpl CL.BS.OUT
|
|
|
|
|
|
|
|
|
|
CL.BS.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
CL.BS.OUT lda #C.BS
|
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.FS >LDA.G CL.Ptr
|
|
|
|
|
>CMP.G CL.Len
|
|
|
|
|
beq CL.BS.8
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
>STA.G CL.Ptr
|
|
|
|
|
|
|
|
|
|
>LDA.G CL.bSilent
|
|
|
|
|
bmi CL.BS.8
|
|
|
|
|
|
|
|
|
|
CL.FS.OUT >LDYA L.MSG.FS
|
2023-05-16 16:53:52 +00:00
|
|
|
|
jmp IO.OutYA
|
2023-04-22 18:58:37 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CL.CLR >STZ.G HIS.Ptr
|
|
|
|
|
|
|
|
|
|
CL.CLR.1 lda (ZPCLBuf)
|
2020-03-09 16:24:08 +00:00
|
|
|
|
beq CL.Reset.1
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
>LDA.G CL.bSilent
|
2021-05-14 20:58:20 +00:00
|
|
|
|
bmi CL.Reset
|
2019-10-18 11:41:27 +00:00
|
|
|
|
|
|
|
|
|
.1 >LDA.G CL.Ptr
|
|
|
|
|
>CMP.G CL.Len
|
|
|
|
|
beq .2
|
2021-05-14 20:58:20 +00:00
|
|
|
|
|
2019-10-18 11:41:27 +00:00
|
|
|
|
inc
|
|
|
|
|
>STA.G CL.Ptr
|
2023-04-22 18:58:37 +00:00
|
|
|
|
|
|
|
|
|
jsr CL.FS.OUT
|
2019-10-18 11:41:27 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 ldy #0
|
|
|
|
|
|
|
|
|
|
.3 lda #C.DEL
|
|
|
|
|
sta (ZPCLBuf),y
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPCLBuf),y
|
|
|
|
|
bne .3
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
>LDYA ZPCLBuf
|
2023-05-16 16:53:52 +00:00
|
|
|
|
jsr IO.OutYA
|
2019-10-18 11:41:27 +00:00
|
|
|
|
*--------------------------------------
|
2020-03-09 16:24:08 +00:00
|
|
|
|
CL.Reset lda #0
|
2019-10-18 11:41:27 +00:00
|
|
|
|
sta (ZPCLBuf)
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2020-08-20 13:20:33 +00:00
|
|
|
|
CL.Reset.1 lda #0
|
2021-05-14 20:58:20 +00:00
|
|
|
|
|
2020-08-20 13:20:33 +00:00
|
|
|
|
ldy #CL.Ptr
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2020-08-20 13:20:33 +00:00
|
|
|
|
.1 sta (pData),y
|
|
|
|
|
iny
|
|
|
|
|
cpy #CL.bEscMode+1
|
|
|
|
|
bne .1
|
2019-10-31 13:18:38 +00:00
|
|
|
|
|
2017-11-09 16:39:01 +00:00
|
|
|
|
rts
|
2017-11-08 16:09:52 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-11 18:44:13 +00:00
|
|
|
|
CL.ReadResetV sec Verbose mode
|
|
|
|
|
|
|
|
|
|
CL.ReadReset lda #$ff
|
|
|
|
|
>STA.G CL.MaxCnt
|
2021-05-14 20:58:20 +00:00
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
adc #0 CC = silent
|
2021-05-14 20:58:20 +00:00
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
iny CL.bSilent
|
|
|
|
|
sta (pData),y
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
2021-05-11 18:44:13 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-09-27 15:40:31 +00:00
|
|
|
|
MAN
|
2020-05-26 14:23:09 +00:00
|
|
|
|
SAVE usr/src/bin/sh.s.cl
|
|
|
|
|
LOAD usr/src/bin/sh.s
|
2017-09-27 15:40:31 +00:00
|
|
|
|
ASM
|