2021-04-08 20:30:18 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
* ZPADDR=STR ID, New pSTR Value on stack
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.STRSET jsr CODE.PULLWS save pSTR
|
|
|
|
|
|
|
|
|
|
ldx hStrings
|
|
|
|
|
jsr CODE.PUSHBI >PUSHB hSTRV
|
|
|
|
|
|
|
|
|
|
>LDYA ZPADDR
|
|
|
|
|
jsr CODE.PUSHIYA >PUSHW id
|
|
|
|
|
|
|
|
|
|
jsr CODE.PUSHWS >PUSHW str
|
|
|
|
|
|
|
|
|
|
ldx #SYS.StrVSet
|
|
|
|
|
jsr CODE.SYSCALL >SYSCALL StrVSet
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
* EXP.ADDR = STR ID
|
|
|
|
|
* output : str to ZPStrBuf
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.STRGET ldx hStrings
|
|
|
|
|
jsr CODE.PUSHBI >PUSHB hSTRV
|
|
|
|
|
|
|
|
|
|
>LDYA EXP.ADDR
|
|
|
|
|
jsr CODE.PUSHIYA >PUSHW id
|
|
|
|
|
|
|
|
|
|
>LDYA ZPStrBuf
|
|
|
|
|
jsr CODE.PUSHIYA >PUSHW str
|
|
|
|
|
|
|
|
|
|
ldx #SYS.StrVGet
|
|
|
|
|
jsr CODE.SYSCALL >SYSCALL StrVGet
|
|
|
|
|
|
|
|
|
|
>LDYA ZPStrBuf
|
|
|
|
|
jsr CODE.PUSHYA
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* ZPADDR=pInt, Int16 on Stack
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.INTSET >LDYA ZPADDR
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr CODE.LDYAI
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.1 lda CCODE.PULLWYA,x
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
inx
|
2021-04-29 11:56:34 +00:00
|
|
|
|
cpx #CCODE.PULLWYA.LEN
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
* EXP.ADDR=pInt
|
|
|
|
|
* output : Int16 on Stack
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.INTGET >LDYA EXP.ADDR
|
|
|
|
|
jsr CODE.LDYAI
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.1 lda CCODE.PUSHWYA,x
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
inx
|
2021-04-29 11:56:34 +00:00
|
|
|
|
cpx #CCODE.PULLWYA.LEN
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CODE.PULLWS ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda CCODE.PULLWS,x
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
inx
|
|
|
|
|
cpx #CCODE.PULLWS.LEN
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.PUSHWS ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda CCODE.PUSHWS,x
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
inx
|
|
|
|
|
cpx #CCODE.PUSHWS.LEN
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.PUSHBI lda #$A9 LDA #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
txa
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
|
|
|
|
|
jmp CODE.PUSHA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.PUSHIYA pha
|
|
|
|
|
lda #$A9 LDA #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
pla
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
jsr CODE.PUSHA
|
|
|
|
|
|
|
|
|
|
lda #$A9 LDA #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
tya
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
jmp CODE.PUSHA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.PUSHINT16 ldy #1
|
|
|
|
|
|
|
|
|
|
.1 lda #$A9 LDA #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
|
|
|
|
|
jsr CODE.PUSHA
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
CODE.LDYAI pha
|
|
|
|
|
lda #$A0 LDY #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
tya
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
|
|
|
|
|
lda #$A9 LDA #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
pla
|
|
|
|
|
jmp CODE.EmitByte
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CODE.PUSHYA jsr CODE.PUSHA
|
|
|
|
|
lda #$98 tya
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
CODE.PUSHA ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda CCODE.PUSHA,x
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
inx
|
|
|
|
|
cpx #CCODE.PUSHA.LEN
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.FPRINTSTR ldx #0
|
|
|
|
|
|
|
|
|
|
.1 lda CCODE.FPRINTSTR,x
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
inx
|
|
|
|
|
cpx #CCODE.FPRINTSTR.LEN
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-29 11:56:34 +00:00
|
|
|
|
CODE.FPRINTINT ldx #0
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2021-04-29 11:56:34 +00:00
|
|
|
|
.1 lda CCODE.FPRINTINT,x
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
inx
|
2021-04-29 11:56:34 +00:00
|
|
|
|
cpx #CCODE.FPRINTINT.LEN
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.FPUCALL lda #$A2 LDX #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
txa
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
lda #$20 JSR
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
lda #A2osX.FPUCALL
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
lda /A2osX.FPUCALL
|
|
|
|
|
bra CODE.EmitByte
|
|
|
|
|
*--------------------------------------
|
2021-04-10 17:17:40 +00:00
|
|
|
|
CODE.FPRINTCRLF ldx #C.CR
|
|
|
|
|
jsr CODE.PutChar
|
|
|
|
|
ldx #C.LF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.PutChar lda #$A9 LDA #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
txa
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
ldx #SYS.PutChar
|
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
CODE.SYSCALL lda #$A2 LDX #imm
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
txa
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
lda #$20 JSR
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
lda #A2osX.SYSCALL
|
|
|
|
|
jsr CODE.EmitByte
|
|
|
|
|
lda /A2osX.SYSCALL
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CODE.EmitByte sta (ZPCodeBufPtr)
|
|
|
|
|
inc ZPCodeBufPtr
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
inc ZPCodeBufPtr+1
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/acos.s.code
|
|
|
|
|
LOAD usr/src/bin/acos.s
|
|
|
|
|
ASM
|