A2osX/BIN/CSH.S.KW.txt

271 lines
4.3 KiB
Plaintext
Raw Normal View History

2020-08-02 12:19:43 +00:00
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
* Built in Keywords
*--------------------------------------
CSH.KW.JMP txa
>STA.G CSH.CmdSave
jmp (J.CSH.KW,x)
*--------------------------------------
CSH.WHILE
CSH.IF jsr CSH.GetCharNB
bcs .9
2021-05-14 20:58:20 +00:00
2020-08-02 12:19:43 +00:00
cmp #'('
bne .9
2021-05-14 20:58:20 +00:00
2020-08-02 12:19:43 +00:00
jsr CSH.GetNextCharNB
bcs .9
2021-05-30 20:34:03 +00:00
ldy #0 Any var type
lda #0
2020-08-02 12:19:43 +00:00
jsr CSH.ExpEval
bcs .99
2021-05-14 20:58:20 +00:00
2021-05-30 20:34:03 +00:00
jsr CSH.IsValue0 result in X
2020-08-02 12:19:43 +00:00
jsr CSH.GetCharNB
bcs .99
2021-05-14 20:58:20 +00:00
2020-08-02 12:19:43 +00:00
cmp #')'
bne .9
2021-05-14 20:58:20 +00:00
2020-08-02 12:19:43 +00:00
jsr CSH.GetNextCharNB skip ')'
2021-05-30 20:34:03 +00:00
bcs .9
2021-05-14 20:58:20 +00:00
2020-08-02 12:19:43 +00:00
cmp #'{'
bne .9
2021-05-14 20:58:20 +00:00
2020-08-02 12:19:43 +00:00
jsr CSH.GetNextCharNB Skip '{'
2021-05-30 20:34:03 +00:00
bcs .9
2020-08-02 12:19:43 +00:00
2021-05-30 20:34:03 +00:00
txa
beq .6 Value=0, skip {{....}}
2020-08-02 12:19:43 +00:00
>LDA.G CSH.CmdSave
beq .1 IF
pha
>LDA.G CSH.BufPtrSave+1 WHILE : push loop address...
jsr CSH.Push
>LDA.G CSH.BufPtrSave
jsr CSH.Push
pla
.1 jsr CSH.Push
bcs .99
2021-05-14 20:58:20 +00:00
2020-08-02 12:19:43 +00:00
lda #'}' Tell '}' is expected at the end of block
jsr CSH.Push
2021-05-30 20:34:03 +00:00
.99 rts
2020-08-02 12:19:43 +00:00
.6 jsr CSH.SkipBlock
bcc .99
2021-05-30 20:34:03 +00:00
2021-05-04 17:31:21 +00:00
.9 lda #E.CSYN
2020-08-02 12:19:43 +00:00
sec
2021-05-30 20:34:03 +00:00
rts
2020-08-02 12:19:43 +00:00
*--------------------------------------
CSH.IF.END clc
rts
*--------------------------------------
CSH.WHILE.END jsr CSH.Pop
2020-12-23 14:54:57 +00:00
sta ZPInputBufPtr
2020-08-02 12:19:43 +00:00
jsr CSH.Pop
2020-12-23 14:54:57 +00:00
sta ZPInputBufPtr+1
2020-08-02 12:19:43 +00:00
clc
rts
*--------------------------------------
CSH.ELSE
*--------------------------------------
CSH.DO
CSH.FOR
CSH.SWITCH
CSH.CASE
CSH.BREAK
CSH.CONTINUE
CSH.SIZEOF
2021-01-12 21:14:13 +00:00
*--------------------------------------
2021-05-04 17:31:21 +00:00
CSH.TYPEDEF lda #E.CSYN
2020-08-02 12:19:43 +00:00
sec
rts
*--------------------------------------
CSH.STRUCT >ENTER 4
jsr CSH.GetCharNB
bcs .99
>LDA.G CSH.hTags
jsr CSH.NewKey
bcs .99
2021-05-30 20:34:03 +00:00
sta (pStack) Y,A = KeyID
tya
ldy #1
sta (pStack),y
2020-08-02 12:19:43 +00:00
jsr CSH.GetNextCharNB
bcs .99
2021-05-30 20:34:03 +00:00
2020-08-02 12:19:43 +00:00
cmp #'{'
bne .99
.1 jsr CSH.GetNextCharNB
bcs .99
2021-05-30 20:34:03 +00:00
2020-08-02 12:19:43 +00:00
cmp #'}'
bne .1
jsr CSH.GetNextCharNB skip }
clc
.99 >LEAVE
rts
*--------------------------------------
2021-05-30 20:34:03 +00:00
* Type Declaration keywords
*--------------------------------------
CSH.CONST ldy #1
2021-01-12 21:14:13 +00:00
2021-05-30 20:34:03 +00:00
lda (pStack),y
ora #CSH.Q.CONST
sta (pStack),y
jsr CSH.CheckSpace
bcs .9
2021-05-22 21:05:12 +00:00
>LDYA L.CSH.TMODS2
jsr CSH.LookupID
bcs .9
2021-05-30 20:34:03 +00:00
jmp (J.CSH.TMODS2,x)
2021-01-12 21:14:13 +00:00
2021-05-04 17:31:21 +00:00
.9 lda #E.CSYN
2021-01-12 21:14:13 +00:00
sec
rts
2020-08-02 12:19:43 +00:00
*--------------------------------------
CSH.SIGNED sec
.HS 90 BCC
*--------------------------------------
CSH.UNSIGNED clc
php
jsr CSH.CheckSpace
bcs .9
2021-01-12 21:14:13 +00:00
>LDYA L.CSH.TYPES
2020-08-02 12:19:43 +00:00
jsr CSH.LookupID
bcs .9
2021-05-30 20:34:03 +00:00
cpx #CSH.T.UCHAR
bcc .9 void
2021-01-12 21:14:13 +00:00
2021-05-30 20:34:03 +00:00
cpx #CSH.T.SLONG+1 only char int long allowed
2021-01-12 21:14:13 +00:00
bcs .9
2020-08-02 12:19:43 +00:00
plp
bcs .8
2021-01-12 21:14:13 +00:00
jmp (J.CSH.UTYPES-2,x)
.8 jmp (J.CSH.STYPES-2,x)
2020-08-02 12:19:43 +00:00
.9 plp
2020-12-23 14:54:57 +00:00
2021-05-04 17:31:21 +00:00
lda #E.CSYN
2020-08-02 12:19:43 +00:00
sec
rts
*--------------------------------------
2020-12-23 14:54:57 +00:00
CSH.SHORT jsr CSH.CheckSpace
bcs .9
2021-01-12 21:14:13 +00:00
>LDYA L.CSH.TYPES
2020-12-23 14:54:57 +00:00
jsr CSH.LookupID
bcs CSH.UCHAR
2021-01-12 21:14:13 +00:00
cpx #4 only int allowed
beq CSH.SCHAR
2020-12-23 14:54:57 +00:00
2021-05-04 17:31:21 +00:00
.9 lda #E.CSYN
2020-12-23 14:54:57 +00:00
sec
rts
*--------------------------------------
2021-05-30 20:34:03 +00:00
CSH.VOID lda #CSH.T.VOID
2020-08-02 12:19:43 +00:00
bra CSH.TYPE
2021-01-12 21:14:13 +00:00
CSH.CHAR
2021-05-30 20:34:03 +00:00
CSH.UCHAR lda #CSH.T.UCHAR
2020-08-02 12:19:43 +00:00
bra CSH.TYPE
2021-05-30 20:34:03 +00:00
CSH.SCHAR lda #CSH.T.SCHAR
2020-08-02 12:19:43 +00:00
bra CSH.TYPE
2021-01-12 21:14:13 +00:00
2021-05-30 20:34:03 +00:00
CSH.UINT lda #CSH.T.UINT
2020-08-02 12:19:43 +00:00
bra CSH.TYPE
2021-05-30 20:34:03 +00:00
CSH.INT
CSH.SINT lda #CSH.T.SINT
2020-08-02 12:19:43 +00:00
bra CSH.TYPE
2021-01-12 21:14:13 +00:00
2021-05-30 20:34:03 +00:00
CSH.ULONG lda #CSH.T.ULONG
2020-08-02 12:19:43 +00:00
bra CSH.TYPE
2021-05-30 20:34:03 +00:00
CSH.LONG
CSH.SLONG lda #CSH.T.SLONG
bra CSH.TYPE
CSH.FLOAT lda #CSH.T.FLOAT
2020-08-02 12:19:43 +00:00
2021-05-30 20:34:03 +00:00
CSH.TYPE sta (pStack)
2020-12-23 14:54:57 +00:00
2021-05-30 20:34:03 +00:00
jsr CSH.GetCharNB
2020-08-02 12:19:43 +00:00
bcs .9
2021-05-30 20:34:03 +00:00
ldy #1
.1 cmp #'*'
2020-08-02 12:19:43 +00:00
bne .10
2021-05-30 20:34:03 +00:00
lda (pStack),y
2020-12-23 14:54:57 +00:00
clc
adc #CSH.Q.POINTER
2021-05-30 20:34:03 +00:00
bcs .9 more than ***
sta (pStack),y
jsr CSH.GetNextCharNB
bcc .1
2020-12-23 14:54:57 +00:00
2021-05-30 20:34:03 +00:00
.9 lda #E.CSYN
sec
.99 rts
2020-08-02 12:19:43 +00:00
.10 jsr CSH.IsLetter
2021-05-22 21:05:12 +00:00
bcs .8
2020-08-02 12:19:43 +00:00
2020-12-23 14:54:57 +00:00
>LDYA L.CSH.FTYPES
jsr CSH.LookupID
2021-05-22 21:05:12 +00:00
bcs .8 next char is an identifier
2020-12-23 14:54:57 +00:00
sec
ror bFastCall
2021-05-30 20:34:03 +00:00
ldy #1
lda (pStack),y
ora #CSH.Q.FUNC
sta (pStack),y
2020-08-02 12:19:43 +00:00
2021-05-22 21:05:12 +00:00
jsr CSH.GetNextCharNB
bcs .9 next char is an identifier, ",", "(",")"
2020-08-02 12:19:43 +00:00
.8 clc
rts
*--------------------------------------
MAN
SAVE usr/src/bin/csh.s.kw
LOAD usr/src/bin/csh.s
ASM