2021-04-08 20:30:18 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF bin/acos
|
|
|
|
|
*--------------------------------------
|
2021-04-10 17:17:40 +00:00
|
|
|
|
CODESEG .EQ 4096
|
2021-04-08 20:30:18 +00:00
|
|
|
|
CONSTSEG .EQ 1024
|
|
|
|
|
DATASEG .EQ 256
|
2021-04-29 11:56:34 +00:00
|
|
|
|
STRVSEG .EQ 2048
|
2021-04-15 14:03:04 +00:00
|
|
|
|
FWREF .EQ 1024
|
2021-04-10 17:17:40 +00:00
|
|
|
|
EXP.DEPTH.MAX .EQ 16
|
2021-05-09 12:39:40 +00:00
|
|
|
|
CCS.MAX .EQ 128
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/mli.i
|
|
|
|
|
.INB inc/mli.e.i
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Zero Page Segment, up to 32 bytes
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
|
|
|
|
|
ZPInputBufPtr .BS 2
|
|
|
|
|
ZPSID .BS 2
|
|
|
|
|
ZPADDR .BS 2
|
2021-04-11 19:47:48 +00:00
|
|
|
|
ZPTYPE .BS 1
|
2021-04-29 11:56:34 +00:00
|
|
|
|
hStrings .BS 1
|
|
|
|
|
|
|
|
|
|
ZPStrBuf .BS 2
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
ZPPtr1 .BS 2
|
|
|
|
|
ZPPtr2 .BS 2
|
2021-05-09 12:39:40 +00:00
|
|
|
|
ArgIndex .EQ *
|
|
|
|
|
pCCS .BS 1
|
2021-04-29 11:56:34 +00:00
|
|
|
|
bFlag .BS 1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
ZPCodeBufPtr .BS 2
|
|
|
|
|
ZPConstBufPtr .BS 2
|
|
|
|
|
ZPDataBufPtr .BS 2
|
2021-04-15 14:03:04 +00:00
|
|
|
|
ZPFWRefBufPtr .BS 2
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
EXP.ADDR .BS 2
|
2021-04-11 19:47:48 +00:00
|
|
|
|
EXP.TYPE .BS 1
|
2021-04-10 17:17:40 +00:00
|
|
|
|
EXP.AOPS .BS 1
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
|
|
|
|
STRID .BS 2
|
|
|
|
|
hIn .BS 1
|
|
|
|
|
hOut .BS 1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
ZS.END .ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA #0 S.PS.F.EVENT
|
|
|
|
|
.DA #0
|
|
|
|
|
.DA CS.END-CS.START Code Size (without Constants)
|
|
|
|
|
.DA DS.END-DS.START Data SegmentSize
|
2021-05-04 17:31:21 +00:00
|
|
|
|
.DA #256 Stack Size
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
2021-04-29 11:56:34 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
L.MSG.GREETINGS .DA MSG.GREETINGS
|
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
|
|
|
|
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
|
|
|
|
|
L.MSG.COMPILING .DA MSG.COMPILING
|
|
|
|
|
L.MSG.DEBUG .DA MSG.DEBUG
|
2021-04-29 11:56:34 +00:00
|
|
|
|
L.MSG.TRACE .DA MSG.TRACE
|
|
|
|
|
L.MSG.ERROR .DA MSG.ERROR
|
2021-04-08 20:30:18 +00:00
|
|
|
|
L.MSG.RUN .DA MSG.RUN
|
2021-04-15 14:03:04 +00:00
|
|
|
|
L.MSG.FWREFERR .DA MSG.FWREFERR
|
2021-04-08 20:30:18 +00:00
|
|
|
|
L.MSG.STR .DA MSG.STR
|
2021-04-29 11:56:34 +00:00
|
|
|
|
L.MSG.INT16 .DA MSG.INT16
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-04 17:31:21 +00:00
|
|
|
|
L.ACOS.OPS .DA ACOS.OPS
|
2021-04-08 20:30:18 +00:00
|
|
|
|
L.ACOS.KW .DA ACOS.KW
|
|
|
|
|
J.ACOS.KW .DA KW.ADDINT
|
|
|
|
|
.DA KW.APPEND
|
|
|
|
|
.DA KW.BYTE
|
|
|
|
|
.DA KW.CLEAR
|
|
|
|
|
.DA KW.CLOCK
|
|
|
|
|
.DA KW.CLOSE
|
|
|
|
|
.DA KW.COPY
|
|
|
|
|
.DA KW.CREATE
|
|
|
|
|
.DA KW.ECHO
|
|
|
|
|
.DA KW.EDIT
|
2021-05-09 12:39:40 +00:00
|
|
|
|
.DA KW.ELSE
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.DA KW.END
|
|
|
|
|
.DA KW.FILL
|
|
|
|
|
.DA KW.FLAG
|
|
|
|
|
.DA KW.FOR
|
|
|
|
|
.DA KW.FREE
|
|
|
|
|
.DA KW.GET
|
|
|
|
|
.DA KW.GOSUB
|
|
|
|
|
.DA KW.GOTO
|
|
|
|
|
.DA KW.HOME
|
2021-05-09 12:39:40 +00:00
|
|
|
|
KWID.IF .EQ *-J.ACOS.KW
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.DA KW.IF
|
|
|
|
|
.DA KW.INFO
|
|
|
|
|
.DA KW.INPUT
|
|
|
|
|
.DA KW.KILL
|
|
|
|
|
.DA KW.LINK
|
|
|
|
|
.DA KW.LOG
|
|
|
|
|
.DA KW.MARK
|
|
|
|
|
.DA KW.MODEM
|
|
|
|
|
.DA KW.MOVE
|
|
|
|
|
.DA KW.MSG
|
|
|
|
|
.DA KW.NEXT
|
|
|
|
|
.DA KW.NIBBLE
|
|
|
|
|
.DA KW.NOT
|
|
|
|
|
.DA KW.ON
|
|
|
|
|
.DA KW.NOCAR
|
|
|
|
|
.DA KW.OPEN
|
|
|
|
|
.DA KW.POKE
|
|
|
|
|
.DA KW.POP
|
|
|
|
|
.DA KW.POSITION
|
|
|
|
|
.DA KW.PRINT
|
|
|
|
|
.DA KW.PUBLIC
|
|
|
|
|
.DA KW.PUSH
|
|
|
|
|
.DA KW.RAM
|
|
|
|
|
.DA KW.RAM2
|
|
|
|
|
.DA KW.READ
|
|
|
|
|
.DA KW.READY
|
|
|
|
|
.DA KW.RETURN
|
|
|
|
|
.DA KW.REWIND
|
|
|
|
|
.DA KW.RIPCO
|
|
|
|
|
.DA KW.SET
|
|
|
|
|
.DA KW.SETINT
|
|
|
|
|
.DA KW.TEXT
|
|
|
|
|
.DA KW.THEN
|
|
|
|
|
.DA KW.TONE
|
|
|
|
|
.DA KW.UPDATE
|
|
|
|
|
.DA KW.USE
|
|
|
|
|
.DA KW.WHENd
|
|
|
|
|
.DA KW.WRITE
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
L.ACOS.FN .DA ACOS.FN
|
|
|
|
|
J.ACOS.FN .DA FN.BYTE
|
|
|
|
|
.DA FN.CLOCK
|
|
|
|
|
.DA FN.DATEd
|
|
|
|
|
.DA FN.FLAG
|
|
|
|
|
.DA FN.CHRd
|
|
|
|
|
.DA FN.INSTR
|
|
|
|
|
.DA FN.KEY
|
|
|
|
|
.DA FN.LEN
|
|
|
|
|
.DA FN.LEFTd
|
|
|
|
|
.DA FN.MIDd
|
|
|
|
|
.DA FN.PDL
|
|
|
|
|
.DA FN.PEEK
|
|
|
|
|
.DA FN.RANDOM
|
|
|
|
|
.DA FN.RIGHTd
|
|
|
|
|
.DA FN.RNDd
|
|
|
|
|
.DA FN.STRd
|
|
|
|
|
.DA FN.TIMEd
|
|
|
|
|
.DA FN.VAL
|
|
|
|
|
.DA FN.WHENd
|
|
|
|
|
.DA FN.WIDTH
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called once at process creation
|
|
|
|
|
* Put code for loading LIB here
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT clc
|
|
|
|
|
CS.INIT.RTS rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called until exit with CS
|
|
|
|
|
* if RUN exits with CC, RN entered again
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN >PUSHW L.MSG.GREETINGS
|
|
|
|
|
>PUSHW A2osX.KVER
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
bcs CS.INIT.RTS
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.ARGS
|
|
|
|
|
bcs CS.INIT.RTS
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs CS.INIT.RTS
|
|
|
|
|
>STYA.G InputBufPtr
|
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr CORE.Init
|
|
|
|
|
bcs CS.INIT.RTS
|
|
|
|
|
|
|
|
|
|
>PUSHW L.MSG.COMPILING
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>PUSHW ZPPtr2 File name
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
bcs CS.INIT.RTS
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CS.RUN.LOOP >SLEEP
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G bDebug
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
jsr PrintDebugMsg
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.2 jsr CS.RUN.FGetS
|
|
|
|
|
bcs .4
|
|
|
|
|
|
|
|
|
|
>LDA.G bTrace
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
jsr PrintTraceMsg
|
|
|
|
|
|
|
|
|
|
.3 jsr CORE.Compile
|
2021-04-29 11:56:34 +00:00
|
|
|
|
bcc CS.RUN.LOOP
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
cmp #MLI.E.EOF
|
2021-04-29 11:56:34 +00:00
|
|
|
|
beq CS.RUN.LOOP
|
|
|
|
|
|
|
|
|
|
.4 cmp #MLI.E.EOF
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .9
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr CS.FClose
|
|
|
|
|
|
2021-04-15 14:03:04 +00:00
|
|
|
|
jsr CORE.FWREF
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr CORE.Run
|
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
.9 pha
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr PrintErrorMsg
|
2021-04-08 20:30:18 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 lda #0 Exit Code = Success
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.ARGS inc ArgIndex
|
|
|
|
|
|
|
|
|
|
lda ArgIndex
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .7
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
ldx #OptionVars-OptionList-1
|
|
|
|
|
|
|
|
|
|
.1 cmp OptionList,x
|
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
bra .90
|
|
|
|
|
|
|
|
|
|
.2 ldy OptionVars,x
|
|
|
|
|
lda #$ff
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra CS.RUN.ARGS
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.4 >LDA.G hFile
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .90
|
|
|
|
|
|
|
|
|
|
>LDYA ZPPtr1
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>STYA ZPPtr2 for printing later
|
|
|
|
|
jsr CS.RUN.FOpen
|
|
|
|
|
bcc CS.RUN.ARGS
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.9 rts
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.7 >LDA.G hFile
|
2021-04-08 20:30:18 +00:00
|
|
|
|
beq .90
|
|
|
|
|
|
|
|
|
|
clc
|
2021-04-29 11:56:34 +00:00
|
|
|
|
rts
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
.90 >PUSHW L.MSG.USAGE
|
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
|
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec QUIT Process
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CS.RUN.FOpen >PUSHYA
|
|
|
|
|
>PUSHBI O.RDONLY
|
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHWZ Aux type
|
|
|
|
|
>SYSCALL FOpen
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>STA.G hFile
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CS.RUN.FGetS >LDYA.G InputBufPtr
|
|
|
|
|
>STYA ZPInputBufPtr
|
|
|
|
|
|
|
|
|
|
>INCW.G LineCounter
|
|
|
|
|
|
|
|
|
|
>PUSHB.G hFile
|
|
|
|
|
>PUSHW ZPInputBufPtr
|
|
|
|
|
>PUSHWI 256
|
|
|
|
|
>SYSCALL FGetS
|
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CS.DOEVENT sec
|
2021-04-08 20:30:18 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CS.QUIT jsr CORE.Quit
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CS.FClose >LDA.G hFile
|
2021-04-08 20:30:18 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>SYSCALL FClose
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>STZ.G hFile
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.8 clc
|
2021-04-08 20:30:18 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintDebugMsg >LDYA pStack
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
>PUSHW L.MSG.DEBUG
|
|
|
|
|
|
|
|
|
|
>PUSHW ZPCodeBufPtr
|
2021-05-09 12:39:40 +00:00
|
|
|
|
>PUSHW ZPConstBufPtr
|
|
|
|
|
>PUSHW ZPDataBufPtr
|
|
|
|
|
>PUSHW ZPPtr2
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-05-09 12:39:40 +00:00
|
|
|
|
>PUSHBI 8
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
PrintTraceMsg ldy #S.PS.hStdErr
|
2021-04-08 20:30:18 +00:00
|
|
|
|
lda (pPS),y
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>PUSHA
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>PUSHW L.MSG.TRACE
|
|
|
|
|
>PUSHW.G LineCounter
|
|
|
|
|
>PUSHW.G InputBufPtr
|
|
|
|
|
>PUSHBI 4
|
|
|
|
|
>SYSCALL FPrintF
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintErrorMsg >LDA.G bTrace
|
|
|
|
|
bmi .1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
jsr PrintTraceMsg
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.1 lda ZPInputBufPtr
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
>SBC.G InputBufPtr
|
|
|
|
|
tax
|
2021-05-09 12:39:40 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>LDYA.G InputBufPtr
|
|
|
|
|
>STYA ZPInputBufPtr
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
lda #'-'
|
|
|
|
|
|
|
|
|
|
.2 sta (ZPInputBufPtr),y
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
.3 sta (ZPInputBufPtr),y
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.8 ldy #S.PS.hStdErr
|
2021-04-08 20:30:18 +00:00
|
|
|
|
lda (pPS),y
|
|
|
|
|
>PUSHA
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>PUSHW L.MSG.ERROR
|
|
|
|
|
>PUSHW ZPInputBufPtr
|
|
|
|
|
>PUSHBI 2
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>SYSCALL FPrintF
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
* Precompiled code
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.PULLWS >PULLA
|
|
|
|
|
pha
|
|
|
|
|
>PULLA
|
|
|
|
|
pha
|
|
|
|
|
CCODE.PULLWS.LEN .EQ *-CCODE.PULLWS
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.PUSHWS pla
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>PUSHA
|
2021-04-29 11:56:34 +00:00
|
|
|
|
pla
|
|
|
|
|
>PUSHA
|
|
|
|
|
CCODE.PUSHWS.LEN .EQ *-CCODE.PUSHWS
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CCODE.PUSHWYA >STYA ZPADDR
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPADDR),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
lda (ZPADDR)
|
|
|
|
|
>PUSHA
|
|
|
|
|
CCODE.PUSHWYA.LEN .EQ *-CCODE.PUSHWYA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.PULLWYA >STYA ZPADDR
|
|
|
|
|
>PULLA
|
|
|
|
|
sta (ZPADDR)
|
|
|
|
|
>PULLA
|
|
|
|
|
ldy #1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
sta (ZPADDR),y
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CCODE.PULLWYA.LEN .EQ *-CCODE.PULLWYA
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.PUSHA >PUSHA
|
|
|
|
|
CCODE.PUSHA.LEN .EQ *-CCODE.PUSHA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.PULLA >PULLA
|
|
|
|
|
CCODE.PULLA.LEN .EQ *-CCODE.PULLA
|
|
|
|
|
*--------------------------------------
|
2021-05-09 12:39:40 +00:00
|
|
|
|
CCODE.TESTTRUE lda (pStack)
|
|
|
|
|
inc pStack
|
|
|
|
|
ora (pStack)
|
|
|
|
|
php
|
|
|
|
|
inc pStack
|
|
|
|
|
plp
|
|
|
|
|
.1 bne .1+5
|
|
|
|
|
CCODE.TESTTRUE.LEN .EQ *-CCODE.TESTTRUE
|
|
|
|
|
*--------------------------------------
|
2021-06-03 17:43:28 +00:00
|
|
|
|
CCODE.FPRINTSTR ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
ldy #2
|
2021-05-09 12:39:40 +00:00
|
|
|
|
lda (pStack),y
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>PUSHA
|
2021-05-09 12:39:40 +00:00
|
|
|
|
lda (pStack),y
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>PUSHA
|
2021-06-03 17:43:28 +00:00
|
|
|
|
>SYSCALL fputs
|
2021-05-09 12:39:40 +00:00
|
|
|
|
inc pStack
|
|
|
|
|
inc pStack
|
2021-04-08 20:30:18 +00:00
|
|
|
|
CCODE.FPRINTSTR.LEN .EQ *-CCODE.FPRINTSTR
|
|
|
|
|
*--------------------------------------
|
2021-05-09 12:39:40 +00:00
|
|
|
|
CCODE.FPRINTINT >PUSHW L.MSG.INT16
|
|
|
|
|
ldy #3
|
|
|
|
|
lda (pStack),y
|
2021-04-08 20:30:18 +00:00
|
|
|
|
>PUSHA
|
2021-05-09 12:39:40 +00:00
|
|
|
|
lda (pStack),y
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>SYSCALL PrintF
|
2021-05-09 12:39:40 +00:00
|
|
|
|
inc pStack
|
|
|
|
|
inc pStack
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CCODE.FPRINTINT.LEN .EQ *-CCODE.FPRINTINT
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.LEN >PULLW ZPPtr1
|
|
|
|
|
|
|
|
|
|
ldy #$FF
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPPtr1),y
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .1
|
2021-04-10 17:17:40 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
CCODE.LEN.LEN .EQ *-CCODE.LEN
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.LEFT >PULLW ZPPtr2 cnt
|
|
|
|
|
lda (pStack)
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
sta ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
ldy #0
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.1 lda (ZPPtr1),y
|
|
|
|
|
beq .8
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy ZPPtr2
|
|
|
|
|
bne .1
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr1),y
|
2021-06-22 18:59:02 +00:00
|
|
|
|
.8
|
2021-04-29 11:56:34 +00:00
|
|
|
|
|
|
|
|
|
CCODE.LEFT.LEN .EQ *-CCODE.LEFT
|
2021-06-22 18:59:02 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.STR >PULLYA int
|
|
|
|
|
pha
|
|
|
|
|
>PUSHW ZPStrBuf
|
|
|
|
|
>PUSHW L.MSG.INT16
|
|
|
|
|
pla
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>SYSCALL sprintf
|
|
|
|
|
>PUSHW ZPStrBuf
|
|
|
|
|
CCODE.STR.LEN .EQ *-CCODE.STR
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CCODE.VAL >PULLYA str
|
|
|
|
|
>SYSCALL atoi
|
|
|
|
|
>PUSHYA
|
|
|
|
|
CCODE.VAL.LEN .EQ *-CCODE.VAL
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB usr/src/bin/acos.s.code
|
|
|
|
|
.INB usr/src/bin/acos.s.core
|
|
|
|
|
.INB usr/src/bin/acos.s.exp
|
|
|
|
|
.INB usr/src/bin/acos.s.fn
|
|
|
|
|
.INB usr/src/bin/acos.s.kw
|
2021-05-22 21:05:12 +00:00
|
|
|
|
.INB usr/src/bin/acos.s.rt
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Initialized DATA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MSG.GREETINGS .AZ "\r\nACOS-Shell %d.%d\r\n\r\n"
|
|
|
|
|
MSG.USAGE .AS "Usage : ACOS <option> file\r\n"
|
|
|
|
|
.AS " -D : Debug Mode\r\n"
|
|
|
|
|
.AS " -T : Trace On"
|
|
|
|
|
MSG.ECHOCRLF .AZ "\r\n"
|
|
|
|
|
MSG.COMPILING .AZ "Compiling : %s...\r\n"
|
2021-05-09 12:39:40 +00:00
|
|
|
|
MSG.DEBUG .AZ "CodePtr=%H ConstPtr=%H DataPtr=%H StackPtr=%H\r\n"
|
2021-04-29 11:56:34 +00:00
|
|
|
|
MSG.TRACE .AZ "%05D>%s\r\n"
|
|
|
|
|
MSG.ERROR .AZ " %s^\r\n"
|
2021-04-15 14:03:04 +00:00
|
|
|
|
MSG.RUN .AZ "Success, Code size = %D Bytes\r\nResolving FWRefs...\r\n"
|
|
|
|
|
MSG.FWREFERR .AZ "Unresolved FWRef : %s\r\n"
|
2021-04-08 20:30:18 +00:00
|
|
|
|
MSG.STR .AZ "%s"
|
2021-04-29 11:56:34 +00:00
|
|
|
|
MSG.INT16 .AZ "%I"
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
OptionList .AS "DdTt"
|
|
|
|
|
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
|
|
|
|
|
*--------------------------------------
|
2021-05-04 17:31:21 +00:00
|
|
|
|
ACOS.OPSChars .AS "+-*/<>="
|
|
|
|
|
ACOS.OPSChars.Cnt .EQ *-ACOS.OPSChars
|
2021-04-08 20:30:18 +00:00
|
|
|
|
*--------------------------------------
|
2021-05-04 17:31:21 +00:00
|
|
|
|
ACOS.OPS .AT "*"
|
|
|
|
|
.AT "/"
|
|
|
|
|
.AT "MOD"
|
|
|
|
|
.AT "+"
|
|
|
|
|
.AT "-"
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.AT "<"
|
|
|
|
|
.AT "<="
|
|
|
|
|
.AT "=<"
|
2021-05-04 17:31:21 +00:00
|
|
|
|
.AT ">"
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.AT ">="
|
|
|
|
|
.AT "=>"
|
2021-05-04 17:31:21 +00:00
|
|
|
|
.AT "<>"
|
|
|
|
|
.AT "><"
|
|
|
|
|
.AT "="
|
|
|
|
|
* .AT "NOT"
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.AT "AND"
|
|
|
|
|
.AT "OR"
|
|
|
|
|
.HS 00
|
|
|
|
|
*--------------------------------------
|
2021-05-09 12:39:40 +00:00
|
|
|
|
ACOS.OPS2FPU .DA #FPU.iMUL,#FPU.iDIV,#FPU.iMOD,#FPU.iADD,#FPU.iSUB
|
2021-05-04 17:31:21 +00:00
|
|
|
|
.DA #FPU.iL,#FPU.iLE,#FPU.iLE
|
|
|
|
|
.DA #FPU.iG,#FPU.iGE,#FPU.iGE
|
|
|
|
|
.DA #FPU.iNE,#FPU.iNE,#FPU.iE
|
|
|
|
|
.DA #FPU.iLAND,#FPU.iLOR
|
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
ACOS.KW .AT "ADDINT"
|
|
|
|
|
.AT "APPEND"
|
|
|
|
|
.AT "BYTE"
|
|
|
|
|
.AT "CLEAR"
|
|
|
|
|
.AT "CLOCK"
|
|
|
|
|
.AT "CLOSE"
|
|
|
|
|
.AT "COPY"
|
|
|
|
|
.AT "CREATE"
|
|
|
|
|
.AT "ECHO"
|
|
|
|
|
.AT "EDIT"
|
2021-05-09 12:39:40 +00:00
|
|
|
|
.AT "ELSE"
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.AT "END"
|
|
|
|
|
.AT "FILL"
|
|
|
|
|
.AT "FLAG"
|
|
|
|
|
.AT "FOR"
|
|
|
|
|
.AT "FREE"
|
|
|
|
|
.AT "GET"
|
|
|
|
|
.AT "GOSUB"
|
|
|
|
|
.AT "GOTO"
|
|
|
|
|
.AT "HOME"
|
|
|
|
|
.AT "IF"
|
|
|
|
|
.AT "INFO"
|
|
|
|
|
.AT "INPUT"
|
|
|
|
|
.AT "KILL"
|
|
|
|
|
.AT "LINK"
|
|
|
|
|
.AT "LOG"
|
|
|
|
|
.AT "MARK"
|
|
|
|
|
.AT "MODEM"
|
|
|
|
|
.AT "MOVE"
|
|
|
|
|
.AT "MSG"
|
|
|
|
|
.AT "NEXT"
|
|
|
|
|
.AT "NIBBLE"
|
|
|
|
|
.AT "NOT"
|
|
|
|
|
.AT "ON"
|
|
|
|
|
.AT "NOCAR"
|
|
|
|
|
.AT "OPEN"
|
|
|
|
|
.AT "POKE"
|
|
|
|
|
.AT "POP"
|
|
|
|
|
.AT "POSITION"
|
|
|
|
|
.AT "PRINT"
|
|
|
|
|
.AT "PUBLIC"
|
|
|
|
|
.AT "PUSH"
|
|
|
|
|
.AT "RAM"
|
|
|
|
|
.AT "RAM2"
|
|
|
|
|
.AT "READ"
|
|
|
|
|
.AT "READY"
|
|
|
|
|
.AT "RETURN"
|
|
|
|
|
.AT "REWIND"
|
|
|
|
|
.AT "RIPCO"
|
|
|
|
|
.AT "SET"
|
|
|
|
|
.AT "SETINT"
|
|
|
|
|
.AT "TEXT"
|
|
|
|
|
.AT "THEN"
|
|
|
|
|
.AT "TONE"
|
|
|
|
|
.AT "UPDATE"
|
|
|
|
|
.AT "USE"
|
|
|
|
|
.AT "WHEN$"
|
|
|
|
|
.AT "WRITE"
|
|
|
|
|
.HS 00
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ACOS.FN .AT "BYTE"
|
|
|
|
|
.AT "DATE$"
|
|
|
|
|
.AT "FLAG"
|
|
|
|
|
.AT "CHR$"
|
|
|
|
|
.AT "INFO"
|
|
|
|
|
.AT "INSTR"
|
|
|
|
|
.AT "KEY"
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.AT "LEN"
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.AT "LEFT$"
|
|
|
|
|
.AT "MID$"
|
|
|
|
|
.AT "PDL"
|
|
|
|
|
.AT "PEEK"
|
|
|
|
|
.AT "RANDOM"
|
|
|
|
|
.AT "RIGHT$"
|
|
|
|
|
.AT "RND$"
|
|
|
|
|
.AT "STR$"
|
|
|
|
|
.AT "TIME$"
|
|
|
|
|
.AT "VAL"
|
|
|
|
|
.AT "WHEN$"
|
|
|
|
|
.AT "WIDTH"
|
|
|
|
|
.HS 00
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
2021-05-09 12:39:40 +00:00
|
|
|
|
CCS .BS CCS.MAX
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bDebug .BS 1
|
|
|
|
|
bTrace .BS 1
|
2021-04-29 11:56:34 +00:00
|
|
|
|
LineCounter .BS 2
|
|
|
|
|
hFile .BS 1
|
|
|
|
|
InputBufPtr .BS 2
|
2021-04-08 20:30:18 +00:00
|
|
|
|
hCodeBuf .BS 1
|
|
|
|
|
hConstBuf .BS 1
|
|
|
|
|
hDataBuf .BS 1
|
|
|
|
|
hLabels .BS 1
|
|
|
|
|
hVars .BS 1
|
2021-04-29 11:56:34 +00:00
|
|
|
|
hStrBuf .BS 1
|
2021-04-15 14:03:04 +00:00
|
|
|
|
hFWRefBuf .BS 1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
DS.END .ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/acos.s
|
|
|
|
|
ASM
|