A2osX/BIN/ACOS.S.EXP.txt

301 lines
4.7 KiB
Plaintext
Raw Normal View History

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
bcs .37
2021-05-22 21:05:12 +00:00
2021-07-09 13:54:42 +00:00
ldy EXP.ADDR
ldx EXP.ADDR+1
jsr CODE.LDYXI
2021-04-08 20:30:18 +00:00
ldx EXP.TYPE
2021-07-09 13:54:42 +00:00
bne .22
2021-06-22 18:59:02 +00:00
ldx #RT.IntGet.ID
2021-07-09 13:54:42 +00:00
bra .23
.22 ldx #RT.StrGet.ID
2021-04-10 17:17:40 +00:00
2021-07-09 13:54:42 +00:00
.23 jsr CODE.JSRRT
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-07-09 13:54:42 +00:00
jsr EXP.ComputeY go compute (arg1 op1 arg2)
bcs .90
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-07-09 13:54:42 +00:00
jsr EXP.ComputeY go compute (arg1 op1 arg2)
bcc .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
2021-07-09 13:54:42 +00:00
ldy ZPConstBufPtr
ldx ZPConstBufPtr+1
jsr CODE.PUSHYXI
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
2021-07-09 13:54:42 +00:00
bcs .9
2021-05-22 21:05:12 +00:00
2021-07-09 13:54:42 +00:00
>PUSHYA SID
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-07-09 13:54:42 +00:00
beq .4
2021-06-22 18:59:02 +00:00
2021-07-09 13:54:42 +00:00
jsr CORE.GetStr
bra .5
2021-06-22 18:59:02 +00:00
2021-07-09 13:54:42 +00:00
.4 jsr CORE.GetWord
.5 >STYA EXP.ADDR
2021-05-22 21:05:12 +00:00
>PUSHWI EXP.ADDR
>PUSHWI 3 3 bytes : ADDR + TYPE
>SYSCALL SListAddData
2021-07-09 13:54:42 +00:00
2021-05-22 21:05:12 +00:00
rts
2021-07-09 13:54:42 +00:00
.9 inc pStack discard extra hVars
rts
*--------------------------------------
EXP.ComputeY lda EXP.TYPE
2021-07-09 20:40:57 +00:00
2021-07-09 13:54:42 +00:00
bne .1
2021-05-22 21:05:12 +00:00
2021-07-09 13:54:42 +00:00
ldx ACOS.OPS2FPU,y
jsr CODE.FPUCALL
clc
rts
.1 cpy #3 +
2021-07-09 20:40:57 +00:00
bne .2
ldx #RT.StrAdd.ID
2021-07-09 20:40:57 +00:00
clc
jmp CODE.JSRRT
2021-07-09 20:40:57 +00:00
.2 stz EXP.TYPE at the end ....TRUE/FALSE is int
cpy #11 <>
2021-07-09 20:40:57 +00:00
bne .3
ldx #SYS.StrCmp
clc
jmp CODE.SYSCALL
.3 cpy #13 =
bne .9
ldx #SYS.StrCmp
jsr CODE.SYSCALL
ldx #RT.NOT.ID
clc
jmp CODE.JSRRT
.9 sec
2021-04-08 20:30:18 +00:00
rts
*--------------------------------------
MAN
SAVE usr/src/bin/acos.s.exp
LOAD usr/src/bin/acos.s
ASM