A2osX/BIN/SH.S.CORE.txt

736 lines
13 KiB
Plaintext
Raw Normal View History

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
.LIST OFF
*--------------------------------------
2019-02-01 16:32:29 +00:00
CORE.Init >LDYAI 256
2019-01-31 16:34:02 +00:00
>SYSCALL GetMem
bcs .9
>STYA ZPArgVBuf
txa
>STA.G CORE.hArgVBuf
2019-03-13 16:29:24 +00:00
2019-01-31 16:34:02 +00:00
.9 rts
*--------------------------------------
2019-04-01 15:24:01 +00:00
CORE.Quit >LDA.G CORE.hArgVBuf
beq CORE.FUNCRESET
2019-01-28 16:33:30 +00:00
>SYSCALL FreeMem
2019-04-01 15:24:01 +00:00
CORE.FUNCRESET >LDA.G hFuncList
beq CORE.Quit.9
>SYSCALL SListFree
>STZ.G hFuncList
CORE.Quit.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
*--------------------------------------
2019-02-03 21:58:26 +00:00
* Input : ZPArgVBuf (String)
* Tokenize ZPArgVBuf
2019-02-01 16:32:29 +00:00
* :LOOP
* if CmdSep=| :
* 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
*--------------------------------------
2019-03-14 16:51:02 +00:00
CORE.Run.SYN lda #E.SYN
2019-02-11 06:58:33 +00:00
sec
rts
2019-01-28 16:33:30 +00:00
2019-02-07 16:52:25 +00:00
CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
>STYA ZPInputCmdPtr
2019-02-08 16:13:43 +00:00
>LDYA ZPArgVBuf
>STYA ZPArgVBufPtr
2019-02-11 16:44:56 +00:00
lda #0 Reset ArgV Buffer
sta (ZPArgVBuf)
2019-04-15 05:40:13 +00:00
lda #S.PS.F.HOLD
2019-02-11 16:44:56 +00:00
>STA.G CORE.PSFlags
2019-02-11 06:58:33 +00:00
lda #$ff
2019-04-01 06:07:56 +00:00
2019-02-11 06:58:33 +00:00
>STA.G CORE.IntCmd assume external
2019-04-01 06:07:56 +00:00
2019-02-07 16:52:25 +00:00
jsr CORE.GetCharNB
2019-02-18 16:23:10 +00:00
bcc .11
2019-04-01 15:24:01 +00:00
2019-04-04 15:44:20 +00:00
lda #0 EOF
jsr CMD.EXIT.A
2019-04-01 15:24:01 +00:00
bcs .9
2019-02-18 16:23:10 +00:00
jsr IO.Reset
lda #0
sec
rts Ending 0, CS,A=0
2019-02-07 16:52:25 +00:00
2019-02-19 11:30:45 +00:00
.11 cmp #'|'
bne .21
jsr IO.Pipe.In
bcs .9
jsr CORE.GetNextCharNB Skip |
2019-03-14 16:51:02 +00:00
bcs CORE.Run.SYN
2019-02-19 11:30:45 +00:00
bra .3
.21 pha
jsr IO.Reset
pla
2019-03-14 16:51:02 +00:00
.3 cmp #C.CR empty line ?
bne .33
2019-02-14 14:51:24 +00:00
2019-03-14 16:51:02 +00:00
jsr CORE.GetNextChar skip CR...
bra .8
.33 cmp #'#' commented line?
2019-02-07 16:52:25 +00:00
bne .2
2019-03-14 16:51:02 +00:00
.12 jsr CORE.SkipLine
2019-02-11 16:44:56 +00:00
2019-02-18 16:23:10 +00:00
.8 jsr IO.Reset
lda #0
2019-02-14 14:51:24 +00:00
clc
2019-02-19 11:30:45 +00:00
.9 rts EOL, CS,A=0
2019-02-11 06:58:33 +00:00
2019-03-14 16:51:02 +00:00
.2 >LDA.G bFuncMode
2019-04-03 11:46:50 +00:00
bpl .4
2019-03-13 16:29:24 +00:00
2019-03-18 06:53:20 +00:00
jmp CORE.AddFunc
2019-04-01 06:07:56 +00:00
2019-02-11 06:58:33 +00:00
.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-02-11 16:44:56 +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
.41 jsr CORE.SkipCharsA
2019-02-11 16:44:56 +00:00
2019-02-11 06:58:33 +00:00
txa
>STA.G CORE.IntCmd
2019-03-05 16:49:34 +00:00
2019-03-04 16:44:33 +00:00
.42 jsr CORE.StkGet
2019-03-15 16:20:28 +00:00
bcs CORE.Run.7 no particular context, exec...
2019-03-04 16:44:33 +00:00
tax
>LDA.G CORE.IntCmd
bmi .45
2019-03-04 16:46:46 +00:00
and #$3F
2019-03-12 16:50:16 +00:00
cmp #C.SWITCH SWITCH....FI ?
2019-03-15 16:20:28 +00:00
bcs CORE.Run.7
2019-03-02 20:47:58 +00:00
2019-03-04 16:44:33 +00:00
.45 txa
bpl .43 context is FALSE, skip line
asl
2019-03-15 16:20:28 +00:00
bmi CORE.Run.7 parent context is true, exec
2019-03-04 16:44:33 +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
cmp #';' TODO ";"
2019-03-04 22:20:26 +00:00
beq .44
jsr CORE.GetNextChar
bra .43
2019-03-02 20:47:58 +00:00
.44 jsr CORE.GetNextCharNB Skip EoL char
clc
2019-03-05 16:49:34 +00:00
.99 rts
2019-03-14 16:51:02 +00:00
*--------------------------------------
2019-03-15 16:20:28 +00:00
CORE.Run.5 >LDYA L.CORE.IO
2019-02-11 16:44:56 +00:00
jsr CORE.LookupInputBuf
2019-03-15 16:20:28 +00:00
bcs CORE.Run.6
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
bcs CORE.Run.RTS
2019-03-15 16:20:28 +00:00
bra CORE.Run.7
2019-02-11 06:58:33 +00:00
2019-03-15 16:20:28 +00:00
CORE.Run.6 jsr CORE.ArgV.Add
2019-02-07 16:52:25 +00:00
2019-03-15 16:20:28 +00:00
CORE.Run.7 jsr CORE.GetCharNB
2019-02-11 16:44:56 +00:00
bcs CORE.ExecCmd.1 Nothing to skip
2019-02-07 16:52:25 +00:00
2019-02-11 06:58:33 +00:00
jsr CORE.IsEndCmd
2019-03-15 16:20:28 +00:00
bcs CORE.Run.5
2019-02-11 06:58:33 +00:00
2019-02-11 16:44:56 +00:00
cmp #'|'
bne CORE.ExecCmd skip CR, ;
2019-02-11 06:58:33 +00:00
jsr IO.Pipe.Out
bcs CORE.Run.RTS
2019-02-18 12:52:10 +00:00
jsr CORE.IO.AMP run in background
2019-02-11 06:58:33 +00:00
2019-02-11 16:44:56 +00:00
bra CORE.ExecCmd.1 Do not skip |
2019-02-07 16:52:25 +00:00
CORE.Run.RTS rts
*--------------------------------------
2019-02-11 06:58:33 +00:00
* Input : ZPArgVBuf
*--------------------------------------
2019-02-11 16:44:56 +00:00
CORE.ExecCmd jsr CORE.GetNextCharNB Skip EoL char
CORE.ExecCmd.1 lda #0
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
>LDA.G CORE.IntCmd
bmi CORE.ExecExtCmd
2019-04-01 06:07:56 +00:00
asl
2019-02-11 06:58:33 +00:00
tax
jmp (J.CMD,x)
2019-02-14 14:51:24 +00:00
2019-04-03 15:52:24 +00:00
CORE.ExecExtCmd >PUSHB.G CORE.PSFlags
2019-02-18 12:52:10 +00:00
>LDYA ZPArgVBuf
2019-02-01 16:32:29 +00:00
>SYSCALL execv
2019-02-15 16:38:17 +00:00
CORE.ExecExtCmd.Exit
2019-01-28 16:33:30 +00:00
bcs .9
2019-02-01 16:32:29 +00:00
tax CPID
2019-01-28 16:33:30 +00:00
2019-02-01 16:32:29 +00:00
>LDA.G CORE.PSFlags
and #S.PS.F.HOLD
bne .4
txa
>PUSHA
>PUSHBI 1
2019-02-25 14:47:31 +00:00
>PUSHW L.MSG.PID
ldy #S.PS.hStdErr
lda (pPS),y
>SYSCALL fprintf
2019-02-01 16:32:29 +00:00
rts
.4 >SLEEP Suspend this PID
2019-01-28 16:33:30 +00:00
2019-02-01 16:32:29 +00:00
sec
ldy #S.PS.RC CPID will update S.PS.RC
lda (pPs),y
bne .9
2019-01-28 16:33:30 +00:00
2019-02-01 16:32:29 +00:00
.8 clc
.9 rts
*--------------------------------------
2019-06-07 15:02:51 +00:00
CORE.AddFunc >LDYA L.ENDCMD
2019-05-31 20:04:41 +00:00
jsr CORE.LookupInputBuf
bcs .8
2019-03-14 16:51:02 +00:00
2019-03-18 06:53:20 +00:00
.7 lda #0
2019-03-14 16:51:02 +00:00
>STA.G bFuncMode
2019-03-18 06:53:20 +00:00
jsr .8 add "END"
bcs .9
2019-03-14 16:51:02 +00:00
jmp CMD.END.FUNC Cleanup Stk
2019-03-18 06:53:20 +00:00
2019-03-14 16:51:02 +00:00
.9 jmp CORE.Run.SYN
.8 ldy #0
.80 lda (ZPInputBufPtr),y
iny
beq .82
cmp #C.CR
bne .80
.82 lda #0
>PUSHYA DataLen
>PUSHW ZPInputBufPtr DataPtr
lda (pData)
tay
dey skip C.FUNC
lda (pData),y KeyID
>PUSHA
dey
lda (pData),y KeyID
>PUSHA
>LDA.G hFuncList
>SYSCALL SListAddData
bcs .9
*--------------------------------------
CORE.SkipLine jsr CORE.GetNextCharNB
bcs .8 EOF
cmp #C.CR EOL
bne CORE.SkipLine
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
>STYA ZPPtr1
>LDYA ZPInputBufPtr
bra CORE.Lookup
CORE.LookupArgVBuf
>STYA ZPPtr1
>LDYA ZPArgVBufPtr
CORE.Lookup >STYA ZPPtr2
2019-02-07 16:52:25 +00:00
ldx #0
2019-02-11 16:44:56 +00:00
.1 ldy #$ff
2019-02-07 16:52:25 +00:00
.2 iny
2019-02-11 16:44:56 +00:00
lda (ZPPtr2),y
2019-02-07 16:52:25 +00:00
beq .3 Src Keyword end
2019-02-08 16:13:43 +00:00
jsr CORE.IsSpaceOrEndCmd
2019-02-07 16:52:25 +00:00
bcc .3 Src Keyword end
lda (ZPPtr1),y
beq .4 Table Keyword end
2019-02-12 16:47:34 +00:00
lda (ZPPtr2),y
2019-03-05 16:49:34 +00:00
jsr ToUpperCase
2019-02-12 16:47:34 +00:00
2019-03-05 16:49:34 +00:00
cmp (ZPPtr1),y
2019-02-07 16:52:25 +00:00
beq .2
bra .4
.3 lda (ZPPtr1),y
bne .4
2019-02-11 16:44:56 +00:00
tya Keyword Len
2019-03-04 22:20:26 +00:00
dey
2019-02-11 16:44:56 +00:00
clc
2019-02-07 16:52:25 +00:00
.8 rts
.4 inc ZPPtr1
bne .5
inc ZPPtr1+1
.5 lda (ZPPtr1)
bne .4
inc ZPPtr1
bne .6
inc ZPPtr1+1
2019-02-11 16:44:56 +00:00
.6 inx
2019-02-07 16:52:25 +00:00
lda (ZPPtr1) Array Ending 0, must be an external Cmd....
bne .1
2019-03-05 16:49:34 +00:00
lda #E.SYN
2019-02-12 16:47:34 +00:00
sec
2019-02-11 06:58:33 +00:00
rts
*--------------------------------------
* ArgV
*--------------------------------------
2019-04-02 15:28:50 +00:00
CORE.ArgV.Dup >STYA ZPPtr1
phy
pha
lda #1
sta ZPPtr2
stz ZPPtr2+1
.1 lda (ZPPtr1)
beq .4
ldy #0
.2 iny
lda (ZPPtr1),y
bne .2
2019-04-03 15:52:24 +00:00
jsr CORE.ArgV.DupNextY
2019-04-02 15:28:50 +00:00
bra .1
.4 pla
ply
>STYA ZPPtr1
>LDYA ZPPtr2
>SYSCALL GetMem
bcs .9
>STYA ZPPtr2
2019-04-05 15:21:05 +00:00
lda #$ff Arg count-1 (skip $0)
pha
2019-04-02 15:28:50 +00:00
.5 lda (ZPPtr1)
sta (ZPPtr2)
beq .8
2019-04-05 15:21:05 +00:00
pla
inc
pha
2019-04-02 15:28:50 +00:00
ldy #0
.6 iny
lda (ZPPtr1),y
sta (ZPPtr2),y
bne .6
2019-04-03 15:52:24 +00:00
jsr CORE.ArgV.DupNextY
bra .5
2019-04-02 15:28:50 +00:00
2019-04-05 15:21:05 +00:00
.8 pla Arg count
clc
2019-04-03 15:52:24 +00:00
.9 rts
*--------------------------------------
CORE.ArgV.DupNextY
2019-04-02 15:28:50 +00:00
tya
sec
adc ZPPtr1
sta ZPPtr1
2019-04-03 15:52:24 +00:00
bcc .1
2019-04-02 15:28:50 +00:00
inc ZPPtr1+1
2019-04-03 15:52:24 +00:00
.1 tya
2019-04-02 15:28:50 +00:00
sec
adc ZPPtr2
sta ZPPtr2
2019-04-03 15:52:24 +00:00
bcc .8
2019-04-02 15:28:50 +00:00
inc ZPPtr2+1
2019-04-03 15:52:24 +00:00
.8 rts
2019-04-02 15:28:50 +00:00
*--------------------------------------
2019-02-12 16:47:34 +00:00
CORE.ArgV.Add >LDYA ZPArgVBufPtr
>STYA ZPArgVBufPrev Save String start of Expand
2019-02-11 16:44:56 +00:00
2019-02-15 16:38:17 +00:00
lda #C.SPACE
2019-04-01 06:07:56 +00:00
sta M32.TMP
2019-02-15 16:38:17 +00:00
2019-02-12 16:47:34 +00:00
jsr CORE.GetCharNB
bcs .9
2019-02-15 16:38:17 +00:00
cmp #'"'
bne .10
2019-04-01 06:07:56 +00:00
sta M32.TMP
2019-02-15 16:38:17 +00:00
bra .1
2019-02-12 16:47:34 +00:00
2019-03-07 16:48:30 +00:00
.10 cmp #'('
2019-02-15 16:38:17 +00:00
bne .11
2019-03-07 20:40:06 +00:00
ldx #')'
2019-04-01 06:07:56 +00:00
stx M32.TMP
2019-03-07 20:40:06 +00:00
2019-03-07 16:48:30 +00:00
bra .12
.11 cmp #'`'
bne .12
2019-04-01 06:07:56 +00:00
sta M32.TMP
2019-02-11 06:58:33 +00:00
2019-03-07 16:48:30 +00:00
.12 jsr CORE.ArgV.PutChar
2019-02-11 06:58:33 +00:00
2019-02-15 16:38:17 +00:00
.1 jsr CORE.GetNextChar
bcs .5
2019-02-11 06:58:33 +00:00
2019-04-01 06:07:56 +00:00
.2 cmp M32.TMP
2019-02-18 16:05:40 +00:00
bne .3
jsr CORE.GetNextChar
bra .5
2019-02-11 06:58:33 +00:00
2019-04-01 06:07:56 +00:00
.3 ldy M32.TMP
2019-02-21 11:34:28 +00:00
cpy #C.SPACE
bne .40
jsr CORE.IsEndCmd
bcc .5
.40 jsr CORE.ArgV.PutChar
2019-02-11 06:58:33 +00:00
.4 jsr CORE.GetNextChar
2019-02-15 16:38:17 +00:00
bcc .2
2019-02-11 06:58:33 +00:00
2019-02-12 16:47:34 +00:00
.5 lda #0
jsr CORE.ArgV.PutChar
>LDYA ZPArgVBufPrev
>SYSCALL ExpandStr
bcs .9
phx
>STYA ZPPtr1
>LDYA ZPArgVBufPrev
>STYA ZPArgVBufPtr
ldy #$ff
2019-02-15 16:38:17 +00:00
.7 iny
2019-02-12 16:47:34 +00:00
lda (ZPPtr1),y
2019-03-01 14:36:20 +00:00
beq .8
2019-02-12 16:47:34 +00:00
jsr CORE.ArgV.PutChar
2019-03-01 14:36:20 +00:00
bra .7
2019-02-12 16:47:34 +00:00
2019-03-01 14:36:20 +00:00
.8 tya
beq .81
lda #0
jsr CORE.ArgV.PutChar
.81 pla
2019-02-12 16:47:34 +00:00
>SYSCALL freemem
.9 rts
2019-02-11 06:58:33 +00:00
*--------------------------------------
CORE.ArgV.PutChar
sta (ZPArgVBufPtr)
CORE.ArgV.NextChar
inc ZPArgVBufPtr
bne .8
2019-02-11 16:44:56 +00:00
inc ZPArgVBufPtr+1
2019-02-11 06:58:33 +00:00
.8 rts
*--------------------------------------
CORE.ArgV.Next lda (ZPArgVBufPtr)
beq .8
2019-02-14 14:51:24 +00:00
>LDYA ZPArgVBufPtr
>STYA ZPArgVBufPrev
2019-02-11 06:58:33 +00:00
.1 jsr CORE.ArgV.NextChar
lda (ZPArgVBufPtr)
bne .1
jsr CORE.ArgV.NextChar
lda (ZPArgVBufPtr)
.8 rts
*--------------------------------------
* 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.AMP >LDA.G CORE.PSFlags
and #$ff^S.PS.F.HOLD
sta (pData),y
clc
CORE.IO.RTS rts
CORE.IO.IN lda #O.RDONLY+O.TEXT
jsr CORE.IO.Open
bcs CORE.IO.RTS
jmp IO.Set.In
CORE.IO.OUTA
CORE.IO.1OUTA lda #O.WRONLY+O.APPEND+O.CREATE+O.TEXT
bra CORE.IO.OUT.1
CORE.IO.OUT
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
CORE.IO.2OUT lda #O.WRONLY+O.TRUNC+O.CREATE+O.TEXT
CORE.IO.2OUT.1 jsr CORE.IO.Open
bcs CORE.IO.RTS
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
2019-06-07 15:02:51 +00:00
>PUSHWZ Aux type
2019-02-11 06:58:33 +00:00
>PUSHBI S.FI.T.TXT ftype
pla
>PUSHA flags
2019-02-18 12:52:10 +00:00
>LDYA ZPArgVBufPrev
>STYA ZPArgVBufPtr Discard filename
2019-02-11 06:58:33 +00:00
>SYSCALL fopen
2019-02-07 16:52:25 +00:00
rts
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
rts
*--------------------------------------
* 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
2019-02-21 11:34:28 +00:00
CORE.IsEndCmd cmp #';'
2019-02-08 16:13:43 +00:00
beq CORE.IsEndCmd.8
2019-02-21 11:34:28 +00:00
cmp #C.CR
2019-02-08 16:13:43 +00:00
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
2019-02-07 16:52:25 +00:00
sec
rts
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
jsr CORE.CheckCharNB
bcc CORE.GetNextCharNB.RTS
*--------------------------------------
CORE.GetNextCharNB
jsr CORE.GetNextChar
bcs CORE.GetNextCharNB.RTS
jsr CORE.CheckCharNB
bcs CORE.GetNextCharNB
CORE.GetNextCharNB.RTS
rts
*--------------------------------------
CORE.CheckCharNB
cmp #C.SPACE
beq .9
cmp #C.LF
beq .9
cmp #C.TAB
beq .9
clc
.9 rts
*--------------------------------------
CORE.GetNextChar
inc ZPInputBufPtr
bne CORE.GetChar
inc ZPInputBufPtr+1
*--------------------------------------
CORE.GetChar lda (ZPInputBufPtr)
beq .9
clc
rts
2019-01-28 16:33:30 +00:00
.9 sec
rts
*--------------------------------------
2019-02-11 16:44:56 +00:00
CORE.SkipCharsA clc
adc ZPInputBufPtr
sta ZPInputBufPtr
bcc .8
inc ZPInputBufPtr+1
.8 rts
*--------------------------------------
2019-02-11 06:58:33 +00:00
* Stack
*--------------------------------------
2019-04-03 15:52:24 +00:00
CORE.StkCheck sec
adc (pData) StackPtr
cmp #CORE.STACK.MAX
2019-05-31 07:31:41 +00:00
2019-04-03 15:52:24 +00:00
lda #E.STKOVERFLOW
rts
*--------------------------------------
2019-05-31 07:31:41 +00:00
CORE.StkPushYAX phx
jsr CORE.StkPushYA
bcs CORE.StkPushYA.9
2019-03-05 16:49:34 +00:00
2019-05-31 07:31:41 +00:00
bra CORE.StkPush.1
2019-01-28 16:33:30 +00:00
*--------------------------------------
2019-04-03 11:46:50 +00:00
CORE.StkPushYA phy
jsr CORE.StkPush
2019-05-31 07:31:41 +00:00
bcc CORE.StkPush.1
CORE.StkPushYA.9
plx
rts
2019-04-03 11:46:50 +00:00
*--------------------------------------
2019-01-31 16:34:02 +00:00
CORE.StkPush pha
2019-05-31 07:31:41 +00:00
CORE.StkPush.1 lda (pData) StackPtr
2019-01-28 16:33:30 +00:00
inc
cmp #CORE.STACK.MAX
beq .9
sta (pData) StackPtr
tay
pla
sta (pData),y
* clc
rts
.9 pla
lda #E.STKOVERFLOW
* sec
rts
*--------------------------------------
2019-03-08 16:36:21 +00:00
CORE.StkGetCtx jsr CORE.StkGet
tax
bcs .1 no context...
2019-04-01 15:24:01 +00:00
cmp #$C0 in a call...
beq .1 CS
2019-03-08 16:36:21 +00:00
and #$80 get current..
lsr becomes parent
bra .2
.1 lda #$40 ...set Parent = true
.2 >STA.G CORE.Test
2019-04-01 15:24:01 +00:00
2019-03-08 16:36:21 +00:00
txa
rts
*--------------------------------------
2019-05-31 07:31:41 +00:00
CORE.StkPullInputBufPtr
2019-04-04 15:44:20 +00:00
jsr CORE.StkPull
2019-05-31 07:31:41 +00:00
bcs .9
2019-04-04 15:44:20 +00:00
sta ZPInputBufPtr
2019-05-31 07:31:41 +00:00
jsr CORE.StkPull
bcs .9
sta ZPInputBufPtr+1
.9 rts
2019-04-04 15:44:20 +00:00
*--------------------------------------
2019-01-31 16:34:02 +00:00
CORE.StkPull jsr CORE.StkGet
2019-01-28 16:33:30 +00:00
bcs .9
dey
pha
tya
sta (pData) StackPtr
pla
.9 rts
*--------------------------------------
CORE.StkGet lda (pData) StackPtr
2019-02-12 16:47:34 +00:00
beq CORE.StkErr
2019-01-28 16:33:30 +00:00
tay
lda (pData),y
clc
rts
*--------------------------------------
2019-05-31 07:31:41 +00:00
CORE.StkErr lda #E.STACKERROR
sec
rts
*--------------------------------------
2019-01-28 16:33:30 +00:00
MAN
2019-02-08 16:13:43 +00:00
SAVE USR/SRC/BIN/SH.S.CORE
LOAD USR/SRC/BIN/SH.S
2019-01-28 16:33:30 +00:00
ASM