mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
191 lines
3.3 KiB
Plaintext
191 lines
3.3 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
* In: A = current CHAR
|
||
* Out: CC, longint on stack
|
||
*--------------------------------------
|
||
EXP.Eval lda EXP.AOPS
|
||
pha
|
||
|
||
lda #$FF
|
||
>PUSHA Previous OP = none
|
||
*--------------------------------------
|
||
.10 jsr CORE.GetCharNB
|
||
bcs .39
|
||
|
||
.11 cmp #'('
|
||
bne .20
|
||
|
||
jsr CORE.GetNextCharNB skip (
|
||
bcs .90
|
||
|
||
jsr EXP.Eval
|
||
bcs .99
|
||
|
||
jsr CORE.GetCharNB
|
||
bcs .90
|
||
|
||
cmp #')'
|
||
bne .90
|
||
|
||
jsr CORE.GetNextCharNB skip )
|
||
bra .41
|
||
*--------------------------------------
|
||
.20 jsr CORE.IsLetter
|
||
bcs .30 FN or VAR
|
||
|
||
>LDYA L.ACOS.FN
|
||
jsr CORE.Lookup
|
||
bcs .21
|
||
|
||
jsr EXP.FNjmpX
|
||
bcs .99
|
||
|
||
bra .40
|
||
|
||
.21 jsr EXP.VARLookup
|
||
bcs .99
|
||
|
||
>LDYA EXP.ADDR
|
||
jsr CODE.PUSHfYA
|
||
|
||
bra .40
|
||
*--------------------------------------
|
||
.30 jsr CORE.IsDigit10
|
||
.39 bcs .90
|
||
|
||
jsr EXP.Int32
|
||
bcs .99
|
||
*--------------------------------------
|
||
.40 jsr CORE.GetCharNB
|
||
.41 bcs .80
|
||
|
||
.50 jsr CORE.IsEndExp
|
||
bcs .80
|
||
|
||
jsr EXP.GetOP
|
||
bcs .90
|
||
|
||
stx EXP.AOPS
|
||
|
||
.61 lda (pStack) get op context
|
||
bmi .62 no prev op, go get arg2
|
||
|
||
cmp EXP.AOPS we have arg1 A=op1 arg2 X=op2
|
||
bcc .62
|
||
|
||
inc pStack prev op has precedence
|
||
|
||
tax
|
||
jsr EXP.OPjmpX go compute (arg1 op1 arg2)
|
||
|
||
.62 lda EXP.AOPS we must compute arg2 op2 arg3 before
|
||
>PUSHA
|
||
|
||
.63 jsr CORE.GetNextCharNB
|
||
bcc .11
|
||
|
||
bcs .90
|
||
*--------------------------------------
|
||
.80 >PULLA
|
||
tax
|
||
bmi .88 nothing to do
|
||
|
||
jsr EXP.OPjmpX
|
||
bra .80
|
||
|
||
.90 lda #E.ESYN
|
||
|
||
.99 tay Save Err code
|
||
|
||
>PULLA
|
||
tax
|
||
bpl .99
|
||
|
||
sec
|
||
.HS 90 BCC
|
||
.88 clc
|
||
|
||
pla
|
||
sta EXP.AOPS
|
||
|
||
tya
|
||
|
||
rts
|
||
*--------------------------------------
|
||
EXP.FNjmpX jmp (J.ACOS.FN,x)
|
||
EXP.OPjmpX jmp (J.ACOS.AOPS,x)
|
||
*--------------------------------------
|
||
EXP.GetOP jsr CORE.IsAOPSChar + - * /
|
||
bcc .9
|
||
|
||
>LDYA L.ACOS.AOPS MOD
|
||
jsr CORE.Lookup
|
||
bcs .9
|
||
|
||
txa
|
||
* clc
|
||
adc #ACOS.AOPSChars.Cnt*2
|
||
tax
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
EXP.Int32 >PUSHW ZPInputBufPtr
|
||
>PUSHWI ZPInputBufPtr
|
||
>PUSHBI 10
|
||
>SYSCALL StrToL
|
||
bcs .9
|
||
|
||
jsr CODE.PUSHINT32
|
||
|
||
>POP 4
|
||
|
||
clc
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
EXP.VARLookup >LDA.G hVars
|
||
|
||
>PUSHA
|
||
>PUSHA for SListGetData
|
||
|
||
>PUSHW ZPInputBufPtr
|
||
>SYSCALL SListLookup
|
||
bcs .9
|
||
|
||
>PUSHYA ZPSID
|
||
|
||
txa
|
||
jsr CORE.SkipA
|
||
|
||
.1 >PUSHWI EXP.ADDR
|
||
>PUSHWI 3 3 bytes : ADDR + TYPE
|
||
>PUSHWZ From Start
|
||
>SYSCALL SListGetData
|
||
rts
|
||
|
||
.9 >PULLA
|
||
rts
|
||
*--------------------------------------
|
||
EXP.ADD ldx #FPU.ADD32
|
||
jmp CODE.FPUCALL
|
||
|
||
EXP.SUB ldx #FPU.SUB32
|
||
jmp CODE.FPUCALL
|
||
|
||
EXP.MUL ldx #FPU.IMUL32
|
||
jmp CODE.FPUCALL
|
||
|
||
EXP.DIV ldx #FPU.IDIV32
|
||
jmp CODE.FPUCALL
|
||
|
||
EXP.MOD ldx #FPU.IMOD32
|
||
jmp CODE.FPUCALL
|
||
*--------------------------------------
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/acos.s.exp
|
||
LOAD usr/src/bin/acos.s
|
||
ASM
|