A2osX/SBIN/SHELL.S.CL.txt

185 lines
3.0 KiB
Plaintext
Raw Normal View History

PR#3
PREFIX /A2OSX.BUILD
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
CL.PrintPrompt >LDYA L.ENV.PS1
>SYSCALL GetEnv.YA
>SYSCALL ExpandStr.YA
phx
>SYSCALL PrintF.YA
>LDYA L.MSG.PROMPT
>SYSCALL PrintF.YA
plx
php
pha
txa
>SYSCALL FreeMem.A
pla
plp
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
>SYSCALL PutChar.A
>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
>STA.G bSecureRead Clear password mode
rts
*--------------------------------------
CL.BS >LDA.G CmdBufPtr
beq .9
dec
sta (pData),y
lda #8
>SYSCALL PutChar.A
.9 rts
*--------------------------------------
CL.NAK >LDA.G CmdBufPtr
>CMP.G CmdBuflen
beq .9
inc
>STA.G CmdBufPtr
lda #21
>SYSCALL PutChar.A
.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 #8
>SYSCALL PutChar.A
>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.A
pla
inc
bra .1
.2 lda #' '
>SYSCALL PutChar.A
>LDA.G CmdBufPtr
.3 >CMP.G CmdBuflen
beq .4
pha
lda #8
>SYSCALL PutChar.A
pla
inc
bra .3
.4 lda #8
>SYSCALL PutChar.A
CL.PrintEOL.8 clc
rts
*--------------------------------------
CL.PRINT >LDYA ZPCMDBuf
>SYSCALL PrintF.YA
rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/SBIN/SHELL.S.CL
LOAD /A2OSX.SRC/SBIN/SHELL.S
ASM