2017-09-27 15:40:31 +00:00
|
|
|
|
NEW
|
2018-01-18 06:49:41 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
|
|
|
|
AUTO 4,1
|
2017-09-27 15:40:31 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
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)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.13 cpx #$20
|
|
|
|
|
bcc CL.CHARIN.CTRL
|
|
|
|
|
|
|
|
|
|
.1 cpx #$7f
|
|
|
|
|
bne .2
|
|
|
|
|
jmp CL.DEL
|
|
|
|
|
|
|
|
|
|
.2 jmp CL.Insert
|
|
|
|
|
|
|
|
|
|
.9 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-09-09 08:11:42 +00:00
|
|
|
|
CL.CHARIN.CTRL cpx #C.CR
|
2017-11-09 16:39:01 +00:00
|
|
|
|
bne .10
|
|
|
|
|
|
2018-09-09 08:11:42 +00:00
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>LDYA L.MSG.ECHOCRLF
|
|
|
|
|
>SYSCALL printf
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G CmdBufPtr
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
tya
|
|
|
|
|
>STA.G CmdBuflen
|
|
|
|
|
|
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G bCmdBufexec
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
jmp CL.SUPPR
|
|
|
|
|
|
|
|
|
|
.13 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-11-08 16:09:52 +00:00
|
|
|
|
CL.Insert >LDA.G CmdBuflen
|
|
|
|
|
cmp #CmdLine.MAX
|
|
|
|
|
beq .9 Buffer full, discard...
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
.1 ply
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPCMDBuf),y Move from Ptr To end of buffer forward...
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
dey
|
|
|
|
|
phy
|
|
|
|
|
tya
|
|
|
|
|
>CMP.G CmdBufPtr
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
ply Y=CmdBufPtr
|
|
|
|
|
|
|
|
|
|
* >LDA.G CmdBufPtr
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
|
2018-09-17 06:16:45 +00:00
|
|
|
|
>LDA.G bSecureRead
|
|
|
|
|
bpl .2
|
|
|
|
|
ldx #'*'
|
|
|
|
|
|
|
|
|
|
.2 txa
|
2018-07-13 14:38:24 +00:00
|
|
|
|
>SYSCALL PutChar
|
2017-11-08 16:09:52 +00:00
|
|
|
|
|
|
|
|
|
>INC.G CmdBufPtr
|
|
|
|
|
|
|
|
|
|
jmp CL.PrintEOL
|
|
|
|
|
|
|
|
|
|
.9 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.CLR ldy #0
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
|
|
|
|
.1 lda (ZPCMDBuf),y
|
2017-11-08 16:09:52 +00:00
|
|
|
|
beq CL.RESET
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
|
|
|
|
.2 lda #$7F
|
|
|
|
|
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPCMDBuf),y
|
|
|
|
|
bne .2
|
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
jsr CL.PRINT
|
2017-09-27 15:40:31 +00:00
|
|
|
|
*--------------------------------------
|
2017-11-08 16:09:52 +00:00
|
|
|
|
CL.RESET lda #0
|
|
|
|
|
sta (ZPCMDBuf)
|
|
|
|
|
>STA.G bCmdBufexec
|
|
|
|
|
>STA.G CmdBufPtr
|
|
|
|
|
>STA.G CmdBuflen
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.BS >LDA.G CmdBufPtr
|
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
|
|
|
|
|
*--------------------------------------
|
2017-11-08 16:09:52 +00:00
|
|
|
|
CL.NAK >LDA.G CmdBufPtr
|
2017-09-27 15:40:31 +00:00
|
|
|
|
>CMP.G CmdBuflen
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
>STA.G CmdBufPtr
|
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.SUPPR >LDA.G CmdBuflen
|
|
|
|
|
beq CL.PrintEOL.8
|
2017-09-27 15:40:31 +00:00
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
>LDA.G CmdBufPtr
|
|
|
|
|
bra CL.DEL.1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Erase char BEFORE cursor
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.DEL >LDA.G CmdBuflen
|
|
|
|
|
beq CL.PrintEOL.8
|
|
|
|
|
|
|
|
|
|
>LDA.G CmdBufPtr
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
>DEC.G CmdBufPtr
|
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
|
2017-09-27 15:40:31 +00:00
|
|
|
|
lda (ZPCMDBuf),y
|
|
|
|
|
dey
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
iny
|
2017-11-08 16:09:52 +00:00
|
|
|
|
phy
|
|
|
|
|
tya
|
|
|
|
|
|
|
|
|
|
>CMP.G CmdBufLen
|
|
|
|
|
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
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
>DEC.G CmdBuflen
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.PrintEOL >LDA.G CmdBufPtr
|
|
|
|
|
|
|
|
|
|
.1 >CMP.G CmdBuflen
|
2017-09-27 15:40:31 +00:00
|
|
|
|
beq .2
|
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
pha
|
|
|
|
|
tay
|
|
|
|
|
lda (ZPCMDBuf),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
|
|
|
|
|
|
|
|
|
>LDA.G CmdBufPtr
|
|
|
|
|
|
2017-11-08 16:09:52 +00:00
|
|
|
|
.3 >CMP.G CmdBuflen
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-11-08 16:09:52 +00:00
|
|
|
|
CL.PRINT >LDYA ZPCMDBuf
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2017-09-27 15:40:31 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE /A2OSX.SRC/SBIN/SHELL.S.CL
|
|
|
|
|
LOAD /A2OSX.SRC/SBIN/SHELL.S
|
|
|
|
|
ASM
|