2021-04-16 19:17:18 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2021-07-09 20:40:57 +00:00
|
|
|
|
RT.NOT lda (pStack)
|
|
|
|
|
inc
|
|
|
|
|
ora (pStack)
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
lda #1
|
|
|
|
|
|
|
|
|
|
.1 dec
|
|
|
|
|
sta (pStack)
|
|
|
|
|
>PUSHA
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-07-07 14:29:10 +00:00
|
|
|
|
RT.StrSet >PUSHB hStrings
|
2021-07-09 13:54:42 +00:00
|
|
|
|
txa
|
|
|
|
|
>PUSHA
|
|
|
|
|
tya
|
|
|
|
|
>PUSHA
|
2021-07-07 14:29:10 +00:00
|
|
|
|
|
2021-07-09 13:54:42 +00:00
|
|
|
|
ldy #4
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
>PUSHA
|
2021-07-07 14:29:10 +00:00
|
|
|
|
>SYSCALL StrVSet
|
2021-07-09 13:54:42 +00:00
|
|
|
|
inc pStack
|
|
|
|
|
inc pStack
|
2021-07-07 14:29:10 +00:00
|
|
|
|
rts
|
2021-04-16 19:17:18 +00:00
|
|
|
|
*--------------------------------------
|
2021-07-09 13:54:42 +00:00
|
|
|
|
RT.StrGet lda #0
|
|
|
|
|
sta (ZPStrBuf)
|
|
|
|
|
|
|
|
|
|
>PUSHB hStrings
|
2021-07-07 14:29:10 +00:00
|
|
|
|
txa
|
|
|
|
|
>PUSHA
|
|
|
|
|
tya
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHW ZPStrBuf
|
|
|
|
|
>SYSCALL StrVGet
|
|
|
|
|
>PUSHW ZPStrBuf
|
|
|
|
|
rts
|
2021-04-16 19:17:18 +00:00
|
|
|
|
*--------------------------------------
|
2021-07-07 14:29:10 +00:00
|
|
|
|
RT.StrOut ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
ldy #2
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
>PUSHA
|
2021-07-13 16:52:04 +00:00
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>SYSCALL fprintf
|
2021-07-07 14:29:10 +00:00
|
|
|
|
inc pStack
|
|
|
|
|
inc pStack
|
2021-04-16 19:17:18 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-07-09 13:54:42 +00:00
|
|
|
|
RT.IntSet sty ZPADDR
|
|
|
|
|
stx ZPADDR+1
|
|
|
|
|
|
|
|
|
|
>PULLA
|
|
|
|
|
sta (ZPADDR)
|
|
|
|
|
>PULLA
|
|
|
|
|
ldy #1
|
|
|
|
|
sta (ZPADDR),y
|
|
|
|
|
rts
|
2021-07-07 14:29:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
RT.IntGet sty ZPADDR
|
|
|
|
|
stx ZPADDR+1
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPADDR),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
lda (ZPADDR)
|
|
|
|
|
>PUSHA
|
2021-06-03 17:43:28 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-07-07 14:29:10 +00:00
|
|
|
|
RT.IntOut >PUSHW L.MSG.INT16
|
|
|
|
|
ldy #3
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
lda (pStack),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
inc pStack
|
|
|
|
|
inc pStack
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
RT.DATEd ldx #0
|
|
|
|
|
bra RT.TIMEd.1
|
|
|
|
|
|
|
|
|
|
RT.TIMEd ldx #2
|
|
|
|
|
|
|
|
|
|
RT.TIMEd.1 >PUSHW ZPStrBuf
|
|
|
|
|
>PUSHW L.FMT.DATE,x
|
|
|
|
|
>PUSHEA.G TimeBuf
|
|
|
|
|
|
|
|
|
|
>PUSHEA.G TimeBuf
|
|
|
|
|
>SYSCALL Time
|
|
|
|
|
|
|
|
|
|
>SYSCALL StrFTime
|
|
|
|
|
>PUSHW ZPStrBuf
|
|
|
|
|
rts
|
2021-06-03 17:43:28 +00:00
|
|
|
|
*--------------------------------------
|
2021-07-09 13:54:42 +00:00
|
|
|
|
RT.GET >SYSCALL GetChar
|
|
|
|
|
sta (ZPStrBuf)
|
|
|
|
|
|
|
|
|
|
ldy #1
|
2021-07-24 20:42:23 +00:00
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPStrBuf),y
|
|
|
|
|
|
2021-07-09 13:54:42 +00:00
|
|
|
|
bra RT.INPUT.8
|
|
|
|
|
*--------------------------------------
|
2021-07-07 14:29:10 +00:00
|
|
|
|
RT.INPUT lda #0
|
2021-07-05 19:15:15 +00:00
|
|
|
|
sta (ZPStrBuf)
|
|
|
|
|
|
|
|
|
|
stz ZPPtr1
|
|
|
|
|
|
2021-07-13 16:52:04 +00:00
|
|
|
|
ldx #0 OUT.ELW
|
|
|
|
|
jsr RT.OUTX
|
|
|
|
|
|
2021-07-05 19:15:15 +00:00
|
|
|
|
.1 >SYSCALL GetChar
|
2021-07-09 13:54:42 +00:00
|
|
|
|
bcs RT.INPUT.9
|
2021-07-05 19:15:15 +00:00
|
|
|
|
|
|
|
|
|
ldy ZPPtr1
|
|
|
|
|
|
|
|
|
|
cmp #C.SPACE
|
|
|
|
|
bcs .7
|
|
|
|
|
|
|
|
|
|
cmp #C.CR
|
2021-07-13 16:52:04 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPStrBuf),y
|
|
|
|
|
|
|
|
|
|
ldx #4 OUT.CRLF
|
|
|
|
|
jsr RT.OUTX
|
2021-07-05 19:15:15 +00:00
|
|
|
|
|
2021-07-13 16:52:04 +00:00
|
|
|
|
bra RT.INPUT.8
|
|
|
|
|
|
|
|
|
|
.2 cmp #C.BS
|
2021-07-05 19:15:15 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
cpy #0
|
|
|
|
|
beq .1
|
2021-07-13 16:52:04 +00:00
|
|
|
|
|
|
|
|
|
ldx 6 OUT.BSSPBS
|
|
|
|
|
jsr RT.OUTX
|
|
|
|
|
|
2021-07-05 19:15:15 +00:00
|
|
|
|
dec ZPPtr1
|
|
|
|
|
bra .1
|
|
|
|
|
|
2021-07-13 16:52:04 +00:00
|
|
|
|
.7 cpy #255
|
|
|
|
|
bcs .1
|
|
|
|
|
|
|
|
|
|
sta (ZPStrBuf),y
|
2021-07-05 19:15:15 +00:00
|
|
|
|
>SYSCALL PutChar
|
|
|
|
|
inc ZPPtr1
|
2021-07-13 16:52:04 +00:00
|
|
|
|
bra .1
|
2021-07-05 19:15:15 +00:00
|
|
|
|
|
2021-07-13 16:52:04 +00:00
|
|
|
|
RT.INPUT.8 ldx #2 OUT.DLW
|
|
|
|
|
jsr RT.OUTX
|
2021-07-05 19:15:15 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW ZPStrBuf
|
|
|
|
|
clc
|
|
|
|
|
|
2021-07-09 13:54:42 +00:00
|
|
|
|
RT.INPUT.9 rts
|
2021-07-05 19:15:15 +00:00
|
|
|
|
*--------------------------------------
|
2021-07-13 16:52:04 +00:00
|
|
|
|
RT.LEFTd >PULLB ZPPtr2 cnt
|
|
|
|
|
inc pStack
|
|
|
|
|
>PULLW ZPPtr1 src str
|
2021-07-07 14:29:10 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtr1),y
|
2021-07-13 16:52:04 +00:00
|
|
|
|
sta (ZPStrBuf),y
|
2021-07-07 14:29:10 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
cpy ZPPtr2
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #0
|
2021-07-13 16:52:04 +00:00
|
|
|
|
sta (ZPStrBuf),y
|
2021-07-07 14:29:10 +00:00
|
|
|
|
|
2021-07-13 16:52:04 +00:00
|
|
|
|
.8 >PUSHW ZPStrBuf
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2021-07-07 14:29:10 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
RT.LEN >PULLYA str
|
|
|
|
|
>SYSCALL strlen
|
|
|
|
|
>PUSHYA
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-07-13 16:52:04 +00:00
|
|
|
|
RT.MIDd >PULLA len
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
inc pStack
|
|
|
|
|
>PULLB ZPPtr2 start
|
|
|
|
|
inc pStack
|
|
|
|
|
>PULLW ZPPtr1 src str
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtr1),y
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
cpy ZPPtr2
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
clc
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
bcc .2
|
|
|
|
|
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.2 ldy #0
|
|
|
|
|
|
|
|
|
|
.3 txa
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
sta (ZPStrBuf),y
|
|
|
|
|
beq .80
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
.8 sta (ZPStrBuf),y
|
|
|
|
|
|
|
|
|
|
.80 >PUSHW ZPStrBuf
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
RT.RIGHTd >PULLB ZPPtr2 cnt
|
|
|
|
|
inc pStack
|
|
|
|
|
>PULLW ZPPtr1 src str
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
tya
|
|
|
|
|
sec
|
|
|
|
|
sbc ZPPtr2
|
|
|
|
|
bcc .8
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
bcc .2
|
|
|
|
|
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.2 ldy #$ff
|
|
|
|
|
|
|
|
|
|
.3 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
sta (ZPStrBuf),y
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
.8 >PUSHW ZPStrBuf
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-07-07 14:29:10 +00:00
|
|
|
|
RT.STRd >PULLYA int
|
|
|
|
|
pha
|
|
|
|
|
>PUSHW ZPStrBuf
|
|
|
|
|
>PUSHW L.MSG.INT16
|
|
|
|
|
pla
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>SYSCALL sprintf
|
|
|
|
|
>PUSHW ZPStrBuf
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
RT.VAL >PULLYA str
|
|
|
|
|
>SYSCALL atoi
|
|
|
|
|
>PUSHYA
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-07-13 16:52:04 +00:00
|
|
|
|
RT.OUTCRLF ldx #4 CRLF
|
|
|
|
|
RT.OUTX ldy #S.PS.hStdOut
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHW L.OUT,x
|
|
|
|
|
>SYSCALL FPutS
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-16 19:17:18 +00:00
|
|
|
|
MAN
|
2021-05-22 21:05:12 +00:00
|
|
|
|
SAVE usr/src/bin/acos.s.rt
|
2021-04-16 19:17:18 +00:00
|
|
|
|
LOAD usr/src/bin/acos.s
|
|
|
|
|
ASM
|