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
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2019-01-26 21:46:39 +00:00
|
|
|
|
CL.Init >LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
>STYA ZPCLBuf
|
|
|
|
|
txa
|
2019-01-30 16:23:00 +00:00
|
|
|
|
>STA.G CL.hCLBuf
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2019-01-26 21:46:39 +00:00
|
|
|
|
*--------------------------------------
|
2019-01-30 16:23:00 +00:00
|
|
|
|
CL.Quit >LDA.G CL.hCLBuf
|
2019-01-26 21:46:39 +00:00
|
|
|
|
beq .9
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2019-04-16 15:54:56 +00:00
|
|
|
|
CL.PrintPrompt >LDYA L.PS1
|
|
|
|
|
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL ExpandStr
|
2018-09-13 15:29:02 +00:00
|
|
|
|
bcs .9
|
2017-10-26 06:41:57 +00:00
|
|
|
|
phx
|
2018-09-13 15:29:02 +00:00
|
|
|
|
pha
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
pla
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2018-09-13 15:29:02 +00:00
|
|
|
|
pla
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
.1 >PUSHBI 0
|
2017-10-26 06:41:57 +00:00
|
|
|
|
>LDYA L.MSG.PROMPT
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2018-09-13 15:29:02 +00:00
|
|
|
|
.9 rts
|
2017-10-26 06:41:57 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-31 13:18:38 +00:00
|
|
|
|
CL.READN0X txa
|
|
|
|
|
CL.READN0A >PUSHA
|
|
|
|
|
>PUSHBI 1
|
|
|
|
|
>PUSHW L.FMT.Byte
|
|
|
|
|
>LDYA ZPCLBuf
|
|
|
|
|
>SYSCALL sprintf
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2018-09-14 13:08:30 +00:00
|
|
|
|
ldx #EscChars.Cnt-1
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2019-11-04 07:21:40 +00:00
|
|
|
|
.1 cmp EscChars,x
|
|
|
|
|
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
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
.8 rts invalid \e[ sequence
|
|
|
|
|
|
2019-11-04 07:21:40 +00:00
|
|
|
|
.2 >LDA.G READ.N
|
|
|
|
|
bne .3
|
2019-10-31 13:18:38 +00:00
|
|
|
|
|
|
|
|
|
lda EscChars.Remap,x
|
|
|
|
|
bra CL.READN0A
|
|
|
|
|
|
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
|
|
|
|
|
|
2019-11-04 07:21:40 +00:00
|
|
|
|
.5 >LDA.G READ.N
|
2019-10-31 13:18:38 +00:00
|
|
|
|
beq CL.READN0X
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
>LDA.G CL.Ptr
|
|
|
|
|
beq .8
|
|
|
|
|
|
2019-11-04 07:21:40 +00:00
|
|
|
|
>LDA.G bREAD.S
|
|
|
|
|
bmi .6
|
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
lda #C.BS
|
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
|
2019-11-04 07:21:40 +00:00
|
|
|
|
.6 >DEC.G CL.Ptr
|
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
|
|
|
|
|
>CMP.G READ.N
|
|
|
|
|
beq .8 Buffer full, discard...
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
>STA.G CL.Len
|
|
|
|
|
|
|
|
|
|
pha
|
2019-11-04 07:21:40 +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
|
|
|
|
|
|
|
|
|
|
>LDA.G bREAD.S
|
|
|
|
|
bmi .7
|
2019-11-04 07:21:40 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
txa
|
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
jsr CL.PrintEOL
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
.7 >LDA.G READ.N READ N = 1, don't wait for CR
|
|
|
|
|
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
|
2017-11-09 16:39:01 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
|
beq .18
|
2019-10-18 11:41:27 +00:00
|
|
|
|
|
2019-10-31 13:18:38 +00:00
|
|
|
|
cpx #3 Ctrl-C
|
2019-10-18 11:41:27 +00:00
|
|
|
|
beq CL.CLR
|
2019-10-03 06:25:27 +00:00
|
|
|
|
|
2019-10-18 11:41:27 +00:00
|
|
|
|
cpx #26 Ctrl-Z
|
2019-10-31 13:18:38 +00:00
|
|
|
|
bne .8
|
2018-12-04 16:45:58 +00:00
|
|
|
|
jmp CL.SUPPR
|
2019-10-18 11:41:27 +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
|
|
|
|
|
|
2019-10-18 15:07:14 +00:00
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.CLR lda (ZPCLBuf)
|
|
|
|
|
beq CL.RESET.1
|
2019-11-01 20:06:04 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G bREAD.S
|
|
|
|
|
bmi CL.RESET.1
|
2019-10-18 11:41:27 +00:00
|
|
|
|
|
|
|
|
|
.1 >LDA.G CL.Ptr
|
|
|
|
|
>CMP.G CL.Len
|
|
|
|
|
beq .2
|
|
|
|
|
inc
|
|
|
|
|
>STA.G CL.Ptr
|
|
|
|
|
lda #C.FS
|
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
.2 ldy #0
|
|
|
|
|
|
|
|
|
|
.3 lda #C.DEL
|
|
|
|
|
sta (ZPCLBuf),y
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPCLBuf),y
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
jsr CL.PrintCLBuf
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.RESET lda #0
|
|
|
|
|
sta (ZPCLBuf)
|
2019-10-31 13:18:38 +00:00
|
|
|
|
|
|
|
|
|
CL.RESET.1 >STA.G CL.Ptr
|
2019-10-18 11:41:27 +00:00
|
|
|
|
>STA.G CL.Len
|
2019-10-31 13:18:38 +00:00
|
|
|
|
>STA.G CL.bReady
|
|
|
|
|
>STA.G CL.bEscMode
|
2017-11-09 16:39:01 +00:00
|
|
|
|
rts
|
2017-11-08 16:09:52 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.BS >LDA.G CL.Ptr
|
2017-09-27 15:40:31 +00:00
|
|
|
|
beq .9
|
2019-11-04 07:21:40 +00:00
|
|
|
|
|
2017-09-27 15:40:31 +00:00
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
2019-11-04 07:21:40 +00:00
|
|
|
|
|
2019-11-01 20:06:04 +00:00
|
|
|
|
>LDA.G bREAD.S
|
|
|
|
|
bmi .9
|
2019-11-04 07:21:40 +00:00
|
|
|
|
|
2018-09-09 08:11:42 +00:00
|
|
|
|
lda #C.BS
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-09-27 15:40:31 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.NAK >LDA.G CL.Ptr
|
|
|
|
|
>CMP.G CL.Len
|
2017-09-27 15:40:31 +00:00
|
|
|
|
beq .9
|
|
|
|
|
inc
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>STA.G CL.Ptr
|
2019-11-01 20:06:04 +00:00
|
|
|
|
>LDA.G bREAD.S
|
|
|
|
|
bmi .9
|
2018-09-09 08:11:42 +00:00
|
|
|
|
lda #C.FS
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-09-27 15:40:31 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-11-08 16:09:52 +00:00
|
|
|
|
* Erase char UNDER cursor
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.SUPPR >LDA.G CL.Len
|
2017-11-08 16:09:52 +00:00
|
|
|
|
beq CL.PrintEOL.8
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>LDA.G CL.Ptr
|
2018-11-24 18:20:48 +00:00
|
|
|
|
>CMP.G CL.Len
|
|
|
|
|
beq CL.PrintEOL.8
|
2017-11-08 16:09:52 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-31 13:18:38 +00:00
|
|
|
|
CL.DEL pha
|
2017-11-08 16:09:52 +00:00
|
|
|
|
.1 ply
|
|
|
|
|
iny
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBuf),y
|
2017-09-27 15:40:31 +00:00
|
|
|
|
dey
|
2018-11-14 14:34:13 +00:00
|
|
|
|
sta (ZPCLBuf),y
|
2017-09-27 15:40:31 +00:00
|
|
|
|
iny
|
2017-11-08 16:09:52 +00:00
|
|
|
|
phy
|
|
|
|
|
tya
|
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>CMP.G CL.Len
|
2017-11-08 16:09:52 +00:00
|
|
|
|
bne .1
|
|
|
|
|
pla
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>DEC.G CL.Len
|
2019-11-04 07:21:40 +00:00
|
|
|
|
>LDA.G bREAD.S
|
|
|
|
|
bpl CL.PrintEOL
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-11-08 16:09:52 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.PrintEOL >LDA.G CL.Ptr
|
|
|
|
|
.1 >CMP.G CL.Len
|
2017-09-27 15:40:31 +00:00
|
|
|
|
beq .2
|
2017-11-08 16:09:52 +00:00
|
|
|
|
pha
|
|
|
|
|
tay
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBuf),y
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-11-08 16:09:52 +00:00
|
|
|
|
pla
|
|
|
|
|
inc
|
2017-09-27 15:40:31 +00:00
|
|
|
|
bra .1
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
2017-09-27 15:40:31 +00:00
|
|
|
|
.2 lda #' '
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>LDA.G CL.Ptr
|
|
|
|
|
.3 >CMP.G CL.Len
|
2017-11-08 16:09:52 +00:00
|
|
|
|
beq .4
|
|
|
|
|
pha
|
2018-09-09 08:11:42 +00:00
|
|
|
|
lda #C.BS
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-11-08 16:09:52 +00:00
|
|
|
|
pla
|
|
|
|
|
inc
|
2017-09-27 15:40:31 +00:00
|
|
|
|
bra .3
|
2018-09-09 08:11:42 +00:00
|
|
|
|
.4 lda #C.BS
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
CL.PrintEOL.8 clc
|
2017-09-27 15:40:31 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-01-26 21:46:39 +00:00
|
|
|
|
CL.PrintCLBuf >LDYA ZPCLBuf
|
2018-11-13 15:54:10 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
>SYSCALL fputs
|
2017-09-27 15:40:31 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2019-02-08 16:13:43 +00:00
|
|
|
|
SAVE USR/SRC/BIN/SH.S.CL
|
|
|
|
|
LOAD USR/SRC/BIN/SH.S
|
2017-09-27 15:40:31 +00:00
|
|
|
|
ASM
|