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
|
|
|
|
|
>STA.G CMD.hCLBuf
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.Quit >LDA.G CMD.hCLBuf
|
|
|
|
|
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
|
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 #$ff
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>STA.G CL.bExec
|
2017-11-09 16:39:01 +00:00
|
|
|
|
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
|
|
|
|
|
|
2018-12-04 16:45:58 +00:00
|
|
|
|
jmp CL.SUPPR
|
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
|
2018-11-14 14:34:13 +00:00
|
|
|
|
cmp #CL.MAX
|
2017-11-08 16:09:52 +00:00
|
|
|
|
beq .9 Buffer full, discard...
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
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
|
|
|
|
|
ldx #'*'
|
|
|
|
|
|
|
|
|
|
.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)
|
|
|
|
|
CL.RESET.1 >STA.G CL.bExec
|
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
|
|
|
|
|
*--------------------------------------
|
2019-01-26 21:46:39 +00:00
|
|
|
|
* Read From CLBuf or FileBuf
|
|
|
|
|
*--------------------------------------
|
2018-11-19 16:15:16 +00:00
|
|
|
|
CL.GetLine >LDYA ZPFileBufPtr
|
2019-01-21 14:51:10 +00:00
|
|
|
|
>STYA ZPFileBufPtrBak
|
2018-11-19 16:15:16 +00:00
|
|
|
|
|
|
|
|
|
lda (ZPFileBufPtr)
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .9
|
2018-12-03 06:59:30 +00:00
|
|
|
|
|
2018-11-29 20:47:28 +00:00
|
|
|
|
ldx #0 not in "
|
2018-11-29 15:59:14 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPFileBufPtr),y
|
|
|
|
|
beq .7
|
2018-12-03 13:56:52 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
cmp #C.CR
|
|
|
|
|
beq .6
|
|
|
|
|
|
2018-11-29 15:59:14 +00:00
|
|
|
|
cmp #'"'
|
|
|
|
|
bne .2
|
|
|
|
|
|
2018-11-29 20:47:28 +00:00
|
|
|
|
txa
|
|
|
|
|
eor #$80 toggle " switch
|
|
|
|
|
tax
|
2018-11-29 15:59:14 +00:00
|
|
|
|
|
2018-11-29 20:47:28 +00:00
|
|
|
|
lda #'"'
|
2018-11-29 15:59:14 +00:00
|
|
|
|
bra .5
|
|
|
|
|
|
|
|
|
|
.2 cmp #';'
|
|
|
|
|
bne .5
|
|
|
|
|
|
2018-11-29 20:47:28 +00:00
|
|
|
|
txa
|
2018-11-17 17:42:20 +00:00
|
|
|
|
beq .6
|
2018-11-29 20:47:28 +00:00
|
|
|
|
|
|
|
|
|
lda #';'
|
2018-11-29 15:59:14 +00:00
|
|
|
|
|
|
|
|
|
.5 sta (ZPCLBuf),y
|
2018-11-10 14:30:09 +00:00
|
|
|
|
iny
|
2018-11-14 14:34:13 +00:00
|
|
|
|
cpy #CL.MAX
|
2018-11-10 14:30:09 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #E.SYN Line Too long !!!
|
|
|
|
|
* sec
|
|
|
|
|
rts
|
|
|
|
|
|
2018-11-10 17:43:20 +00:00
|
|
|
|
.6 sec skip CR or ;
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.HS 90 BCC
|
|
|
|
|
|
|
|
|
|
.7 clc
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
adc ZPFileBufPtr
|
|
|
|
|
sta ZPFileBufPtr
|
|
|
|
|
bcc .8
|
|
|
|
|
inc ZPFileBufPtr+1
|
|
|
|
|
|
|
|
|
|
.8 lda #0
|
2018-11-14 14:34:13 +00:00
|
|
|
|
sta (ZPCLBuf),y
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
>STA.G CL.Len
|
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G CL.bExec
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #C.EOF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* in:
|
2018-11-14 14:34:13 +00:00
|
|
|
|
* ZPCLBuf : CString command line
|
2018-11-10 14:30:09 +00:00
|
|
|
|
* out:
|
|
|
|
|
* ZPArgVBuf :
|
|
|
|
|
* /path/excmd\0 arg1\0 arg2\0 ... \0
|
|
|
|
|
* - or -
|
|
|
|
|
* intcmd\0 arg1\0 arg2\0 ... \0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.Parse >STZ.G CMD.IntCmd
|
|
|
|
|
|
|
|
|
|
lda #S.PS.F.HOLD+S.PS.F.DUPENV
|
|
|
|
|
>STA.G CMD.PSFlags
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
>PUSHW ZPCLBuf
|
|
|
|
|
>LDYA ZPCLBuf
|
|
|
|
|
>STYA ZPCLBufPtr
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
|
|
|
|
>SYSCALL Args2ArgV
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPArgVBuf)
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBufPtr)
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
.1 cmp #'#' comment ?
|
|
|
|
|
beq .8 yes, ignore remaining
|
|
|
|
|
|
|
|
|
|
>LDA.G CMD.IntCmd
|
2018-11-12 21:34:55 +00:00
|
|
|
|
bne .3 we already have Cmd, go check args
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2018-11-13 15:54:10 +00:00
|
|
|
|
ldy #1
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBufPtr),y only one char ?
|
2018-11-10 14:30:09 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBufPtr)
|
2018-11-10 14:30:09 +00:00
|
|
|
|
cmp #'.' leading dot ?
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
>LDA.G CMD.PSFlags yes, child process will run in same ENV
|
|
|
|
|
and #$ff^S.PS.F.DUPENV
|
|
|
|
|
sta (pData),y
|
2018-11-12 21:34:55 +00:00
|
|
|
|
bra .6 and skip this token
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
|
|
|
|
.2 jsr CL.CheckCmd
|
2018-11-12 21:34:55 +00:00
|
|
|
|
bcc .6 success, skip token, already added by CheckCmd
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
2018-11-12 21:34:55 +00:00
|
|
|
|
.3 jsr CL.CheckIO
|
|
|
|
|
bcc .7 IO token & related args processed
|
|
|
|
|
tay an error ?
|
|
|
|
|
bne .9 yes...I/O error...
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
jsr CL.AddCLBufPtrToArgV no...add as an arg
|
2018-11-10 14:30:09 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
.6 jsr CL.NextCLToken
|
|
|
|
|
.7 lda (ZPCLBufPtr)
|
2018-11-10 14:30:09 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2018-11-14 14:34:13 +00:00
|
|
|
|
* ZPCLBuf-> argv[] (formatted & not empty)
|
2018-11-10 14:30:09 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.CheckCmd ldy #$ff
|
|
|
|
|
|
|
|
|
|
.1 iny
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBufPtr),y
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .2
|
|
|
|
|
cmp #'/'
|
|
|
|
|
bne .1
|
|
|
|
|
|
2019-01-21 06:52:04 +00:00
|
|
|
|
bra .4
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
.2 >PUSHW ZPCLBufPtr
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>LDYA L.CMD.INT
|
|
|
|
|
jsr Lookup no / found, search internal...
|
|
|
|
|
bcs .4 not internal, search PATH
|
|
|
|
|
|
|
|
|
|
phx
|
|
|
|
|
plx
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
>LDA.G CMD.PSFlags if STARTPROC, skip keyword...
|
|
|
|
|
and #$ff^S.PS.F.HOLD
|
|
|
|
|
sta (pData),y ...and toggle S.PS.F.HOLD flag
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
.3 jsr CL.AddYAToArgV X unmodified
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CMD.IntCmd
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2019-01-21 06:52:04 +00:00
|
|
|
|
.4 >LDYA ZPCLBufPtr
|
|
|
|
|
jsr CL.AddYAToArgV
|
2018-11-11 22:05:04 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G CMD.IntCmd
|
2019-01-21 06:52:04 +00:00
|
|
|
|
clc
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2019-01-21 06:52:04 +00:00
|
|
|
|
CL.CheckCmd.RTS
|
2018-11-10 14:30:09 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-14 14:34:13 +00:00
|
|
|
|
CL.CheckIO >PUSHW ZPCLBufPtr
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>LDYA L.CL.IO
|
|
|
|
|
jsr Lookup
|
|
|
|
|
bcs .9 not a IO token...should be an arg....
|
|
|
|
|
phx
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
jsr CL.NextCLToken skip this IO token
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
|
|
|
|
plx
|
|
|
|
|
jmp (J.CL.IO,x)
|
|
|
|
|
|
|
|
|
|
.9 lda #0
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.IO.AMP >LDA.G CMD.PSFlags
|
|
|
|
|
and #$ff^S.PS.F.HOLD
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
CL.IO.IN lda #O.RDONLY+O.TEXT
|
|
|
|
|
jsr CL.IO.Open
|
|
|
|
|
bcs .9
|
|
|
|
|
jsr IO.Set.In
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
jsr CL.NextCLToken skip arg
|
2018-11-10 14:30:09 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
CL.IO.OUTA
|
|
|
|
|
CL.IO.1OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
|
|
|
|
|
bra CL.IO.OUT.1
|
|
|
|
|
CL.IO.OUT
|
|
|
|
|
CL.IO.1OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
|
|
|
|
|
|
|
|
|
|
CL.IO.OUT.1 jsr CL.IO.Open
|
|
|
|
|
bcs .9
|
|
|
|
|
jsr IO.Set.Out
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
jsr CL.NextCLToken skip arg
|
|
|
|
|
clc
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
|
|
|
|
|
CL.IO.2OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
|
|
|
|
|
bra CL.IO.2OUT.1
|
|
|
|
|
CL.IO.2OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
|
|
|
|
|
|
|
|
|
|
CL.IO.2OUT.1 jsr CL.IO.Open
|
|
|
|
|
bcs .9
|
|
|
|
|
jsr IO.Set.Err
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
jsr CL.NextCLToken skip arg
|
2018-11-10 14:30:09 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CL.IO.Open pha
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBufPtr)
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .9 no arg left....
|
|
|
|
|
|
|
|
|
|
>PUSHWI 0 Aux type
|
|
|
|
|
>PUSHBI S.FI.T.TXT ftype
|
|
|
|
|
pla
|
|
|
|
|
>PUSHA flags
|
2018-11-14 14:34:13 +00:00
|
|
|
|
>LDYA ZPCLBufPtr
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>SYSCALL fopen
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 pla
|
2018-11-28 11:39:33 +00:00
|
|
|
|
lda #E.CSYN
|
2018-11-10 14:30:09 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-14 14:34:13 +00:00
|
|
|
|
CL.NextCLToken
|
|
|
|
|
lda (ZPCLBufPtr)
|
|
|
|
|
inc ZPCLBufPtr
|
2018-11-10 14:30:09 +00:00
|
|
|
|
bne .1
|
2018-11-14 14:34:13 +00:00
|
|
|
|
inc ZPCLBufPtr+1
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.1 tax
|
2018-11-14 14:34:13 +00:00
|
|
|
|
bne CL.NextCLToken
|
2018-11-10 14:30:09 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-11-14 14:34:13 +00:00
|
|
|
|
CL.AddCLBufPtrToArgV
|
|
|
|
|
>LDYA ZPCLBufPtr
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.AddYAToArgV >STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
>LDYA ZPArgVBuf
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtr2) scan to end of argV
|
|
|
|
|
beq .6
|
|
|
|
|
|
|
|
|
|
.2 inc ZPPtr2
|
|
|
|
|
bne .3
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
.3 lda (ZPPtr2)
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
inc ZPPtr2
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
.4 lda (ZPPtr2)
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
.6 ldy #$ff
|
|
|
|
|
|
|
|
|
|
.7 iny
|
|
|
|
|
* beq .9
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
sta (ZPPtr2),y
|
|
|
|
|
bne .7 including str ending \0
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
* beq .9
|
|
|
|
|
sta (ZPPtr2),y arg[] ending \0
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #E.BUF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-09-27 15:40:31 +00:00
|
|
|
|
MAN
|
2018-11-22 16:39:41 +00:00
|
|
|
|
SAVE USR/SRC/BIN/SHELL.S.CL
|
|
|
|
|
LOAD USR/SRC/BIN/SHELL.S
|
2017-09-27 15:40:31 +00:00
|
|
|
|
ASM
|