mirror of
https://github.com/A2osX/A2osX.git
synced 2024-08-17 02:29:30 +00:00
269 lines
4.1 KiB
Plaintext
269 lines
4.1 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
CL.PrintPrompt >LDYA L.ENV.PS1
|
||
>SYSCALL GetEnv
|
||
bcs .1
|
||
|
||
>SYSCALL ExpandStr
|
||
bcs .9
|
||
|
||
phx
|
||
pha
|
||
>PUSHBI 0
|
||
pla
|
||
>SYSCALL printf
|
||
pla
|
||
>SYSCALL FreeMem
|
||
|
||
.1 >PUSHBI 0
|
||
>LDYA L.MSG.PROMPT
|
||
>SYSCALL printf
|
||
.9 rts
|
||
*--------------------------------------
|
||
CL.CHARIN tax
|
||
|
||
>LDA.G bEscMode
|
||
beq .13
|
||
|
||
cpx #'['
|
||
beq .9
|
||
|
||
lda #0
|
||
sta (pData),y Y=bEscMode
|
||
txa
|
||
|
||
ldx #EscChars.Cnt-1
|
||
|
||
.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
|
||
*--------------------------------------
|
||
CL.CHARIN.CTRL cpx #C.CR
|
||
bne .10
|
||
|
||
>PUSHBI 0
|
||
>LDYA L.MSG.ECHOCRLF
|
||
>SYSCALL printf
|
||
|
||
>LDA.G CmdBufPtr
|
||
tay
|
||
lda #0
|
||
sta (ZPCMDBuf),y
|
||
tya
|
||
>STA.G CmdBuflen
|
||
|
||
lda #$ff
|
||
>STA.G bCmdBufexec
|
||
clc
|
||
rts
|
||
|
||
.10 cpx #C.ESC
|
||
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
|
||
*--------------------------------------
|
||
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
|
||
|
||
>LDA.G bSecureRead
|
||
bpl .2
|
||
ldx #'*'
|
||
|
||
.2 txa
|
||
>SYSCALL PutChar
|
||
|
||
>INC.G CmdBufPtr
|
||
|
||
jmp CL.PrintEOL
|
||
|
||
.9 clc
|
||
rts
|
||
*--------------------------------------
|
||
CL.CLR ldy #0
|
||
|
||
.1 lda (ZPCMDBuf),y
|
||
beq CL.RESET
|
||
|
||
.2 lda #$7F
|
||
|
||
sta (ZPCMDBuf),y
|
||
iny
|
||
lda (ZPCMDBuf),y
|
||
bne .2
|
||
|
||
jsr CL.PRINT
|
||
*--------------------------------------
|
||
CL.RESET lda #0
|
||
sta (ZPCMDBuf)
|
||
>STA.G bCmdBufexec
|
||
>STA.G CmdBufPtr
|
||
>STA.G CmdBuflen
|
||
rts
|
||
*--------------------------------------
|
||
CL.BS >LDA.G CmdBufPtr
|
||
beq .9
|
||
|
||
dec
|
||
sta (pData),y
|
||
|
||
lda #C.BS
|
||
>SYSCALL PutChar
|
||
.9 rts
|
||
*--------------------------------------
|
||
CL.NAK >LDA.G CmdBufPtr
|
||
>CMP.G CmdBuflen
|
||
beq .9
|
||
|
||
inc
|
||
>STA.G CmdBufPtr
|
||
|
||
lda #C.FS
|
||
>SYSCALL PutChar
|
||
.9 rts
|
||
*--------------------------------------
|
||
* Erase char UNDER cursor
|
||
*--------------------------------------
|
||
CL.SUPPR >LDA.G CmdBuflen
|
||
beq CL.PrintEOL.8
|
||
|
||
>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
|
||
|
||
lda #C.BS
|
||
>SYSCALL PutChar
|
||
|
||
>DEC.G CmdBufPtr
|
||
|
||
CL.DEL.1 pha
|
||
|
||
.1 ply
|
||
iny
|
||
lda (ZPCMDBuf),y
|
||
dey
|
||
sta (ZPCMDBuf),y
|
||
iny
|
||
phy
|
||
tya
|
||
|
||
>CMP.G CmdBufLen
|
||
bne .1
|
||
|
||
pla
|
||
|
||
>DEC.G CmdBuflen
|
||
*--------------------------------------
|
||
CL.PrintEOL >LDA.G CmdBufPtr
|
||
|
||
.1 >CMP.G CmdBuflen
|
||
beq .2
|
||
|
||
pha
|
||
tay
|
||
lda (ZPCMDBuf),y
|
||
>SYSCALL PutChar
|
||
pla
|
||
inc
|
||
bra .1
|
||
|
||
.2 lda #' '
|
||
>SYSCALL PutChar
|
||
|
||
>LDA.G CmdBufPtr
|
||
|
||
.3 >CMP.G CmdBuflen
|
||
beq .4
|
||
|
||
pha
|
||
|
||
lda #C.BS
|
||
>SYSCALL PutChar
|
||
pla
|
||
inc
|
||
bra .3
|
||
|
||
.4 lda #C.BS
|
||
>SYSCALL PutChar
|
||
|
||
CL.PrintEOL.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
CL.PRINT >LDYA ZPCMDBuf
|
||
>SYSCALL printf
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/SBIN/SHELL.S.CL
|
||
LOAD /A2OSX.SRC/SBIN/SHELL.S
|
||
ASM
|