2017-09-27 15:40:31 +00:00
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2018-01-18 06:49:41 +00:00
|
|
|
|
AUTO 4,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-01-26 21:46:39 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
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
|
|
|
|
|
*--------------------------------------
|
2018-09-13 15:29:02 +00:00
|
|
|
|
CL.PrintPrompt >LDYA L.ENV.PS1
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL GetEnv
|
2018-09-13 15:29:02 +00:00
|
|
|
|
bcs .1
|
|
|
|
|
|
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
|
2018-08-22 15:23:27 +00:00
|
|
|
|
|
2018-09-13 15:29:02 +00:00
|
|
|
|
.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
|
|
|
|
*--------------------------------------
|
2017-11-09 16:39:01 +00:00
|
|
|
|
CL.CHARIN tax
|
|
|
|
|
|
|
|
|
|
>LDA.G bEscMode
|
|
|
|
|
beq .13
|
|
|
|
|
|
|
|
|
|
cpx #'['
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
.17 cmp EscChars,x
|
|
|
|
|
beq .18
|
|
|
|
|
dex
|
|
|
|
|
bpl .17
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.18 txa
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jmp (J.ESC,x)
|
|
|
|
|
*--------------------------------------
|
2019-01-23 16:26:48 +00:00
|
|
|
|
.13 cpx #C.SPACE
|
2017-11-09 16:39:01 +00:00
|
|
|
|
bcc CL.CHARIN.CTRL
|
|
|
|
|
|
2019-01-23 16:26:48 +00:00
|
|
|
|
.1 cpx #C.DEL
|
2017-11-09 16:39:01 +00:00
|
|
|
|
bne .2
|
2018-12-04 16:45:58 +00:00
|
|
|
|
jmp CL.DEL
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
.2 jmp CL.Insert
|
|
|
|
|
|
|
|
|
|
.9 clc
|
|
|
|
|
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
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2018-09-09 08:11:42 +00:00
|
|
|
|
.10 cpx #C.ESC
|
2017-11-09 16:39:01 +00:00
|
|
|
|
bne .11
|
|
|
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G bEscMode
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.11 cpx #3 Ctrl-C
|
|
|
|
|
bne .12
|
|
|
|
|
|
|
|
|
|
jmp CL.CLR
|
|
|
|
|
|
|
|
|
|
.12 cpx #24 Ctrl-X
|
|
|
|
|
bne .13
|
|
|
|
|
|
2018-12-04 16:45:58 +00:00
|
|
|
|
jmp CL.SUPPR
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2019-02-18 06:42:17 +00:00
|
|
|
|
.18 lda #$ff
|
|
|
|
|
>STA.G CL.bReady
|
|
|
|
|
|
2017-11-09 16:39:01 +00:00
|
|
|
|
.13 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.Insert >LDA.G CL.Len
|
2017-11-08 16:09:52 +00:00
|
|
|
|
inc
|
2019-02-06 16:20:51 +00:00
|
|
|
|
beq .9 Buffer full, discard...
|
2017-11-08 16:09:52 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
.1 ply
|
|
|
|
|
dey
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBuf),y Move from Ptr To end of buffer forward...
|
2017-11-08 16:09:52 +00:00
|
|
|
|
iny
|
2018-11-14 14:34:13 +00:00
|
|
|
|
sta (ZPCLBuf),y
|
2017-11-08 16:09:52 +00:00
|
|
|
|
dey
|
|
|
|
|
phy
|
|
|
|
|
tya
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>CMP.G CL.Ptr
|
2017-11-08 16:09:52 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
ply Y=CL.Ptr
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
* >LDA.G CL.Ptr
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
|
|
|
|
txa
|
2018-11-14 14:34:13 +00:00
|
|
|
|
sta (ZPCLBuf),y
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
2018-11-13 15:54:10 +00:00
|
|
|
|
>LDA.G bREAD.S
|
2018-09-17 06:16:45 +00:00
|
|
|
|
bpl .2
|
|
|
|
|
|
2019-02-18 06:42:17 +00:00
|
|
|
|
>INC.G CL.Ptr
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2018-09-17 06:16:45 +00:00
|
|
|
|
.2 txa
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>INC.G CL.Ptr
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
|
|
|
|
jmp CL.PrintEOL
|
|
|
|
|
|
|
|
|
|
.9 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-14 14:34:13 +00:00
|
|
|
|
CL.CLR lda (ZPCLBuf)
|
|
|
|
|
beq CL.RESET.1
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2018-12-06 11:40:30 +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
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2018-12-06 11:40:30 +00:00
|
|
|
|
.2 ldy #0
|
|
|
|
|
|
|
|
|
|
.3 lda #C.DEL
|
2018-11-14 14:34:13 +00:00
|
|
|
|
sta (ZPCLBuf),y
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
|
|
|
|
iny
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBuf),y
|
2018-12-06 11:40:30 +00:00
|
|
|
|
bne .3
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2019-01-26 21:46:39 +00:00
|
|
|
|
jsr CL.PrintCLBuf
|
2017-09-27 15:40:31 +00:00
|
|
|
|
*--------------------------------------
|
2017-11-08 16:09:52 +00:00
|
|
|
|
CL.RESET lda #0
|
2018-11-14 14:34:13 +00:00
|
|
|
|
sta (ZPCLBuf)
|
2019-02-06 16:20:51 +00:00
|
|
|
|
CL.RESET.1 >STA.G CL.bReady
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>STA.G CL.Ptr
|
|
|
|
|
>STA.G CL.Len
|
2017-11-08 16:09:52 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.BS >LDA.G CL.Ptr
|
2017-09-27 15:40:31 +00:00
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
dec
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
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
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
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
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
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
|
|
|
|
bra CL.DEL.1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Erase char BEFORE cursor
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.DEL >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
|
2017-11-08 16:09:52 +00:00
|
|
|
|
beq CL.PrintEOL.8
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
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
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>DEC.G CL.Ptr
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
CL.DEL.1 pha
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
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
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
pla
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>DEC.G CL.Len
|
2017-11-08 16:09:52 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.PrintEOL >LDA.G CL.Ptr
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.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
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>LDA.G CL.Ptr
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.3 >CMP.G CL.Len
|
2017-11-08 16:09:52 +00:00
|
|
|
|
beq .4
|
|
|
|
|
|
|
|
|
|
pha
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
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
|