A2osX/BIN/ACOS.S.EXP.txt

242 lines
3.8 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-04-29 11:56:34 +00:00
* Out: CC, longint 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-05-04 17:31:21 +00:00
2021-04-10 17:17:40 +00:00
.11 cmp #'('
2021-04-16 19:17:18 +00:00
bne .12
2021-04-10 17:17:40 +00:00
jsr CORE.GetNextCharNB skip (
2021-04-16 19:17:18 +00:00
bcs .39
2021-04-10 17:17:40 +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-04-16 19:17:18 +00:00
.12 cmp #'"'
bne .20
2021-04-29 11:56:34 +00:00
jsr EXP.CreateStrConst
2021-04-16 19:17:18 +00:00
bcs .99
bra .40
2021-04-08 20:30:18 +00:00
*--------------------------------------
2021-04-10 17:17:40 +00:00
.20 jsr CORE.IsLetter
bcs .30 FN or VAR
>LDYA L.ACOS.FN
2021-04-08 20:30:18 +00:00
jsr CORE.Lookup
2021-04-29 11:56:34 +00:00
2021-04-10 17:17:40 +00:00
bcs .21
2021-04-08 20:30:18 +00:00
jsr EXP.FNjmpX
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-04-08 20:30:18 +00:00
bcs .99
2021-04-29 11:56:34 +00:00
ldx EXP.TYPE
bne .22
jsr CODE.INTGET
bra .40
.22 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-04-10 17:17:40 +00:00
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-05-04 17:31:21 +00:00
jsr CORE.LookupOPS
2021-04-10 17:17:40 +00:00
bcs .90
2021-04-08 20:30:18 +00:00
2021-04-10 17:17:40 +00:00
stx EXP.AOPS
2021-04-08 20:30:18 +00:00
2021-04-10 17:17:40 +00:00
.61 lda (pStack) get op context
bmi .62 no prev op, go get arg2
2021-04-08 20:30:18 +00:00
2021-04-10 17:17:40 +00:00
cmp EXP.AOPS we have arg1 A=op1 arg2 X=op2
bcc .62
2021-04-08 20:30:18 +00:00
2021-04-10 17:17:40 +00:00
inc pStack prev op has precedence
2021-05-04 17:31:21 +00:00
tay
ldx ACOS.OPS.MAP-1,y
jsr CODE.FPUCALL go compute (arg1 op1 arg2)
2021-04-10 17:17:40 +00:00
.62 lda EXP.AOPS we must compute arg2 op2 arg3 before
>PUSHA
2021-04-08 20:30:18 +00:00
2021-04-10 17:17:40 +00:00
.63 jsr CORE.GetNextCharNB
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-04 17:31:21 +00:00
ldx ACOS.OPS.MAP-1,y
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-04-08 20:30:18 +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-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
tya
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
ldy #0
2021-04-16 19:17:18 +00:00
.1 jsr CORE.GetNextChar
bcs .91
cmp #'"'
beq .2
sta (ZPConstBufPtr),y
iny
bne .1
.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
inc ZPConstBufPtr+1
.3 jsr CORE.GetNextCharNB skip "
clc
rts
.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-04-08 20:30:18 +00:00
>POP 4
clc
.9 rts
*--------------------------------------
EXP.VARLookup >LDA.G hVars
>PUSHA
>PUSHA for SListGetData
>PUSHW ZPInputBufPtr
>SYSCALL SListLookup
bcs .9
>PUSHYA ZPSID
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
ldx #0
jsr CORE.GetChar
bcs .2
cmp #'$'
bne .2
tax
jsr CORE.GetNextChar skip $
.2 cpx EXP.TYPE
bne .90
clc
2021-04-08 20:30:18 +00:00
rts
.9 >PULLA
2021-04-29 11:56:34 +00:00
.99 rts
.90 lda #E.TMISMATCH
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