2019-01-28 16:33:30 +00:00
|
|
|
|
NEW
|
2019-04-15 05:40:13 +00:00
|
|
|
|
AUTO 3,1
|
2019-01-28 16:33:30 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-20 15:24:53 +00:00
|
|
|
|
CORE.Init lda #PUSHD.STACK
|
2022-10-07 19:21:37 +00:00
|
|
|
|
tay
|
|
|
|
|
sta (pdata),y
|
|
|
|
|
|
|
|
|
|
lda #CODE.STACK
|
|
|
|
|
tay
|
|
|
|
|
sta (pdata),y
|
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2019-01-31 16:34:02 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.FUNCRESET >LDA.G hFunctions
|
2019-07-31 15:10:59 +00:00
|
|
|
|
beq .8
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-04-01 15:24:01 +00:00
|
|
|
|
>SYSCALL SListFree
|
2022-10-07 19:21:37 +00:00
|
|
|
|
>STZ.G hFunctions
|
|
|
|
|
|
|
|
|
|
.8 rts
|
2019-08-05 13:30:58 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-09 21:22:46 +00:00
|
|
|
|
* stack-6,7 old InputBuf
|
|
|
|
|
* stack-4,5 old InputBufPtr
|
2020-08-11 18:55:28 +00:00
|
|
|
|
* stack-3 old ARGC
|
|
|
|
|
* stack-2 old ARGV
|
|
|
|
|
* stack-1 new hCode
|
2022-10-07 19:21:37 +00:00
|
|
|
|
* stack
|
2020-08-11 18:55:28 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.Load.YAX stx LOAD.hCode X = Code to Execute
|
2019-08-05 13:30:58 +00:00
|
|
|
|
|
2020-02-07 15:35:52 +00:00
|
|
|
|
>SYSCALL ArgVDup Y,A = ArgV
|
2019-08-15 12:48:58 +00:00
|
|
|
|
bcs .9
|
2019-09-08 12:09:47 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
stx LOAD.hArgs X = hARGV
|
|
|
|
|
sta LOAD.ArgCnt A = ARGC
|
2019-08-05 13:30:58 +00:00
|
|
|
|
|
|
|
|
|
lda #8
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr STK.Check
|
2019-08-15 12:48:58 +00:00
|
|
|
|
bcs .9
|
2020-02-02 18:24:40 +00:00
|
|
|
|
|
2019-08-05 13:30:58 +00:00
|
|
|
|
>LDYA ZPInputBuf
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr STK.PushYA
|
2020-01-06 16:27:52 +00:00
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr STK.PushInputBufPtr
|
2020-01-06 16:27:52 +00:00
|
|
|
|
|
2019-08-05 13:30:58 +00:00
|
|
|
|
ldy #S.PS.ARGC
|
|
|
|
|
lda (pPS),y
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr STK.Push old ARGC
|
2019-08-05 13:30:58 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.hARGV
|
|
|
|
|
lda (pPS),y
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr STK.Push old hARGV
|
2019-08-05 13:30:58 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PS.ARGC
|
2022-10-07 19:21:37 +00:00
|
|
|
|
lda LOAD.ArgCnt new ARGC
|
2020-01-09 15:54:14 +00:00
|
|
|
|
dec Skip ARG0 in count
|
2019-08-05 13:30:58 +00:00
|
|
|
|
sta (pPS),y
|
2020-01-09 15:54:14 +00:00
|
|
|
|
|
2019-08-05 13:30:58 +00:00
|
|
|
|
iny #S.PS.hARGV
|
2022-10-07 19:21:37 +00:00
|
|
|
|
lda LOAD.hArgs
|
2019-08-15 12:48:58 +00:00
|
|
|
|
sta (pPS),y new hARGV
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
|
|
|
|
lda LOAD.hCode new code
|
2022-12-07 07:02:29 +00:00
|
|
|
|
jsr STK.Push
|
2022-10-07 19:21:37 +00:00
|
|
|
|
* lda LOAD.hCode
|
2019-08-05 13:30:58 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPInputBuf
|
|
|
|
|
>STYA ZPInputBufPtr
|
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
* clc
|
|
|
|
|
.9 rts
|
2019-01-28 16:33:30 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-14 14:51:24 +00:00
|
|
|
|
* http://heirloom.sourceforge.net/sh/sh.1.html
|
|
|
|
|
*--------------------------------------
|
2020-01-20 15:24:53 +00:00
|
|
|
|
* CORE.Run
|
|
|
|
|
* Input : ZPInputBufPtr (String)
|
2019-02-03 21:58:26 +00:00
|
|
|
|
* Tokenize ZPArgVBuf
|
2019-02-01 16:32:29 +00:00
|
|
|
|
* :LOOP
|
2022-10-07 19:21:37 +00:00
|
|
|
|
* if CmdSep=| :
|
2019-02-01 16:32:29 +00:00
|
|
|
|
* set hStdIn = hStdOut
|
|
|
|
|
* set hStdOut = Std
|
|
|
|
|
* GetCmd from line until | or EOL
|
|
|
|
|
* if CmdSep=| :
|
|
|
|
|
* create PIPE
|
|
|
|
|
* set hStdOut -> PIPE
|
|
|
|
|
* CORE.Exec &
|
|
|
|
|
* :LOOP
|
|
|
|
|
* else CORE.Exec
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* SET VAR = `cmd args`, FOR VAR IN `cmd args`
|
|
|
|
|
* create PIPE
|
|
|
|
|
* set hStdOut -> PIPE
|
|
|
|
|
* CORE.Exec `cmd args` &
|
|
|
|
|
* set READMODE
|
|
|
|
|
* set hStdIn = hStdOut
|
|
|
|
|
* set hStdOut = Std
|
|
|
|
|
*--------------------------------------
|
2022-12-07 07:02:29 +00:00
|
|
|
|
CORE.Run.EOF jsr STK.Pull
|
2019-08-15 12:48:58 +00:00
|
|
|
|
bcs *
|
|
|
|
|
cmp #$C0+C.. check CALL . CL context
|
|
|
|
|
beq .1
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
cmp #$C0+C.CALL
|
|
|
|
|
beq .1
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
cmp #$C0+C.CLEXEC
|
2019-08-12 07:40:16 +00:00
|
|
|
|
bne .9
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
.1 jsr CMD.EXIT.FILE
|
2019-08-12 07:40:16 +00:00
|
|
|
|
|
|
|
|
|
jsr IO.Reset
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-08-12 07:40:16 +00:00
|
|
|
|
lda #0
|
|
|
|
|
sec
|
2020-01-20 15:24:53 +00:00
|
|
|
|
jmp CORE.Run.Exit Ending 0, CS,A=0
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
.9 lda #E.UNEXPEOF
|
2019-08-12 07:40:16 +00:00
|
|
|
|
sec
|
2020-01-20 15:24:53 +00:00
|
|
|
|
jmp CORE.Run.Exit
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2020-01-20 15:24:53 +00:00
|
|
|
|
CORE.Run.RTS rts
|
2019-08-12 07:40:16 +00:00
|
|
|
|
*--------------------------------------
|
2023-05-19 15:39:42 +00:00
|
|
|
|
CORE.Run >LDYAI 256
|
2020-01-20 15:24:53 +00:00
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs CORE.Run.RTS
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2020-01-20 15:24:53 +00:00
|
|
|
|
>STYA ZPArgVBuf
|
|
|
|
|
txa
|
|
|
|
|
>STA.G CORE.hArgVBuf
|
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
lda #bState.PipeIn+bState.PipeOut
|
2022-10-09 21:22:46 +00:00
|
|
|
|
trb bState
|
2023-05-16 16:53:52 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.Run.1 >LDYA ZPInputBufPtr Save Actual ptr for looping
|
2019-02-07 16:52:25 +00:00
|
|
|
|
>STYA ZPInputCmdPtr
|
|
|
|
|
|
2020-01-20 15:24:53 +00:00
|
|
|
|
>LDYA ZPArgVBuf Reset ArgV Buffer
|
2019-02-08 16:13:43 +00:00
|
|
|
|
>STYA ZPArgVBufPtr
|
2019-10-26 14:33:37 +00:00
|
|
|
|
|
2020-01-20 15:24:53 +00:00
|
|
|
|
lda #0
|
2019-02-11 16:44:56 +00:00
|
|
|
|
sta (ZPArgVBuf)
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2020-01-20 15:24:53 +00:00
|
|
|
|
sec
|
|
|
|
|
ror CORE.IntCmd assume external
|
2019-10-26 14:33:37 +00:00
|
|
|
|
|
2019-04-15 05:40:13 +00:00
|
|
|
|
lda #S.PS.F.HOLD
|
2019-08-12 07:40:16 +00:00
|
|
|
|
sta CORE.PSFlags
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2020-01-20 15:24:53 +00:00
|
|
|
|
jsr CORE.GetCharNB
|
2019-08-12 07:40:16 +00:00
|
|
|
|
bcs CORE.Run.EOF
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2019-10-26 14:33:37 +00:00
|
|
|
|
cmp #C.CR empty line ?
|
2019-03-14 16:51:02 +00:00
|
|
|
|
bne .33
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-03-14 16:51:02 +00:00
|
|
|
|
jsr CORE.GetNextChar skip CR...
|
|
|
|
|
bra .8
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2019-03-14 16:51:02 +00:00
|
|
|
|
.33 cmp #'#' commented line?
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bne CORE.Run.3
|
2019-02-07 16:52:25 +00:00
|
|
|
|
|
2019-03-14 16:51:02 +00:00
|
|
|
|
.12 jsr CORE.SkipLine
|
2019-02-11 16:44:56 +00:00
|
|
|
|
|
2023-05-19 15:39:42 +00:00
|
|
|
|
.8 jmp CORE.Run.Exit0 EOL, CS,A=0
|
2022-10-07 19:21:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.Run.3 >LDA.G hAliases
|
|
|
|
|
beq CORE.Run.4
|
|
|
|
|
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHW ZPInputBufPtr
|
2022-11-02 06:54:30 +00:00
|
|
|
|
>PUSHWZ ScopeID
|
2022-10-07 19:21:37 +00:00
|
|
|
|
>SYSCALL SListLookup
|
|
|
|
|
bcs CORE.Run.4
|
|
|
|
|
|
|
|
|
|
>STYA ZPTmpW Save KeyID
|
|
|
|
|
txa
|
|
|
|
|
jsr CORE.SkipCharsA
|
|
|
|
|
|
2022-10-09 21:22:46 +00:00
|
|
|
|
ldy #hAliases
|
|
|
|
|
jsr CORE.SListGetData
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs .9
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.PushBufX
|
|
|
|
|
bcc CORE.Run.3
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.Run.4 >LDYA L.CMD internal command ?
|
2019-02-11 16:44:56 +00:00
|
|
|
|
jsr CORE.LookupInputBuf
|
2019-03-02 20:47:58 +00:00
|
|
|
|
bcc .41
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-03-15 16:20:28 +00:00
|
|
|
|
.40 jsr CORE.ArgV.Add external cmd, go check context
|
2019-03-02 20:47:58 +00:00
|
|
|
|
bra .42
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
|
|
|
|
.41 stx CORE.IntCmd
|
|
|
|
|
jsr CORE.SkipCharsA
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2022-12-07 07:02:29 +00:00
|
|
|
|
.42 jsr STK.Get
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs CORE.Run.5 no particular context, exec...
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-03-04 16:44:33 +00:00
|
|
|
|
tax
|
2019-07-31 15:10:59 +00:00
|
|
|
|
lda CORE.IntCmd
|
2019-03-04 16:44:33 +00:00
|
|
|
|
bmi .45
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-03-04 16:46:46 +00:00
|
|
|
|
and #$3F
|
2019-03-12 16:50:16 +00:00
|
|
|
|
cmp #C.SWITCH SWITCH....FI ?
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs CORE.Run.5
|
2019-03-02 20:47:58 +00:00
|
|
|
|
|
2019-03-04 16:44:33 +00:00
|
|
|
|
.45 txa
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bpl .43 context is FALSE, skip line
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
asl
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bmi CORE.Run.5 parent context is true, exec
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-03-04 22:20:26 +00:00
|
|
|
|
.43 jsr CORE.GetCharNB
|
2019-03-02 20:47:58 +00:00
|
|
|
|
bcs .44 EOF
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
|
|
|
|
beq .44
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-03-02 20:47:58 +00:00
|
|
|
|
cmp #';' TODO ";"
|
2019-03-04 22:20:26 +00:00
|
|
|
|
beq .44
|
|
|
|
|
|
|
|
|
|
jsr CORE.GetNextChar
|
|
|
|
|
bra .43
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-03-02 20:47:58 +00:00
|
|
|
|
.44 jsr CORE.GetNextCharNB Skip EoL char
|
2023-05-19 15:39:42 +00:00
|
|
|
|
jmp CORE.Run.Exit0
|
2019-03-14 16:51:02 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.Run.5 jsr CORE.GetCharNB
|
2023-05-16 16:53:52 +00:00
|
|
|
|
bcs CORE.Run.6 Nothing to skip
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
|
|
|
|
jsr CORE.IsEndCmd
|
|
|
|
|
bcc .3
|
|
|
|
|
|
|
|
|
|
>LDYA L.CORE.IO
|
2019-02-11 16:44:56 +00:00
|
|
|
|
jsr CORE.LookupInputBuf
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs .2
|
2019-02-18 12:52:10 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
jsr CORE.SkipCharsA
|
|
|
|
|
|
2019-02-11 06:58:33 +00:00
|
|
|
|
jsr CORE.IO.JMP
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcc CORE.Run.5
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcs .9
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.2 jsr CORE.ArgV.Add
|
|
|
|
|
bcc CORE.Run.5
|
2019-10-26 14:33:37 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.9 lda #E.SYN
|
|
|
|
|
sec
|
|
|
|
|
jmp CORE.Run.Exit
|
2023-05-16 16:53:52 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.3 cmp #C.CR
|
|
|
|
|
beq .7
|
|
|
|
|
|
|
|
|
|
cmp #';'
|
|
|
|
|
beq .7
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
cmp #'|'
|
|
|
|
|
bne .5
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNextCharNB '|'
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
|
|
|
|
lda #bState.PipeOut
|
|
|
|
|
tsb bState
|
|
|
|
|
bra CORE.Run.6
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.5 cmp #'&'
|
|
|
|
|
bne .9
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.GetNextChar Skip '&'
|
|
|
|
|
bcs .50
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
cmp #'&'
|
|
|
|
|
beq .6 &&
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.50 lda #S.PS.F.HOLD Run in the background...
|
|
|
|
|
trb CORE.PSFlags
|
2023-05-16 16:53:52 +00:00
|
|
|
|
bra CORE.Run.6
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.6 jsr CORE.GetNextChar Skip '&&'
|
|
|
|
|
|
|
|
|
|
jsr CORE.ExecCmd
|
|
|
|
|
bcc .60
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
jsr CORE.SkipLine
|
2023-05-19 15:39:42 +00:00
|
|
|
|
jmp CORE.Run.Exit0
|
2022-10-09 21:22:46 +00:00
|
|
|
|
|
|
|
|
|
.60 jmp CORE.Run.1
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
|
|
|
|
.7 jsr CORE.GetNextCharNB Skip EoL char
|
|
|
|
|
*--------------------------------------
|
2022-10-09 21:22:46 +00:00
|
|
|
|
CORE.Run.6 lda bState
|
2023-05-16 16:53:52 +00:00
|
|
|
|
bit #bState.PipeOut
|
2023-05-19 12:16:09 +00:00
|
|
|
|
beq .1
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-11 06:58:33 +00:00
|
|
|
|
jsr IO.Pipe.Out
|
2020-01-20 15:24:53 +00:00
|
|
|
|
bcs CORE.Run.Exit
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
2020-08-25 10:56:00 +00:00
|
|
|
|
lda #S.PS.F.HOLD Run in the background...
|
|
|
|
|
trb CORE.PSFlags
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
lda #S.PS.F.CLOSEONX ...and child PS must close StdOut on exit
|
2020-08-25 10:56:00 +00:00
|
|
|
|
tsb CORE.PSFlags
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-19 12:16:09 +00:00
|
|
|
|
.1 jsr CORE.ExecCmd
|
2023-05-16 16:53:52 +00:00
|
|
|
|
bcs CORE.Run.Exit
|
|
|
|
|
|
|
|
|
|
lda bState
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-19 12:16:09 +00:00
|
|
|
|
bit #bState.PipeIn
|
|
|
|
|
beq .2
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
jsr IO.Pop.In restore Input piping app must close it
|
|
|
|
|
|
|
|
|
|
lda #bState.PipeIn
|
|
|
|
|
trb bState
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2022-10-09 21:22:46 +00:00
|
|
|
|
lda bState
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-19 12:16:09 +00:00
|
|
|
|
.2 bit #bState.PipeOut
|
2023-05-19 15:39:42 +00:00
|
|
|
|
beq CORE.Run.Exit0
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
jsr IO.Pipe.In Set previous Pipe Out to StdIn for next CMD
|
2020-01-20 15:24:53 +00:00
|
|
|
|
bcs CORE.Run.Exit
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2022-10-09 21:22:46 +00:00
|
|
|
|
lda #bState.PipeIn
|
|
|
|
|
tsb bState
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
bit CORE.IntCmd
|
2023-05-19 12:16:09 +00:00
|
|
|
|
bmi .3
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
|
|
|
|
jsr IO.Reset.Out Internal : CLOSE output
|
2023-05-19 12:16:09 +00:00
|
|
|
|
bra .4
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
2023-05-19 12:16:09 +00:00
|
|
|
|
.3 jsr IO.Pop.Out External : DONT Close Output, child process will close it
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-19 12:16:09 +00:00
|
|
|
|
.4 lda #bState.PipeOut
|
2023-05-16 16:53:52 +00:00
|
|
|
|
trb bState
|
|
|
|
|
|
|
|
|
|
.7 jmp CORE.Run.1 Loop with Pipe IN
|
2023-05-18 16:12:57 +00:00
|
|
|
|
|
2023-05-19 15:39:42 +00:00
|
|
|
|
CORE.Run.Exit0 lda #0
|
2023-05-18 16:12:57 +00:00
|
|
|
|
clc
|
2023-05-19 15:39:42 +00:00
|
|
|
|
|
2020-01-20 15:24:53 +00:00
|
|
|
|
CORE.Run.Exit php
|
|
|
|
|
pha
|
|
|
|
|
>LDA.G CORE.hArgVBuf
|
2020-01-20 16:34:59 +00:00
|
|
|
|
beq .1
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2020-02-28 07:21:46 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2020-01-20 15:24:53 +00:00
|
|
|
|
>STZ.G CORE.hArgVBuf
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2023-05-19 15:39:42 +00:00
|
|
|
|
.1 jsr IO.Reset
|
|
|
|
|
|
|
|
|
|
pla
|
2020-01-20 15:24:53 +00:00
|
|
|
|
plp
|
|
|
|
|
rts
|
2019-02-07 16:52:25 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-11 06:58:33 +00:00
|
|
|
|
* Input : ZPArgVBuf
|
|
|
|
|
*--------------------------------------
|
2019-10-26 14:33:37 +00:00
|
|
|
|
CORE.ExecCmd lda #0
|
2019-02-11 16:44:56 +00:00
|
|
|
|
sta (ZPArgVBufPtr)
|
2019-03-02 20:47:58 +00:00
|
|
|
|
>LDYA ZPArgVBuf
|
2019-02-11 16:44:56 +00:00
|
|
|
|
>STYA ZPArgVBufPtr
|
2019-02-11 06:58:33 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
lda CORE.IntCmd
|
2019-02-11 06:58:33 +00:00
|
|
|
|
bmi CORE.ExecExtCmd
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
asl
|
|
|
|
|
tax
|
2019-02-11 06:58:33 +00:00
|
|
|
|
jmp (J.CMD,x)
|
2022-10-07 19:21:37 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-08 12:37:10 +00:00
|
|
|
|
CORE.ExecExtCmd >PUSHW ZPArgVBuf
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHB CORE.PSFlags
|
2019-10-12 14:20:09 +00:00
|
|
|
|
|
2020-03-09 16:24:08 +00:00
|
|
|
|
>SYSCALL ExecV
|
2019-01-28 16:33:30 +00:00
|
|
|
|
bcs .9
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-01 16:32:29 +00:00
|
|
|
|
tax CPID
|
2019-08-12 07:40:16 +00:00
|
|
|
|
lda CORE.PSFlags
|
2019-02-01 16:32:29 +00:00
|
|
|
|
and #S.PS.F.HOLD
|
2023-05-19 12:16:09 +00:00
|
|
|
|
bne .1
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2022-10-09 21:22:46 +00:00
|
|
|
|
lda bState
|
|
|
|
|
bit #bState.PipeOut
|
2023-05-19 12:16:09 +00:00
|
|
|
|
bne .1
|
2019-10-31 15:59:11 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
ldy #S.PS.hStdErr
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHW L.MSG.PID
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-01 16:32:29 +00:00
|
|
|
|
txa
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
2020-03-09 16:24:08 +00:00
|
|
|
|
>SYSCALL FPrintF
|
2020-02-14 07:21:56 +00:00
|
|
|
|
rts
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2023-05-19 12:16:09 +00:00
|
|
|
|
.1 >SLEEP Suspend this PID
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
2019-02-01 16:32:29 +00:00
|
|
|
|
ldy #S.PS.RC CPID will update S.PS.RC
|
2020-02-28 07:21:46 +00:00
|
|
|
|
lda (pPS),y
|
2023-05-19 12:16:09 +00:00
|
|
|
|
cmp #1
|
2019-10-25 15:09:13 +00:00
|
|
|
|
|
2019-02-01 16:32:29 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2019-03-14 16:51:02 +00:00
|
|
|
|
CORE.SkipLine jsr CORE.GetNextCharNB
|
|
|
|
|
bcs .8 EOF
|
|
|
|
|
|
|
|
|
|
cmp #C.CR EOL
|
|
|
|
|
bne CORE.SkipLine
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-03-14 16:51:02 +00:00
|
|
|
|
jsr CORE.GetNextChar skip CR...
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2019-02-11 16:44:56 +00:00
|
|
|
|
* search ZPInputBufPtr/ZPArgVBufPtr in Y,A table
|
2019-02-07 16:52:25 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-11 16:44:56 +00:00
|
|
|
|
CORE.LookupInputBuf
|
2019-08-15 12:48:58 +00:00
|
|
|
|
sec
|
|
|
|
|
.HS 90 BCC
|
|
|
|
|
CORE.LookupArgVBuf
|
|
|
|
|
clc
|
|
|
|
|
>STYA ZPPtr1 Keywords table
|
2019-02-11 16:44:56 +00:00
|
|
|
|
>LDYA ZPArgVBufPtr
|
2019-08-15 12:48:58 +00:00
|
|
|
|
bcc CORE.Lookup
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
>LDYA ZPInputBufPtr
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
CORE.Lookup >STYA ZPPtr2
|
2019-02-07 16:52:25 +00:00
|
|
|
|
|
|
|
|
|
ldx #0
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
.1 ldy #$ff
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
.2 jsr .7 get next valid char in src text
|
|
|
|
|
bcs .3
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
.20 jsr ToUpperCase
|
|
|
|
|
eor (ZPPtr1),y match table char ?
|
|
|
|
|
asl compare only 7 bits
|
|
|
|
|
bne .4 no match...get next table keyword
|
|
|
|
|
|
|
|
|
|
bcc .2 not last char in this keyword
|
|
|
|
|
|
|
|
|
|
jsr .7 next char in text...
|
|
|
|
|
bcc .4 valid....failed
|
|
|
|
|
|
|
|
|
|
.8 tya Keyword Len
|
2019-02-07 16:52:25 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
clc
|
2019-08-15 12:48:58 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 dey
|
|
|
|
|
lda (ZPPtr1),y was last char in this keyword ?
|
|
|
|
|
bmi .8
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
iny
|
|
|
|
|
.41 jsr IncPtr1 skip chars to next keyword
|
2019-02-07 16:52:25 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
.4 lda (ZPPtr1)
|
|
|
|
|
bpl .41
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-07-31 15:10:59 +00:00
|
|
|
|
jsr IncPtr1
|
2019-11-30 13:37:55 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
.6 inx
|
2019-08-15 12:48:58 +00:00
|
|
|
|
lda (ZPPtr1) Array Ending 0, lookup failed
|
2019-02-07 16:52:25 +00:00
|
|
|
|
bne .1
|
2020-01-11 17:13:27 +00:00
|
|
|
|
|
2019-03-05 16:49:34 +00:00
|
|
|
|
lda #E.SYN
|
2020-01-11 17:13:27 +00:00
|
|
|
|
|
|
|
|
|
.9 sec
|
2019-02-11 06:58:33 +00:00
|
|
|
|
rts
|
2020-01-06 07:03:37 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
.7 iny
|
|
|
|
|
lda (ZPPtr2),y Get Src text char...
|
|
|
|
|
beq .9 end of text
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-08-15 12:48:58 +00:00
|
|
|
|
jsr CORE.IsSpaceOrEndCmd
|
|
|
|
|
bcc .9 end of valid chars
|
|
|
|
|
clc
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.ArgV.Add.RTS
|
2019-08-15 12:48:58 +00:00
|
|
|
|
rts
|
2019-02-11 06:58:33 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* ArgV
|
|
|
|
|
*--------------------------------------
|
2020-01-13 13:33:30 +00:00
|
|
|
|
CORE.ArgV.Add lda #C.SPACE
|
2019-07-31 15:10:59 +00:00
|
|
|
|
sta ZPTmpW
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-12 16:47:34 +00:00
|
|
|
|
jsr CORE.GetCharNB
|
2020-02-14 07:21:56 +00:00
|
|
|
|
bcs CORE.ArgV.Add.RTS
|
2019-02-15 16:38:17 +00:00
|
|
|
|
|
|
|
|
|
cmp #'"'
|
|
|
|
|
bne .10
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
2019-07-31 15:10:59 +00:00
|
|
|
|
sta ZPTmpW
|
2019-02-15 16:38:17 +00:00
|
|
|
|
bra .1
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
2019-03-07 16:48:30 +00:00
|
|
|
|
.10 cmp #'('
|
2019-02-15 16:38:17 +00:00
|
|
|
|
bne .11
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
2019-03-07 20:40:06 +00:00
|
|
|
|
ldx #')'
|
2019-07-31 15:10:59 +00:00
|
|
|
|
stx ZPTmpW
|
2019-03-07 16:48:30 +00:00
|
|
|
|
bra .12
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-03-07 16:48:30 +00:00
|
|
|
|
.11 cmp #'`'
|
|
|
|
|
bne .12
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-07-31 15:10:59 +00:00
|
|
|
|
sta ZPTmpW
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
|
|
|
|
.12 sta (ZPArgVBufPtr),y
|
|
|
|
|
iny
|
2019-02-11 06:58:33 +00:00
|
|
|
|
|
2019-02-15 16:38:17 +00:00
|
|
|
|
.1 jsr CORE.GetNextChar
|
2021-08-01 13:45:15 +00:00
|
|
|
|
bcs .7
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
2019-07-31 15:10:59 +00:00
|
|
|
|
.2 cmp ZPTmpW
|
2019-02-18 16:05:40 +00:00
|
|
|
|
bne .3
|
2020-01-13 15:01:23 +00:00
|
|
|
|
|
2019-02-18 16:05:40 +00:00
|
|
|
|
jsr CORE.GetNextChar
|
2021-08-01 13:45:15 +00:00
|
|
|
|
bra .7
|
2019-02-11 06:58:33 +00:00
|
|
|
|
|
2020-01-13 13:33:30 +00:00
|
|
|
|
.3 ldx ZPTmpW
|
|
|
|
|
cpx #C.SPACE
|
2021-08-01 13:45:15 +00:00
|
|
|
|
bne .6
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
2019-02-21 11:34:28 +00:00
|
|
|
|
jsr CORE.IsEndCmd
|
2021-08-01 13:45:15 +00:00
|
|
|
|
bcc .7
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
2021-08-01 13:45:15 +00:00
|
|
|
|
.6 sta (ZPArgVBufPtr),y
|
2020-01-13 13:33:30 +00:00
|
|
|
|
iny
|
|
|
|
|
|
2021-08-01 13:45:15 +00:00
|
|
|
|
jsr CORE.GetNextChar
|
2019-02-15 16:38:17 +00:00
|
|
|
|
bcc .2
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
2021-08-01 13:45:15 +00:00
|
|
|
|
.7 lda #0
|
2020-01-13 13:33:30 +00:00
|
|
|
|
sta (ZPArgVBufPtr),y
|
2019-02-12 16:47:34 +00:00
|
|
|
|
|
2020-01-13 13:33:30 +00:00
|
|
|
|
>LDYA ZPArgVBufPtr
|
2020-01-13 15:01:23 +00:00
|
|
|
|
>STYA ZPArgVBufPrev
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHYA
|
2021-08-01 13:45:15 +00:00
|
|
|
|
>PUSHW ZPArgVBufPtr
|
2020-01-17 11:23:11 +00:00
|
|
|
|
>SYSCALL Expand
|
2019-02-12 16:47:34 +00:00
|
|
|
|
bcs .9
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
|
|
|
|
tya
|
2020-01-13 15:53:33 +00:00
|
|
|
|
beq .8 Empty string....
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2020-01-13 13:33:30 +00:00
|
|
|
|
sec
|
|
|
|
|
adc ZPArgVBufPtr
|
|
|
|
|
sta ZPArgVBufPtr
|
|
|
|
|
bcc .8
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2020-01-13 13:33:30 +00:00
|
|
|
|
inc ZPArgVBufPtr+1
|
2021-08-01 13:45:15 +00:00
|
|
|
|
clc
|
2020-01-13 13:33:30 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
.8
|
2019-02-12 16:47:34 +00:00
|
|
|
|
.9 rts
|
2019-02-11 06:58:33 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.ArgV.Next lda (ZPArgVBufPtr)
|
|
|
|
|
beq .8
|
2020-01-07 13:44:38 +00:00
|
|
|
|
|
2019-02-14 14:51:24 +00:00
|
|
|
|
>LDYA ZPArgVBufPtr
|
|
|
|
|
>STYA ZPArgVBufPrev
|
2020-01-07 13:44:38 +00:00
|
|
|
|
|
2019-02-11 06:58:33 +00:00
|
|
|
|
.1 jsr CORE.ArgV.NextChar
|
|
|
|
|
lda (ZPArgVBufPtr)
|
|
|
|
|
bne .1
|
2020-01-07 13:44:38 +00:00
|
|
|
|
|
2019-02-11 06:58:33 +00:00
|
|
|
|
jsr CORE.ArgV.NextChar
|
|
|
|
|
lda (ZPArgVBufPtr)
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2020-01-13 13:33:30 +00:00
|
|
|
|
CORE.ArgV.NextChar
|
|
|
|
|
inc ZPArgVBufPtr
|
|
|
|
|
bne .8
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
2020-01-13 13:33:30 +00:00
|
|
|
|
inc ZPArgVBufPtr+1
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2019-02-11 06:58:33 +00:00
|
|
|
|
* IO
|
|
|
|
|
*--------------------------------------
|
2019-04-01 06:07:56 +00:00
|
|
|
|
CORE.IO.JMP txa
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jmp (J.CORE.IO,x)
|
2019-02-11 06:58:33 +00:00
|
|
|
|
|
|
|
|
|
CORE.IO.IN lda #O.RDONLY+O.TEXT
|
|
|
|
|
jsr CORE.IO.Open
|
|
|
|
|
bcs CORE.IO.RTS
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-11 06:58:33 +00:00
|
|
|
|
jmp IO.Set.In
|
|
|
|
|
CORE.IO.OUTA
|
|
|
|
|
CORE.IO.1OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
|
|
|
|
|
bra CORE.IO.OUT.1
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.IO.OUT
|
2019-02-11 06:58:33 +00:00
|
|
|
|
CORE.IO.1OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
|
|
|
|
|
|
|
|
|
|
CORE.IO.OUT.1 jsr CORE.IO.Open
|
|
|
|
|
bcs CORE.IO.RTS
|
|
|
|
|
jmp IO.Set.Out
|
|
|
|
|
|
|
|
|
|
CORE.IO.2OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
|
|
|
|
|
bra CORE.IO.2OUT.1
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-11 06:58:33 +00:00
|
|
|
|
CORE.IO.2OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
|
|
|
|
|
|
|
|
|
|
CORE.IO.2OUT.1 jsr CORE.IO.Open
|
|
|
|
|
bcs CORE.IO.RTS
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-11 06:58:33 +00:00
|
|
|
|
jmp IO.Set.Err
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.IO.Open pha Open Mode
|
|
|
|
|
jsr CORE.GetCharNB
|
|
|
|
|
bcs .9 no arg left....
|
2019-02-18 12:52:10 +00:00
|
|
|
|
|
|
|
|
|
jsr CORE.ArgV.Add Get Filename
|
|
|
|
|
|
|
|
|
|
>LDYA ZPArgVBufPrev
|
|
|
|
|
>STYA ZPArgVBufPtr Discard filename
|
2019-08-02 14:36:49 +00:00
|
|
|
|
plx
|
|
|
|
|
jmp IO.FOpenYAX
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-11 06:58:33 +00:00
|
|
|
|
.9 pla
|
2019-03-05 16:49:34 +00:00
|
|
|
|
lda #E.SYN
|
2019-02-11 06:58:33 +00:00
|
|
|
|
sec
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.IO.RTS rts
|
2019-02-11 06:58:33 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Input Buffer
|
2019-02-07 16:52:25 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-08 16:13:43 +00:00
|
|
|
|
CORE.IsSpaceOrEndCmd
|
|
|
|
|
cmp #C.SPACE
|
|
|
|
|
beq CORE.IsEndCmd.8
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-21 11:34:28 +00:00
|
|
|
|
CORE.IsEndCmd cmp #';'
|
2019-02-08 16:13:43 +00:00
|
|
|
|
beq CORE.IsEndCmd.8
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-21 11:34:28 +00:00
|
|
|
|
cmp #C.CR
|
2019-02-08 16:13:43 +00:00
|
|
|
|
beq CORE.IsEndCmd.8
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
cmp #'&'
|
|
|
|
|
beq CORE.IsEndCmd.8
|
|
|
|
|
|
2019-02-07 16:52:25 +00:00
|
|
|
|
cmp #'|'
|
2019-02-08 16:13:43 +00:00
|
|
|
|
beq CORE.IsEndCmd.8
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-07 16:52:25 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-08 16:13:43 +00:00
|
|
|
|
CORE.IsEndCmd.8 clc
|
2019-02-07 16:52:25 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.GetCharNB jsr CORE.GetChar
|
|
|
|
|
bcs CORE.GetNextCharNB.RTS
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-07 16:52:25 +00:00
|
|
|
|
jsr CORE.CheckCharNB
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bcc CORE.GetNextCharNB.RTS
|
2019-02-07 16:52:25 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.GetNextCharNB
|
|
|
|
|
jsr CORE.GetNextChar
|
|
|
|
|
bcs CORE.GetNextCharNB.RTS
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-07 16:52:25 +00:00
|
|
|
|
jsr CORE.CheckCharNB
|
|
|
|
|
bcs CORE.GetNextCharNB
|
|
|
|
|
CORE.GetNextCharNB.RTS
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.CheckCharNB
|
|
|
|
|
cmp #C.SPACE
|
|
|
|
|
beq .9
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-07 16:52:25 +00:00
|
|
|
|
cmp #C.LF
|
|
|
|
|
beq .9
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-07 16:52:25 +00:00
|
|
|
|
cmp #C.TAB
|
|
|
|
|
beq .9
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-07 16:52:25 +00:00
|
|
|
|
clc
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 rts
|
2019-02-07 16:52:25 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CORE.GetNextChar
|
|
|
|
|
inc ZPInputBufPtr
|
|
|
|
|
bne CORE.GetChar
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2019-02-07 16:52:25 +00:00
|
|
|
|
inc ZPInputBufPtr+1
|
|
|
|
|
*--------------------------------------
|
2022-10-08 12:37:10 +00:00
|
|
|
|
CORE.GetChar clc
|
|
|
|
|
lda (ZPInputBufPtr)
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
jsr CORE.PopBuf
|
2022-10-08 12:37:10 +00:00
|
|
|
|
bcc CORE.GetChar
|
2021-05-11 18:44:13 +00:00
|
|
|
|
|
2022-10-08 12:37:10 +00:00
|
|
|
|
lda #0
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2022-10-08 12:37:10 +00:00
|
|
|
|
.8 rts
|
2019-01-28 16:33:30 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-11 16:44:56 +00:00
|
|
|
|
CORE.SkipCharsA clc
|
|
|
|
|
adc ZPInputBufPtr
|
|
|
|
|
sta ZPInputBufPtr
|
|
|
|
|
bcc .8
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
inc ZPInputBufPtr+1
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.8 rts
|
2019-02-11 16:44:56 +00:00
|
|
|
|
*--------------------------------------
|
2022-10-07 19:21:37 +00:00
|
|
|
|
CORE.PushBufX >LDA.G CODE.STACK
|
|
|
|
|
cmp #CODE.STACK.MAX*5
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
phx next hBuffer
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
2022-10-09 21:22:46 +00:00
|
|
|
|
.1 lda ZPInputBuf,x ZPInputBuf
|
2022-10-07 19:21:37 +00:00
|
|
|
|
sta (pData),y
|
2022-10-09 21:22:46 +00:00
|
|
|
|
inx ZPInputBufPtr
|
2022-10-07 19:21:37 +00:00
|
|
|
|
iny
|
2022-10-09 21:22:46 +00:00
|
|
|
|
cpx #6 ZPInputCmdPtr
|
2022-10-07 19:21:37 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
pha
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
>STA.G CODE.STACK
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>STYA ZPInputBuf
|
|
|
|
|
>STYA ZPInputBufPtr
|
|
|
|
|
|
|
|
|
|
* clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #E.STKOVERFLOW
|
|
|
|
|
* sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-10-08 12:37:10 +00:00
|
|
|
|
CORE.PopBuf phy
|
|
|
|
|
|
|
|
|
|
>LDA.G CODE.STACK
|
2022-10-07 19:21:37 +00:00
|
|
|
|
cmp #CODE.STACK
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
lda (pData),y
|
|
|
|
|
phy
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
ply
|
|
|
|
|
|
|
|
|
|
ldx #5
|
|
|
|
|
dey
|
|
|
|
|
|
2022-10-09 21:22:46 +00:00
|
|
|
|
.1 lda (pData),y ZPInputBuf
|
2022-10-07 19:21:37 +00:00
|
|
|
|
sta ZPInputBuf,x
|
2022-10-09 21:22:46 +00:00
|
|
|
|
dey ZPInputBufPtr
|
2022-10-07 19:21:37 +00:00
|
|
|
|
dex
|
2022-10-09 21:22:46 +00:00
|
|
|
|
bpl .1 ZPInputCmdPtr
|
2022-10-07 19:21:37 +00:00
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
>STA.G CODE.STACK
|
|
|
|
|
|
2022-10-08 12:37:10 +00:00
|
|
|
|
ply
|
|
|
|
|
|
2022-10-07 19:21:37 +00:00
|
|
|
|
* clc
|
|
|
|
|
rts
|
|
|
|
|
|
2022-10-08 12:37:10 +00:00
|
|
|
|
.9 ply
|
|
|
|
|
|
|
|
|
|
lda #E.STACKERROR
|
2022-10-07 19:21:37 +00:00
|
|
|
|
* sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2022-10-09 21:22:46 +00:00
|
|
|
|
CORE.SListGetData
|
|
|
|
|
>PUSHB (pData),y
|
|
|
|
|
>PUSHW ZPTmpW KeyID
|
|
|
|
|
>PUSHWZ Allocate
|
|
|
|
|
>PUSHWI $ffff All
|
|
|
|
|
>PUSHWZ from Start
|
|
|
|
|
>SYSCALL SListGetData X = hMem
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-01-28 16:33:30 +00:00
|
|
|
|
MAN
|
2020-05-26 14:23:09 +00:00
|
|
|
|
SAVE usr/src/bin/sh.s.core
|
|
|
|
|
LOAD usr/src/bin/sh.s
|
2019-01-28 16:33:30 +00:00
|
|
|
|
ASM
|