2021-04-08 20:30:18 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* In: A = current CHAR
|
2021-05-09 12:39:40 +00:00
|
|
|
|
* Out: CC, int16 on stack or pSTR in stack
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
EXP.Eval stz EXP.TYPE
|
|
|
|
|
|
|
|
|
|
EXP.Eval.R lda EXP.AOPS
|
2021-04-10 17:17:40 +00:00
|
|
|
|
pha
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
lda #$FF
|
|
|
|
|
>PUSHA Previous OP = none
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.10 jsr CORE.GetCharNB
|
|
|
|
|
bcs .39
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
.11 cmp #'('
|
2021-04-16 19:17:18 +00:00
|
|
|
|
bne .12
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
jsr CORE.GetNextCharNB skip (
|
2021-04-16 19:17:18 +00:00
|
|
|
|
bcs .39
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr EXP.Eval.R
|
2021-04-16 19:17:18 +00:00
|
|
|
|
bcs .39
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
jsr CORE.GetCharNB
|
2021-04-16 19:17:18 +00:00
|
|
|
|
bcs .39
|
2021-05-04 17:31:21 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
cmp #')'
|
2021-04-29 11:56:34 +00:00
|
|
|
|
sec
|
|
|
|
|
bne .39
|
2021-05-04 17:31:21 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
jsr CORE.GetNextCharNB skip )
|
|
|
|
|
bra .41
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-16 19:17:18 +00:00
|
|
|
|
.12 cmp #'"'
|
|
|
|
|
bne .20
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr EXP.CreateStrConst
|
2021-05-09 12:39:40 +00:00
|
|
|
|
bcs .37
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-16 19:17:18 +00:00
|
|
|
|
bra .40
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-10 17:17:40 +00:00
|
|
|
|
.20 jsr CORE.IsLetter
|
2021-05-09 12:39:40 +00:00
|
|
|
|
bcs .30 No, go check for number...
|
2021-04-10 17:17:40 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
>LDYA L.ACOS.KW Yes, KW, FN or VAR ?
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr CORE.Lookup
|
2021-05-09 12:39:40 +00:00
|
|
|
|
bcc .80 KW, end of exp
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
>LDYA L.ACOS.FN
|
|
|
|
|
jsr CORE.LookupSkip
|
2021-04-10 17:17:40 +00:00
|
|
|
|
bcs .21
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
jsr EXP.FNjmpX
|
|
|
|
|
|
2021-06-22 18:59:02 +00:00
|
|
|
|
bcs .99
|
2021-04-10 17:17:40 +00:00
|
|
|
|
bra .40
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
.21 jsr EXP.VARLookup
|
2021-05-22 21:05:12 +00:00
|
|
|
|
bcc .22
|
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
.22 ldx EXP.TYPE
|
|
|
|
|
bne .23
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr CODE.INTGET
|
|
|
|
|
|
|
|
|
|
bra .40
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
.23 jsr CODE.STRGET
|
2021-04-10 17:17:40 +00:00
|
|
|
|
|
|
|
|
|
bra .40
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.30 jsr CORE.IsDigit10
|
|
|
|
|
.39 bcs .90
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr EXP.Int16
|
2021-05-09 12:39:40 +00:00
|
|
|
|
.37 bcs .99
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-10 17:17:40 +00:00
|
|
|
|
.40 jsr CORE.GetCharNB
|
|
|
|
|
.41 bcs .80
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
.50 jsr CORE.IsEndExp
|
|
|
|
|
bcs .80
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
jsr CORE.IsKW
|
|
|
|
|
bcc .80
|
|
|
|
|
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr CORE.LookupOPS
|
2021-04-10 17:17:40 +00:00
|
|
|
|
bcs .90
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
stx EXP.AOPS
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
lda (pStack) get op context
|
|
|
|
|
bmi .60 no prev op, go get arg2
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
cmp EXP.AOPS we have arg1 A=op1 arg2 X=op2
|
2021-05-09 12:39:40 +00:00
|
|
|
|
bcc .60
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
inc pStack prev op has precedence
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-04 17:31:21 +00:00
|
|
|
|
tay
|
2021-05-09 12:39:40 +00:00
|
|
|
|
ldx ACOS.OPS2FPU,y
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr CODE.FPUCALL go compute (arg1 op1 arg2)
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
.60 lda EXP.AOPS we must compute arg2 op2 arg3 before
|
2021-04-10 17:17:40 +00:00
|
|
|
|
>PUSHA
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
jsr CORE.GetCharNB
|
2021-04-10 17:17:40 +00:00
|
|
|
|
bcs .90
|
2021-04-16 19:17:18 +00:00
|
|
|
|
jmp .11
|
2021-04-10 17:17:40 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.80 >PULLA
|
2021-05-04 17:31:21 +00:00
|
|
|
|
tay
|
2021-04-10 17:17:40 +00:00
|
|
|
|
bmi .88 nothing to do
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
ldx ACOS.OPS2FPU,y
|
2021-05-04 17:31:21 +00:00
|
|
|
|
jsr CODE.FPUCALL
|
2021-04-10 17:17:40 +00:00
|
|
|
|
bra .80
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
.90 lda #E.ESYN
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
.99 tay Save Err code
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.98 >PULLA
|
2021-04-10 17:17:40 +00:00
|
|
|
|
tax
|
2021-04-29 11:56:34 +00:00
|
|
|
|
bpl .98
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
sec
|
|
|
|
|
.HS 90 BCC
|
|
|
|
|
.88 clc
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
pla
|
|
|
|
|
sta EXP.AOPS
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-10 17:17:40 +00:00
|
|
|
|
tya
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXP.FNjmpX jmp (J.ACOS.FN,x)
|
2021-04-10 17:17:40 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
EXP.CreateStrConst
|
|
|
|
|
lda #'$'
|
|
|
|
|
sta EXP.TYPE
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
ldy #0
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-16 19:17:18 +00:00
|
|
|
|
.1 jsr CORE.GetNextChar
|
|
|
|
|
bcs .91
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-16 19:17:18 +00:00
|
|
|
|
cmp #'"'
|
|
|
|
|
beq .2
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-16 19:17:18 +00:00
|
|
|
|
sta (ZPConstBufPtr),y
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-16 19:17:18 +00:00
|
|
|
|
.2 lda #0
|
|
|
|
|
sta (ZPConstBufPtr),y
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
phy
|
|
|
|
|
>LDYA ZPConstBufPtr
|
|
|
|
|
jsr CODE.PUSHIYA
|
2021-04-16 19:17:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
pla
|
|
|
|
|
sec for \0
|
2021-04-16 19:17:18 +00:00
|
|
|
|
adc ZPConstBufPtr
|
|
|
|
|
sta ZPConstBufPtr
|
|
|
|
|
bcc .3
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-16 19:17:18 +00:00
|
|
|
|
inc ZPConstBufPtr+1
|
|
|
|
|
|
|
|
|
|
.3 jsr CORE.GetNextCharNB skip "
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-16 19:17:18 +00:00
|
|
|
|
.91 lda #E.ESYN
|
|
|
|
|
* sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
EXP.Int16 >PUSHW ZPInputBufPtr
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>PUSHWI ZPInputBufPtr
|
|
|
|
|
>PUSHBI 10
|
|
|
|
|
>SYSCALL StrToL
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr CODE.PUSHINT16
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>POP 4
|
|
|
|
|
|
|
|
|
|
clc
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
EXP.VARLookup >LDA.G hVars
|
|
|
|
|
|
|
|
|
|
>PUSHA
|
2021-05-22 21:05:12 +00:00
|
|
|
|
>PUSHA for SListGetData/SListAddData
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW ZPInputBufPtr
|
|
|
|
|
>SYSCALL SListLookup
|
2021-05-22 21:05:12 +00:00
|
|
|
|
bcs .3
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
>PUSHYA KeyID
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
txa
|
2021-04-11 19:47:48 +00:00
|
|
|
|
jsr CORE.SkipA
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
.1 >PUSHWI EXP.ADDR
|
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
|
2021-04-29 11:56:34 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
jsr CORE.GetVarType
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
cpx EXP.TYPE
|
|
|
|
|
bne .90
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
.90 lda #E.TMISMATCH
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.3 jsr CORE.NewVarKey
|
|
|
|
|
bcs .39
|
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
pha KeyID
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
jsr CORE.GetVarType
|
|
|
|
|
stx EXP.TYPE
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
beq .11
|
|
|
|
|
|
|
|
|
|
lda STRID
|
|
|
|
|
sta EXP.ADDR
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
lda STRID+1
|
|
|
|
|
sta EXP.ADDR+1
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
inc STRID
|
|
|
|
|
bne .10
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
inc STRID+1
|
2021-06-22 18:59:02 +00:00
|
|
|
|
bra .10
|
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
.11 lda ZPDataBufPtr
|
|
|
|
|
sta EXP.ADDR
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
clc
|
2021-05-22 21:05:12 +00:00
|
|
|
|
adc #2 Word
|
|
|
|
|
sta ZPDataBufPtr
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
lda ZPDataBufPtr+1
|
|
|
|
|
sta EXP.ADDR+1
|
|
|
|
|
adc #0
|
|
|
|
|
sta ZPDataBufPtr+1
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
2021-05-22 21:05:12 +00:00
|
|
|
|
.10 pla
|
|
|
|
|
>PUSHA
|
|
|
|
|
pla
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHWI EXP.ADDR
|
|
|
|
|
>PUSHWI 3 3 bytes : ADDR + TYPE
|
|
|
|
|
>SYSCALL SListAddData
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.39 inc pStack
|
2021-04-08 20:30:18 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/acos.s.exp
|
|
|
|
|
LOAD usr/src/bin/acos.s
|
|
|
|
|
ASM
|