A2osX/BIN/SH.S.STK.txt
burniouf 9a7d20a7e1 ProDOS 203 / FX:TC mod for year 2022-2026
FORMAT: new switches & checks
SH:BREAK in FOR and WHILE
ASM / S-C MASM: new directives, CString support and .HX
LC / UC:bugfix
DHGR.DRV:bugfix
LIBGUI:wip
CC:wip
2022-12-07 08:02:29 +01:00

189 lines
3.1 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*--------------------------------------
STK.PopCtx jsr STK.Pull
STK.PopCtxA and #$3F
cmp #C.IF
beq .8 IF : Nothing
ldx #2
cmp #C.WHILE WHILE : One Ptr = 2 bytes
beq STK.PopX
cmp #C.SWITCH SWITCH : hValue
beq .2
ldx #1
cmp #C.CASE CASE : C.CASE + hValue
beq .1
cmp #C.FOR
beq .3
cmp #C.DEFAULT DEFAULT : C.DEFAULT + hValue
bne .9
.1 jsr STK.PopX
.2 jsr STK.PullFree
.8 clc
rts
.3 jsr STK.Pull Get FOR sub cmd
beq .4 FOR List
jsr STK.PullFree hVARNAME
jsr STK.PullFClose hFILE/hPIPE
ldx #2 CmdPtr
jmp STK.PopX
.4 jsr STK.PullFree hVARNAME
jsr STK.PullFClose hFILE/hPIPE
ldx #4 ListPtr,CmdPtr
jmp STK.PopX
.9 lda #E.STACKERROR
sec
rts
*--------------------------------------
STK.PopX lda (pData)
.1 dec
dex
bne .1
sta (pData)
clc
rts
*--------------------------------------
STK.Check sec
adc (pData) StackPtr
cmp #CORE.STACK.MAX
bcc .8
lda #E.STKOVERFLOW
* sec
.8 rts
*--------------------------------------
STK.PushYAX phx
jsr STK.PushYA
bcc STK.Push.1
plx
rts
*--------------------------------------
STK.PushInputBufPtr
>LDYA ZPInputBufPtr
*--------------------------------------
STK.PushYA phy
jsr STK.Push
bcc STK.Push.1
plx
rts
*--------------------------------------
CORE.PushVarName
>LDYA ZPVarNamePtr
>SYSCALL StrDup
bcs STK.Push.RTS
txa
*--------------------------------------
STK.Push pha
STK.Push.1 lda (pData) StackPtr
inc
cmp #CORE.STACK.MAX
bcs .9
sta (pData) StackPtr
tay
pla
sta (pData),y
* clc
rts
.9 pla
lda #E.STKOVERFLOW
* sec
STK.Push.RTS
rts
*--------------------------------------
STK.GetCtx jsr STK.Get
tax
bcs .1 no context...
cmp #$C0+C.. in a call...
beq .1 CS
cmp #$C0+C.CALL
beq .1 CS
cmp #$C0+C.CLEXEC
beq .1 CS
and #$80 get current..
lsr becomes parent
bra .8
.1 lda #$40 ...set Parent = true
.8 sta CORE.TestResult
txa
rts
*--------------------------------------
STK.PullInputBufPtr
jsr STK.Pull
bcs .9
sta ZPInputBufPtr
jsr STK.Pull
bcs .9
sta ZPInputBufPtr+1
.9 rts
*--------------------------------------
STK.PullFClose jsr STK.Pull
>SYSCALL FClose
rts
*--------------------------------------
STK.PullFree jsr STK.Pull
>SYSCALL FreeMem
rts
*--------------------------------------
STK.Pull jsr STK.Get
bcs .9
dey
pha
tya
sta (pData) StackPtr
pla
.9 rts
*--------------------------------------
STK.Get lda (pData) StackPtr
beq .9
tay
lda (pData),y
clc
rts
.9 lda #E.STACKERROR
sec
rts
*--------------------------------------
MAN
SAVE usr/src/bin/sh.s.stk
LOAD usr/src/bin/sh.s
ASM