A2osX/BIN/ACOS.S.KW.txt

563 lines
8.5 KiB
Plaintext
Raw Permalink Normal View History

2021-04-08 20:30:18 +00:00
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
KW.ADDINT
KW.APPEND
KW.BYTE
KW.CLEAR
KW.CLOCK
KW.CLOSE
KW.COPY
KW.CREATE
KW.ECHO
KW.EDIT
2021-05-09 12:39:40 +00:00
lda #E.CSYN
sec
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.FILL
KW.FLAG
2021-08-05 11:35:37 +00:00
lda #E.CSYN
sec
rts
*--------------------------------------
* FOR var = exp1 TO exp2 STEP exp3 ... NEXT
*--------------------------------------
KW.FOR jsr CORE.GetNextCharNB
bcs .98
jsr CORE.CreateOrGetVar
bcs .99
lda VAR.TYPE
bne .97
jsr CORE.GetNextCharNB
bcs .98
cmp #'='
bne .98
jsr KW.GetIntExp
bcs .99
jsr CODE.LDVARDDRI
ldx #RT.IntSet.ID
jsr CODE.JSRRT set var = START value
>LDYA L.ACOS.KW
jsr CORE.LookupSkip
bcs .98
cpx #KWID.TO
bne .98
*--------------------------------------
jsr KW.PushCodePtr2CCS NEXT will JMP back here
*--------------------------------------
jsr CODE.LDVARDDRI
ldx #RT.IntGet.ID
jsr CODE.JSRRT get var value on stack
jsr KW.GetIntExp get exp2 on stack
bcs .99
ldx #FPU.iNE var value = exp 2 ?
jsr CODE.FPUCALL
jsr CODE.TESTTRUE
jsr KW.FalseJMP2CCS if false, exit after NEXT
>LDYA L.ACOS.KW
jsr CORE.Lookup
bcs .98
cpx #KWID.STEP
bne .1
lda #4
jsr CORE.SkipA skip "STEP"
jsr KW.GetIntExp get exp3 value on stack
bcs .99
bra .2
.1 ldy #1 push 1 on stack
ldx #0
jsr CODE.PUSHYXI
.2 ldy VAR.ADDR push Address to update by NEXT
ldx VAR.ADDR+1
jsr CODE.PUSHYXI
clc
lda #KWID.FOR
jmp KW.PushA2CCS
.97 lda #E.TMISMATCH
sec
rts
.98 lda #E.CSYN
sec
.99 rts
*--------------------------------------
KW.NEXT ldy pCCS
bmi .98
lda (pData),y
2021-08-05 11:35:37 +00:00
cmp #KWID.FOR
bne .98
jsr CODE.PULLYX pull var address from stack
ldx #RT.IntGet.ID will set VAR.ADDR
jsr CODE.JSRRT get var value on stack
ldx #FPU.iADD new value = value + STEP (on stack)
jsr CODE.FPUCALL
ldx #RT.IntUpd.ID
jsr CODE.JSRRT set var = new value
ldy pCCS
iny pull JMP FALSE address
lda (pData),y
sta ZPPtr1
iny
lda (pData),y
sta ZPPtr1+1
lda #$4C JMP abs ...
jsr CODE.EmitByte
iny ...to loop address
lda (pData),y
jsr CODE.EmitByte
iny
lda (pData),y
jsr CODE.EmitByte
lda ZPCodeBufPtr and finally update JMP FALSE
sta (ZPPtr1)
lda ZPCodeBufPtr+1
ldy #1
sta (ZPPtr1),y
lda pCCS
clc
adc #5
sta pCCS
clc
rts
.98
KW.TO
KW.STEP lda #E.NOFOR
sec
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.FREE
2021-04-10 17:17:40 +00:00
lda #E.CSYN
sec
2021-04-08 20:30:18 +00:00
rts
*--------------------------------------
2021-07-09 13:54:42 +00:00
KW.GET jsr CORE.GetNextCharNB
bcs .9
jsr CORE.CreateOrGetVar
bcs .99
2021-08-05 11:35:37 +00:00
2021-07-09 13:54:42 +00:00
ldx #RT.GET.ID
jsr CODE.JSRRT
2021-08-05 11:35:37 +00:00
jsr CODE.LDVARDDRI
2021-07-09 13:54:42 +00:00
ldx #RT.StrSet.ID
clc
2021-08-05 11:35:37 +00:00
jmp CODE.JSRRT
2021-07-09 13:54:42 +00:00
.9 lda #E.CSYN
sec
2021-08-05 11:35:37 +00:00
2021-07-09 13:54:42 +00:00
.99 rts
*--------------------------------------
2021-04-15 14:03:04 +00:00
KW.GOSUB lda #$20 JSR abs
bra KW.GOTO1
2021-04-10 17:17:40 +00:00
*--------------------------------------
2021-04-15 14:03:04 +00:00
KW.GOTO lda #$4C JMP abs
KW.GOTO1 jsr CODE.EmitByte
2021-04-10 17:17:40 +00:00
jsr CORE.GetNextCharNB
2021-04-08 20:30:18 +00:00
bcs .90
2021-08-05 11:35:37 +00:00
2021-04-15 14:03:04 +00:00
jsr CORE.GetLabel
2021-04-10 17:17:40 +00:00
bcc .1
2021-04-15 14:03:04 +00:00
jsr CORE.AddFWRef
bcs .99
2021-04-10 17:17:40 +00:00
2021-08-05 11:35:37 +00:00
.1 lda VAR.ADDR
2021-04-08 20:30:18 +00:00
jsr CODE.EmitByte
2021-08-05 11:35:37 +00:00
lda VAR.ADDR+1
2021-04-08 20:30:18 +00:00
clc
2021-04-10 17:17:40 +00:00
jmp CODE.EmitByte
2021-04-08 20:30:18 +00:00
.90 lda #E.CSYN
2021-04-15 14:03:04 +00:00
.99 rts
2021-04-08 20:30:18 +00:00
*--------------------------------------
KW.HOME ldx #8 CLRSCR
jsr CODE.LDXI
2021-08-05 11:35:37 +00:00
ldx #RT.OUTX.ID
clc
jmp CODE.JSRRT
2021-04-15 20:52:08 +00:00
*--------------------------------------
2021-08-05 11:35:37 +00:00
* IF exp THEN st1 ELSE st2
2021-04-15 20:52:08 +00:00
*--------------------------------------
2021-05-09 12:39:40 +00:00
KW.IF jsr EXP.Eval
bcs .99
2021-08-05 11:35:37 +00:00
lda EXP.TYPE
bne .98
2021-05-09 12:39:40 +00:00
2021-08-05 11:35:37 +00:00
jsr CODE.TESTTRUE
2021-05-09 12:39:40 +00:00
2021-08-05 11:35:37 +00:00
jsr KW.FalseJMP2CCS
2021-05-09 12:39:40 +00:00
lda #KWID.IF
clc
2021-08-05 11:35:37 +00:00
jmp KW.PushA2CCS
2021-05-09 12:39:40 +00:00
2021-08-05 11:35:37 +00:00
.98 lda #E.TMISMATCH
2021-05-09 12:39:40 +00:00
sec
2021-08-05 11:35:37 +00:00
.99 rts
2021-05-09 12:39:40 +00:00
*--------------------------------------
KW.ENDIF sec
.HS 90 BCC
*--------------------------------------
KW.ELSE clc
ldy pCCS
2021-08-05 11:35:37 +00:00
bmi .9
2021-05-09 12:39:40 +00:00
lda (pData),y
eor #KWID.IF
bne .9
iny
lda (pData),y
sta ZPPtr1
2021-08-05 11:35:37 +00:00
2021-05-09 12:39:40 +00:00
iny
lda (pData),y
sta ZPPtr1+1 ZPPtr1 = JMP if FALSE
bcs .5 ENDIF
lda #$4C JMP abs
jsr CODE.EmitByte
2021-08-05 11:35:37 +00:00
2021-05-09 12:39:40 +00:00
ldy pCCS
iny
2021-08-05 11:35:37 +00:00
2021-05-09 12:39:40 +00:00
lda ZPCodeBufPtr
sta (pData),y
iny
lda ZPCodeBufPtr+1
2021-08-05 11:35:37 +00:00
sta (pData),y
2021-05-09 12:39:40 +00:00
lda ZPCodeBufPtr
clc
adc #2
sta ZPCodeBufPtr
bcc .1
2021-08-05 11:35:37 +00:00
2021-05-09 12:39:40 +00:00
inc ZPCodeBufPtr+1
.1 lda ZPCodeBufPtr
sta (ZPPtr1)
lda ZPCodeBufPtr+1
ldy #1
sta (ZPPtr1),y
clc
rts
.5 lda ZPCodeBufPtr
sta (ZPPtr1)
2021-08-05 11:35:37 +00:00
2021-05-09 12:39:40 +00:00
ldy #1
lda ZPCodeBufPtr+1
sta (ZPPtr1),y
lda pCCS
clc
adc #3
sta pCCS
clc
rts
.9 lda #E.NOIF
2021-04-15 20:52:08 +00:00
sec
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.INFO
lda #E.CSYN
sec
rts
*--------------------------------------
KW.INPUT stz hIn Defaut to Keyboard
jsr CORE.GetNextCharNB
bcs .9
2021-08-05 11:35:37 +00:00
cmp #'"'
bne .5
2021-08-05 11:35:37 +00:00
jsr EXP.CreateStrConst
bcs .99
2021-08-05 11:35:37 +00:00
ldx #RT.StrOut.ID
jsr CODE.JSRRT
.5 jsr CORE.CreateOrGetVar
bcs .99
2021-08-05 11:35:37 +00:00
ldx #RT.INPUT.ID
jsr CODE.JSRRT
2021-08-05 11:35:37 +00:00
jsr CODE.LDVARDDRI
2021-07-09 13:54:42 +00:00
ldx #RT.StrSet.ID
clc
2021-07-09 20:40:57 +00:00
jmp CODE.JSRRT
.9 lda #E.CSYN
sec
2021-08-05 11:35:37 +00:00
.99 rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.KILL
KW.LINK
KW.LOG
KW.MARK
KW.MODEM
KW.MOVE
KW.MSG
2021-08-05 11:35:37 +00:00
lda #E.CSYN
sec
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.NIBBLE
KW.NOT
KW.ON
2021-08-05 11:35:37 +00:00
KW.NOCAR lda #E.CSYN
2021-06-03 17:43:28 +00:00
sec
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.OPEN
2021-06-03 17:43:28 +00:00
lda #E.CSYN
sec
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.POKE
KW.POP
KW.POSITION
2021-04-10 17:17:40 +00:00
lda #E.CSYN
sec
2021-04-08 20:30:18 +00:00
rts
*--------------------------------------
2021-08-05 11:35:37 +00:00
KW.PRINT stz ZPPtr2 put ending CR
stz hOut Default to screen
2021-04-08 20:30:18 +00:00
2021-08-05 11:35:37 +00:00
jsr CORE.GetCharNB
2021-04-08 20:30:18 +00:00
bcs .8
2021-08-05 11:35:37 +00:00
.11 cmp #'\'
bne .13
2021-08-05 11:35:37 +00:00
.12 ldx #RT.OUTCRLF.ID
jsr CODE.JSRRT
2021-08-05 11:35:37 +00:00
bra .72
.13 jsr CORE.IsEndInst
2021-04-08 20:30:18 +00:00
bcs .8
2021-08-05 11:35:37 +00:00
2021-05-09 12:39:40 +00:00
jsr CORE.IsKW
bcc .8
2021-04-10 17:17:40 +00:00
2021-08-05 11:35:37 +00:00
stz ZPPtr2 put ending CR
2021-05-09 12:39:40 +00:00
jsr EXP.Eval
2021-04-08 20:30:18 +00:00
bcs .99
2021-04-29 11:56:34 +00:00
lda EXP.TYPE
beq .6
2021-08-05 11:35:37 +00:00
ldx #RT.StrOut.ID
2021-04-29 11:56:34 +00:00
bra .7
.6 ldx #RT.IntOut.ID
.7 jsr CODE.JSRRT
2021-04-29 11:56:34 +00:00
*--------------------------------------
jsr CORE.GetCharNB
2021-04-08 20:30:18 +00:00
bcs .8
.70 cmp #'\'
beq .12
2021-08-05 11:35:37 +00:00
jsr CORE.IsEndInst
2021-04-08 20:30:18 +00:00
bcs .8
2021-05-09 12:39:40 +00:00
jsr CORE.IsKW
bcc .8
lda (ZPInputBufPtr)
2021-04-08 20:30:18 +00:00
cmp #','
bne .71
2021-04-10 17:17:40 +00:00
tax
jsr CODE.PutChar
2021-08-05 11:35:37 +00:00
bra .72 go skip
2021-04-08 20:30:18 +00:00
.71 cmp #';'
bne .90
2021-05-09 12:39:40 +00:00
ror ZPPtr2 suppress ending CR
2021-04-08 20:30:18 +00:00
2021-08-05 11:35:37 +00:00
.72 jsr CORE.GetNextCharNB skip "/", ";" or ","
2021-04-10 17:17:40 +00:00
bcc .11
2021-04-08 20:30:18 +00:00
2021-05-09 12:39:40 +00:00
.8 bit ZPPtr2
2021-04-10 17:17:40 +00:00
bmi .80
2021-08-05 11:35:37 +00:00
ldx #RT.OUTCRLF.ID
jsr CODE.JSRRT
2021-08-05 11:35:37 +00:00
2021-04-08 20:30:18 +00:00
.80 clc
rts
2021-08-05 11:35:37 +00:00
2021-04-08 20:30:18 +00:00
.90 lda #E.CSYN
sec
.99 rts
*--------------------------------------
KW.PUBLIC
KW.PUSH
KW.RAM
KW.RAM2
KW.READ
KW.READY
2021-04-10 17:17:40 +00:00
lda #E.CSYN
sec
rts
*--------------------------------------
2021-04-15 14:03:04 +00:00
KW.RETURN
* TODO : check context
KW.END lda #$60 RTS
2021-08-05 11:35:37 +00:00
2021-04-10 17:17:40 +00:00
clc
jmp CODE.EmitByte
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.REWIND
KW.RIPCO
KW.SET
KW.SETINT
KW.TEXT
2021-05-22 21:05:12 +00:00
lda #E.CSYN
sec
rts
*--------------------------------------
KW.THEN ldy pCCS
lda (pData),y
eor #KWID.IF
bne .9
2021-08-05 11:35:37 +00:00
2021-05-22 21:05:12 +00:00
clc
rts
2021-08-05 11:35:37 +00:00
2021-05-22 21:05:12 +00:00
.9 lda #E.NOIF
sec
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
KW.TONE
KW.UPDATE
KW.USE
KW.WHENd
KW.WRITE
2021-04-10 17:17:40 +00:00
lda #E.CSYN
sec
2021-04-08 20:30:18 +00:00
rts
*--------------------------------------
2021-08-05 11:35:37 +00:00
KW.GetIntExp jsr CORE.GetNextCharNB
bcs .98
jsr EXP.Eval
bcs .99
lda EXP.TYPE
beq .99
lda #E.TMISMATCH
sec
rts
.98 lda #E.CSYN
* sec
.99 rts
*--------------------------------------
KW.PushA2CCS ldy pCCS
dey
sta (pData),y
sty pCCS
rts
*--------------------------------------
KW.FalseJMP2CCS jsr KW.PushCodePtr2CCS
lda ZPCodeBufPtr
clc
adc #2
sta ZPCodeBufPtr
bcc .8
inc ZPCodeBufPtr+1
.8 rts
*--------------------------------------
KW.PushCodePtr2CCS
ldy pCCS
dey
lda ZPCodeBufPtr+1
sta (pData),y
dey
lda ZPCodeBufPtr
sta (pData),y
sty pCCS
rts
*--------------------------------------
2021-04-08 20:30:18 +00:00
MAN
SAVE usr/src/bin/acos.s.kw
LOAD usr/src/bin/acos.s
ASM