A2osX/BIN/ACOS.S.CORE.txt

869 lines
14 KiB
Plaintext
Raw Normal View History

2021-04-08 20:30:18 +00:00
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
2021-05-09 12:39:40 +00:00
CORE.Init ldy #CCS.MAX
sty pCCS
>LDYAI CODESEG
2021-04-08 20:30:18 +00:00
>SYSCALL GetMem
bcs .9
>STYA ZPCodeBufPtr
txa
>STA.G hCodeBuf
>LDYAI CONSTSEG
>SYSCALL GetMem
bcs .9
>STYA ZPConstBufPtr
txa
>STA.G hConstBuf
>LDYAI DATASEG
>SYSCALL GetMem
bcs .9
>STYA ZPDataBufPtr
txa
>STA.G hDataBuf
>SYSCALL SListNew
bcs .9
>STA.G hLabels
>SYSCALL SListNew
bcs .9
>STA.G hVars
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
>LDYAI STRVSEG
>SYSCALL StrVNew
bcs .9
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
sta hStrings
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
>LDYAI 256
2021-04-15 14:03:04 +00:00
>SYSCALL GetMem
bcs .9
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
>STYA ZPStrBuf
txa
>STA.G hStrBuf
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
>LDYAI FWREF
>SYSCALL GetMem
2021-04-15 14:03:04 +00:00
>STYA ZPFWRefBufPtr
txa
>STA.G hFWRefBuf
2021-06-22 18:59:02 +00:00
2021-04-15 14:03:04 +00:00
lda #0
sta (ZPFWRefBufPtr)
2021-04-08 20:30:18 +00:00
clc
.9 rts
*--------------------------------------
2021-04-29 11:56:34 +00:00
CORE.Quit lda hStrings
2021-04-08 20:30:18 +00:00
beq .1
2021-04-29 11:56:34 +00:00
>SYSCALL StrVFree
2021-04-08 20:30:18 +00:00
2021-04-29 11:56:34 +00:00
.1 ldy #hStrBuf
jsr CORE.Quit.Freemem
2021-04-08 20:30:18 +00:00
2021-04-29 11:56:34 +00:00
ldy #hDataBuf
jsr CORE.Quit.Freemem
ldy #hConstBuf
jsr CORE.Quit.Freemem
ldy #hCodeBuf
jsr CORE.Quit.Freemem
2021-04-08 20:30:18 +00:00
*--------------------------------------
2021-04-29 11:56:34 +00:00
CORE.Cleanup ldy #hFWRefBuf
jsr CORE.Quit.Freemem
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
>LDA.G hVars
2021-04-08 20:30:18 +00:00
beq .1
>SYSCALL SListFree
>STZ.G hVars
.1 >LDA.G hLabels
beq .8
>SYSCALL SListFree
>STZ.G hLabels
.8 clc
CORE.Quit.RTS rts
*--------------------------------------
2021-04-29 11:56:34 +00:00
CORE.Quit.Freemem
lda (pData),y
beq .8
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
pha
lda #0
sta (pData),y
pla
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
>SYSCALL FreeMem
2021-06-22 18:59:02 +00:00
.8 rts
2021-04-29 11:56:34 +00:00
*--------------------------------------
2021-04-08 20:30:18 +00:00
CORE.Compile jsr CORE.GetChar
bcs CORE.Quit.RTS
cmp #'#'
beq .80 #/bin/acos....
cmp #';'
2021-05-09 12:39:40 +00:00
bne .1
2021-04-08 20:30:18 +00:00
2021-05-09 12:39:40 +00:00
.80 jmp CORE.SkipLine Comment: skip line...
.1 cmp #C.CR
2021-04-10 17:17:40 +00:00
beq .88 EOL
2021-04-08 20:30:18 +00:00
jsr CORE.CheckCharNB
2021-05-09 12:39:40 +00:00
bcs .2 CS=SPACE -> go check VAR or KW
2021-04-08 20:30:18 +00:00
jsr CORE.IsLetter LABEL must start with a letter
bcs .99
jsr CORE.CreateLabel
bcs .99
bra .8
*--------------------------------------
2021-05-09 12:39:40 +00:00
.2 jsr CORE.GetNextCharNB skip SPACE(s) or ":"
2021-04-08 20:30:18 +00:00
bcs .99
2021-05-09 12:39:40 +00:00
.21 cmp #C.CR
2021-04-10 17:17:40 +00:00
beq .88 EOL
2021-04-08 20:30:18 +00:00
jsr CORE.IsLetter
bcs .90
>LDYA L.ACOS.KW
2021-05-09 12:39:40 +00:00
jsr CORE.LookupSkip
2021-04-08 20:30:18 +00:00
bcs .3
2021-05-09 12:39:40 +00:00
jsr CORE.KW.JMP
bcs .99
2021-06-22 18:59:02 +00:00
2021-05-09 12:39:40 +00:00
bra .8
2021-04-08 20:30:18 +00:00
*--------------------------------------
.3 jsr CORE.CreateOrGetVar
2021-05-22 21:05:12 +00:00
bcs .99
2021-04-08 20:30:18 +00:00
jsr CORE.GetCharNB
bcs .90
cmp #'='
bne .90
jsr CORE.GetNextCharNB skip '='
bcs .90
2021-04-16 19:17:18 +00:00
jsr EXP.Eval ZPTYPE set by CreateOrGetVar
2021-04-08 20:30:18 +00:00
bcs .99
2021-04-29 11:56:34 +00:00
lda ZPTYPE
cmp EXP.TYPE
bne .91
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
tax
2021-04-16 19:17:18 +00:00
beq .4
2021-07-09 13:54:42 +00:00
ldy ZPADDR
ldx ZPADDR+1
jsr CODE.LDYXI
ldx #RT.StrSet.ID
jsr CODE.JSRRT Store String in hSTRV
2021-04-16 19:17:18 +00:00
bra .8
2021-07-09 13:54:42 +00:00
.4 ldy ZPADDR
ldx ZPADDR+1
jsr CODE.LDYXI
ldx #RT.IntSet.ID
jsr CODE.JSRRT Store Int16 result in DATASEG
2021-04-08 20:30:18 +00:00
*--------------------------------------
.8 jsr CORE.GetCharNB
2021-05-09 12:39:40 +00:00
bcs .88
2021-04-08 20:30:18 +00:00
cmp #':'
2021-05-09 12:39:40 +00:00
beq .2 go skip : and continue
2021-04-08 20:30:18 +00:00
2021-05-09 12:39:40 +00:00
bra .21
2021-04-08 20:30:18 +00:00
2021-05-09 12:39:40 +00:00
.88 ldy pCCS
bmi .89
2021-06-22 18:59:02 +00:00
2021-05-09 12:39:40 +00:00
jsr KW.ENDIF
bcs .99
2021-06-22 18:59:02 +00:00
2021-05-09 12:39:40 +00:00
.89 clc
2021-04-10 17:17:40 +00:00
jmp CORE.GetNextChar skip char
2021-04-08 20:30:18 +00:00
.90 lda #E.CSYN
sec
.99 rts
2021-04-29 11:56:34 +00:00
.91 lda #E.TMISMATCH
sec
rts
2021-04-08 20:30:18 +00:00
*--------------------------------------
2021-05-09 12:39:40 +00:00
CORE.KW.JMP jmp (J.ACOS.KW,x)
*--------------------------------------
CORE.FWREF >LDYA L.MSG.FWREF
>SYSCALL PutS
>LDA.G hFWRefBuf
2021-04-15 14:03:04 +00:00
>SYSCALL GetMemPtr
>STYA ZPInputBufPtr
2021-04-16 19:17:18 +00:00
2021-04-15 14:03:04 +00:00
.1 lda (ZPInputBufPtr)
beq .8
2021-06-22 18:59:02 +00:00
.2 sta ZPPtr1+1
2021-06-22 18:59:02 +00:00
2021-04-15 14:03:04 +00:00
jsr CORE.GetNextChar
sta ZPPtr1
2021-06-22 18:59:02 +00:00
2021-04-15 14:03:04 +00:00
jsr CORE.GetNextChar
2021-06-22 18:59:02 +00:00
2021-04-15 14:03:04 +00:00
jsr CORE.GetLabel
bcs .9
2021-06-22 18:59:02 +00:00
2021-04-15 14:03:04 +00:00
lda ZPADDR
sta (ZPPtr1)
ldy #1
lda ZPADDR+1
sta (ZPPtr1),y
2021-06-22 18:59:02 +00:00
jsr CORE.GetNextChar skip \0
bcc .2
2021-06-22 18:59:02 +00:00
2021-04-15 14:03:04 +00:00
.8 clc
rts
2021-06-22 18:59:02 +00:00
2021-04-15 14:03:04 +00:00
.9 >PUSHW L.MSG.FWREFERR
>PUSHW ZPInputBufPtr
>PUSHBI 2
>SYSCALL PrintF
lda #E.CSYN
2021-04-15 14:03:04 +00:00
sec
rts
*--------------------------------------
CORE.Run jsr CORE.Cleanup
2021-04-08 20:30:18 +00:00
2021-07-09 13:54:42 +00:00
>PUSHW L.MSG.RUN
2021-04-08 20:30:18 +00:00
lda ZPCodeBufPtr
sta ZPPtr1
lda ZPCodeBufPtr+1
sta ZPPtr1+1
>LDA.G hCodeBuf
>SYSCALL GetMemPtr
>STYA ZPCodeBufPtr
lda ZPPtr1
sec
sbc ZPCodeBufPtr
2021-07-09 13:54:42 +00:00
pha
2021-04-08 20:30:18 +00:00
lda ZPPtr1+1
2021-04-10 17:17:40 +00:00
sbc ZPCodeBufPtr+1
2021-07-09 13:54:42 +00:00
>PUSHA
pla
>PUSHA Code Size
lda ZPDataBufPtr
sta ZPPtr1
lda ZPDataBufPtr+1
sta ZPPtr1+1
>LDA.G hDataBuf
>SYSCALL GetMemPtr
>STYA ZPDataBufPtr
lda ZPPtr1
sec
sbc ZPDataBufPtr
pha
eor #$ff
sta ZPPtr2
lda ZPPtr1+1
sbc ZPDataBufPtr+1
>PUSHA
eor #$ff
2021-04-10 17:17:40 +00:00
sta ZPPtr2+1
2021-07-09 13:54:42 +00:00
pla
>PUSHA Data Size
2021-04-08 20:30:18 +00:00
2021-07-09 13:54:42 +00:00
>PUSHBI 4
2021-04-08 20:30:18 +00:00
>SYSCALL PrintF
2021-07-09 13:54:42 +00:00
lda #0
tay
.1 inc ZPPtr2
bne .2
inc ZPPtr2+1
beq .8
.2 sta (ZPDataBufPtr),y
iny
bne .1
inc ZPDataBufPtr+1
bra .1
.8 jmp (ZPCodeBufPtr)
2021-04-08 20:30:18 +00:00
*--------------------------------------
2021-05-04 17:31:21 +00:00
CORE.LookupOPS lda (ZPInputBufPtr)
jsr CORE.IsOPSChar
bcc .55
2021-06-22 18:59:02 +00:00
2021-05-04 17:31:21 +00:00
jsr CORE.IsLetter
bcs .99
2021-06-22 18:59:02 +00:00
2021-05-04 17:31:21 +00:00
sec
2021-06-22 18:59:02 +00:00
.55 ror bFlag
2021-05-04 17:31:21 +00:00
>LDYA L.ACOS.OPS
>STYA ZPPtr1
2021-04-08 20:30:18 +00:00
ldx #0
.1 ldy #$ff
2021-05-04 17:31:21 +00:00
.2 jsr .10 get next valid char in src text
bcs .4
2021-04-08 20:30:18 +00:00
2021-05-04 17:31:21 +00:00
jsr CORE.ToUpperCase
2021-04-08 20:30:18 +00:00
eor (ZPPtr1),y match table char ?
asl compare only 7 bits
2021-05-04 17:31:21 +00:00
bne .6 no match...get next table keyword
2021-04-08 20:30:18 +00:00
bcc .2 not last char in this keyword
2021-05-04 17:31:21 +00:00
jsr .10 next char in text...
2021-07-09 20:40:57 +00:00
bcc .6 valid....failed
2021-04-08 20:30:18 +00:00
2021-05-04 17:31:21 +00:00
.3 tya Keyword Len
2021-04-08 20:30:18 +00:00
2021-04-11 19:47:48 +00:00
jmp CORE.SkipA
2021-04-08 20:30:18 +00:00
2021-05-04 17:31:21 +00:00
.4 dey
2021-04-08 20:30:18 +00:00
lda (ZPPtr1),y was last char in this keyword ?
2021-05-04 17:31:21 +00:00
bmi .3
2021-04-08 20:30:18 +00:00
iny
2021-05-04 17:31:21 +00:00
.5 jsr CORE.IncPtr1 skip chars to next keyword
2021-04-08 20:30:18 +00:00
2021-05-04 17:31:21 +00:00
.6 lda (ZPPtr1)
bpl .5
2021-04-08 20:30:18 +00:00
jsr CORE.IncPtr1
inx
lda (ZPPtr1) Array Ending 0, lookup failed
bne .1
.9 sec
rts
2021-05-04 17:31:21 +00:00
*--------------------------------------
.10 iny
lda (ZPInputBufPtr),y Get Src text char...
beq .19 end of text
bit bFlag
bmi .11 Letter expected
jmp CORE.IsOPSChar
.11 jmp CORE.IsLetter
2021-06-22 18:59:02 +00:00
.19 sec
.99 rts
2021-05-04 17:31:21 +00:00
*--------------------------------------
2021-05-09 12:39:40 +00:00
CORE.LookupSkip sec
.HS 90 BCC
CORE.Lookup clc
php
>STYA ZPPtr1
2021-05-04 17:31:21 +00:00
ldx #0
.1 ldy #$ff
.2 jsr .10 get next valid char in src text
bcs .4
jsr CORE.ToUpperCase
eor (ZPPtr1),y match table char ?
asl compare only 7 bits
bne .6 no match...get next table keyword
bcc .2 not last char in this keyword
2021-04-08 20:30:18 +00:00
2021-05-04 17:31:21 +00:00
jsr .10 next char in text...
2021-07-09 13:54:42 +00:00
bcc .6 valid....failed
2021-05-04 17:31:21 +00:00
2021-05-09 12:39:40 +00:00
.3 plp
bcc .8
2021-06-22 18:59:02 +00:00
2021-05-09 12:39:40 +00:00
tya Keyword Len
2021-05-04 17:31:21 +00:00
jmp CORE.SkipA
.4 dey
lda (ZPPtr1),y was last char in this keyword ?
bmi .3
iny
.5 jsr CORE.IncPtr1 skip chars to next keyword
.6 lda (ZPPtr1)
bpl .5
jsr CORE.IncPtr1
inx
inx
lda (ZPPtr1) Array Ending 0, lookup failed
bne .1
2021-05-09 12:39:40 +00:00
plp
2021-05-04 17:31:21 +00:00
.9 sec
2021-05-09 12:39:40 +00:00
.8 rts
2021-05-04 17:31:21 +00:00
*--------------------------------------
.10 iny
2021-04-08 20:30:18 +00:00
lda (ZPInputBufPtr),y Get Src text char...
beq .9 end of text
2021-04-29 11:56:34 +00:00
cmp #'$'
2021-05-04 17:31:21 +00:00
bne .11
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
clc
rts
2021-05-04 17:31:21 +00:00
.11 jmp CORE.IsLetterOrDigit CS=end of valid chars
2021-04-08 20:30:18 +00:00
*--------------------------------------
CORE.IncPtr1 inc ZPPtr1
bne .8
inc ZPPtr1+1
.8 rts
*--------------------------------------
CORE.CreateLabel
>LDA.G hLabels
jsr CORE.NewKey
bcs .9
2021-05-22 21:05:12 +00:00
>STYA ZPSID
2021-04-08 20:30:18 +00:00
>PUSHB.G hLabels
>PUSHW ZPSID
>PUSHWI ZPCodeBufPtr
2021-04-11 19:47:48 +00:00
>PUSHWI 2 2 bytes : ADDR
2021-04-08 20:30:18 +00:00
>SYSCALL SListAddData
.9 rts
*--------------------------------------
2021-04-15 14:03:04 +00:00
CORE.GetLabel >PUSHB.G hLabels
>PUSHW ZPInputBufPtr
>SYSCALL SListLookup
bcs .9
>STYA ZPSID
txa
jsr CORE.SkipA
>PUSHB.G hLabels
>PUSHW ZPSID
>PUSHWI ZPADDR
>PUSHWI 2 2 bytes : ADDR
>PUSHWZ From Start
>SYSCALL SListGetData
.9 rts
*--------------------------------------
CORE.AddFWRef lda ZPCodeBufPtr+1
jsr CORE.2FWRefBuf
lda ZPCodeBufPtr
jsr CORE.2FWRefBuf
ldy #$ff
.1 iny
lda (ZPInputBufPtr),y
beq .8
jsr CORE.IsIDValid
bcs .8
2021-06-22 18:59:02 +00:00
2021-04-15 14:03:04 +00:00
jsr CORE.2FWRefBuf
bra .1
.8 tya
jsr CORE.SkipA
lda #0
clc
*--------------------------------------
CORE.2FWRefBuf sta (ZPFWRefBufPtr)
inc ZPFWRefBufPtr
bne .8
inc ZPFWRefBufPtr+1
.8 rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
CORE.CreateOrGetVar
>LDA.G hVars
jsr CORE.GetAddr
2021-04-29 11:56:34 +00:00
bcc .2
2021-04-08 20:30:18 +00:00
2021-05-22 21:05:12 +00:00
jsr CORE.NewVarKey
2021-04-29 11:56:34 +00:00
bcs .99
2021-06-22 18:59:02 +00:00
2021-05-22 21:05:12 +00:00
>STYA ZPSID
2021-06-22 18:59:02 +00:00
2021-05-22 21:05:12 +00:00
jsr CORE.GetVarType
stx ZPTYPE
2021-04-08 20:30:18 +00:00
2021-05-22 21:05:12 +00:00
beq .1
2021-04-29 11:56:34 +00:00
2021-07-09 13:54:42 +00:00
jsr CORE.GetStr
2021-06-22 18:59:02 +00:00
bra .10
2021-07-09 13:54:42 +00:00
.1 jsr CORE.GetWord
.10 >STYA ZPADDR
2021-04-08 20:30:18 +00:00
2021-07-09 13:54:42 +00:00
>PUSHB.G hVars
2021-04-29 11:56:34 +00:00
>PUSHW ZPSID
>PUSHWI ZPADDR
>PUSHWI 3 3 bytes : ADDR + TYPE
>SYSCALL SListAddData
rts
*--------------------------------------
2021-05-22 21:05:12 +00:00
.2 jsr CORE.GetVarType
2021-04-16 19:17:18 +00:00
2021-05-22 21:05:12 +00:00
cpx ZPTYPE
2021-04-29 11:56:34 +00:00
bne .90
2021-04-16 19:17:18 +00:00
2021-04-29 11:56:34 +00:00
clc
rts
2021-06-22 18:59:02 +00:00
2021-04-29 11:56:34 +00:00
.90 lda #E.TMISMATCH
2021-06-22 18:59:02 +00:00
sec
2021-04-29 11:56:34 +00:00
.99 rts
2021-04-08 20:30:18 +00:00
*--------------------------------------
2021-05-22 21:05:12 +00:00
CORE.NewVarKey >LDA.G hVars
2021-06-22 18:59:02 +00:00
2021-04-08 20:30:18 +00:00
CORE.NewKey >PUSHA
>PUSHW ZPInputBufPtr
>SYSCALL SListNewKey
2021-05-22 21:05:12 +00:00
bcs .9
2021-04-08 20:30:18 +00:00
2021-05-22 21:05:12 +00:00
pha
2021-04-08 20:30:18 +00:00
txa
2021-05-22 21:05:12 +00:00
jsr CORE.SkipA
2021-06-22 18:59:02 +00:00
2021-05-22 21:05:12 +00:00
pla Y,A = KeyID
clc
2021-06-22 18:59:02 +00:00
.9 rts
2021-04-08 20:30:18 +00:00
*--------------------------------------
CORE.GetAddr >PUSHA
>PUSHA for SListGetData
>PUSHW ZPInputBufPtr
>SYSCALL SListLookup
bcs .9
>STYA ZPSID
txa
2021-04-11 19:47:48 +00:00
jsr CORE.SkipA
2021-04-08 20:30:18 +00:00
.1 >PUSHW ZPSID
>PUSHWI ZPADDR
2021-04-11 19:47:48 +00:00
>PUSHWI 3 3 bytes : ADDR + TYPE
2021-04-08 20:30:18 +00:00
>PUSHWZ From Start
>SYSCALL SListGetData
rts
2021-04-11 19:47:48 +00:00
.9 >POP 1
2021-05-22 21:05:12 +00:00
rts
*--------------------------------------
CORE.GetVarType jsr CORE.GetChar
bcs .9
2021-06-22 18:59:02 +00:00
2021-05-22 21:05:12 +00:00
cmp #'$'
bne .9
2021-06-22 18:59:02 +00:00
2021-05-22 21:05:12 +00:00
inc ZPInputBufPtr
bne .1
2021-05-22 21:05:12 +00:00
inc ZPInputBufPtr+1 skip $
.1 tax NZ
2021-04-08 20:30:18 +00:00
rts
2021-05-22 21:05:12 +00:00
.9 ldx #0 Z
2021-06-22 18:59:02 +00:00
rts
2021-04-08 20:30:18 +00:00
*--------------------------------------
2021-07-09 13:54:42 +00:00
CORE.GetWord lda ZPDataBufPtr
tay
clc
adc #2 Word
sta ZPDataBufPtr
lda ZPDataBufPtr+1
bcc .8
inc ZPDataBufPtr+1
clc
.8 rts
*--------------------------------------
CORE.GetStr >LDYA STRID
inc STRID
bne .8
inc STRID+1
.8 clc
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
CORE.ToUpperCase
cmp #'a'
bcc .8
cmp #'z'+1
bcs .8
eor #$20
.8
CORE.ToUpperCase.RTS
rts
*--------------------------------------
2021-05-04 17:31:21 +00:00
CORE.IsOPSChar phx
2021-06-22 18:59:02 +00:00
2021-05-04 17:31:21 +00:00
ldx #ACOS.OPSChars.Cnt-1
2021-04-08 20:30:18 +00:00
2021-05-04 17:31:21 +00:00
.1 cmp ACOS.OPSChars,x
2021-04-08 20:30:18 +00:00
beq .8
2021-06-22 18:59:02 +00:00
2021-05-04 17:31:21 +00:00
dex
bpl .1
2021-06-22 18:59:02 +00:00
2021-05-04 17:31:21 +00:00
plx
sec
2021-04-08 20:30:18 +00:00
rts
2021-06-22 18:59:02 +00:00
2021-05-04 17:31:21 +00:00
.8 plx
clc
2021-04-08 20:30:18 +00:00
rts
*--------------------------------------
2021-05-09 12:39:40 +00:00
CORE.IsKW jsr CORE.IsLetter
bcs .9
>LDYA L.ACOS.KW
jmp CORE.Lookup
.9 rts
*--------------------------------------
CORE.IsEndExp cmp #')' CS = true
2021-04-10 17:17:40 +00:00
beq CORE.ToUpperCase.RTS
cmp #','
2021-04-08 20:30:18 +00:00
beq CORE.ToUpperCase.RTS
cmp #';'
beq CORE.ToUpperCase.RTS
cmp #'\'
beq CORE.ToUpperCase.RTS
2021-05-09 12:39:40 +00:00
CORE.IsEndInst cmp #':' CS = true
2021-04-08 20:30:18 +00:00
beq .8
2021-06-22 18:59:02 +00:00
2021-04-08 20:30:18 +00:00
cmp #C.CR
beq .8
clc
.8 rts
*---------------------------------------
2021-04-15 14:03:04 +00:00
CORE.IsIDValid cmp #'.'
clc
beq CORE.IsLetterRTS
*---------------------------------------
2021-04-08 20:30:18 +00:00
CORE.IsLetterOrDigit
jsr CORE.IsDigit10
bcc CORE.IsLetterRTS
*---------------------------------------
2021-05-09 12:39:40 +00:00
CORE.IsLetter cmp #'_' CC = true
2021-04-08 20:30:18 +00:00
bne .1
clc
rts
.1 cmp #'A'
bcc .9
cmp #'Z'+1
bcc CORE.IsLetterRTS
cmp #'a'
bcc .9
cmp #'z'+1
rts CC if lowercase
.9 sec
CORE.IsLetterRTS
rts
*---------------------------------------
CORE.IsDigit10 cmp #'0'
bcc .9
cmp #'9'+1
rts cc if ok, cs if not
.9 sec
rts
*--------------------------------------
2021-06-22 18:59:02 +00:00
CORE.CheckOP jsr CORE.GetCharNB
bcs CORE.CheckCP.CSYN
cmp #'('
bne CORE.CheckCP.CSYN
jsr CORE.GetNextCharNB skip (
clc
rts
*--------------------------------------
CORE.CheckComma jsr CORE.GetCharNB
bcs CORE.CheckCP.CSYN
cmp #','
bne CORE.CheckCP.CSYN
jsr CORE.GetNextCharNB skip ,
clc
rts
*--------------------------------------
CORE.CheckCP jsr CORE.GetCharNB
bcs CORE.CheckCP.CSYN
cmp #')'
bne CORE.CheckCP.CSYN
jsr CORE.GetNextCharNB skip )
clc
rts
CORE.CheckCP.CSYN
lda #E.CSYN
sec
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
CORE.CheckCharNB
cmp #C.SPACE
beq .9
cmp #C.LF
beq .9
cmp #C.TAB
beq .9
clc
.9 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
*--------------------------------------
2021-04-11 19:47:48 +00:00
CORE.SkipA clc
adc ZPInputBufPtr
sta ZPInputBufPtr
bcc .1
clc
inc ZPInputBufPtr+1
.1 rts Exit with CC for JMP to
*--------------------------------------
2021-04-08 20:30:18 +00:00
CORE.SkipLine jsr CORE.GetNextChar
bcs CORE.GetNextCharNB.RTS
cmp #C.CR
bne CORE.SkipLine
*--------------------------------------
CORE.GetNextChar
inc ZPInputBufPtr
bne CORE.GetChar
inc ZPInputBufPtr+1
*--------------------------------------
CORE.GetChar lda (ZPInputBufPtr)
bne .8
lda #MLI.E.EOF
sec
rts
.8 clc
rts
*--------------------------------------
MAN
SAVE usr/src/bin/acos.s.core
LOAD usr/src/bin/acos.s
ASM