A2osX/BIN/ACOS.S.RT.txt

369 lines
5.7 KiB
Plaintext
Raw Normal View History

2021-04-16 19:17:18 +00:00
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
2021-08-06 17:58:04 +00:00
RT.NOT >PULLA
2021-07-09 20:40:57 +00:00
ora (pStack)
beq .1
lda #1
.1 dec
sta (pStack)
>PUSHA
rts
*--------------------------------------
2021-08-05 11:35:37 +00:00
RT.StrAdd ldx #2
jsr RT.StrPullX
2021-08-05 11:35:37 +00:00
jsr RT.StrPull
>PUSHW ZPStrBuf1
>PUSHW ZPStrBuf2
>SYSCALL strcat
>PUSHWZ RVALUE in buffer
clc
rts
*--------------------------------------
2021-08-06 17:58:04 +00:00
RT.StrCmp ldx #2
jsr RT.StrPullX
jsr RT.StrPull
>PUSHW ZPStrBuf1
>PUSHW ZPStrBuf2
>SYSCALL strcmp
>PUSHYA
clc
rts
*--------------------------------------
2021-08-05 11:35:37 +00:00
* on stack : Src StrID
* Y,X : Dst StrID
*--------------------------------------
RT.StrSet sty STRID
stx STRID+1
ldy #1
lda (pStack),y
ora (pStack)
beq .1
>PUSHB hStrings
2021-08-05 11:35:37 +00:00
ldy #2
2021-07-09 13:54:42 +00:00
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
2021-08-05 11:35:37 +00:00
>PUSHW ZPStrBuf1
>SYSCALL StrVGet
.1 >PUSHB hStrings
>PUSHW STRID
>PUSHW ZPStrBuf1
>SYSCALL StrVSet
2021-08-05 11:35:37 +00:00
2021-07-09 13:54:42 +00:00
inc pStack
inc pStack
rts
2021-04-16 19:17:18 +00:00
*--------------------------------------
2021-08-05 11:35:37 +00:00
RT.StrOut jsr RT.StrPull
ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
2021-08-05 11:35:37 +00:00
>PUSHW ZPStrBuf1
>PUSHBI 0
>SYSCALL fprintf
2021-04-16 19:17:18 +00:00
rts
*--------------------------------------
2021-08-05 11:35:37 +00:00
RT.StrPull ldx #0
RT.StrPullX >PULLW STRID
ora STRID
beq .8
lda #0
sta (ZPStrBuf1,x)
>PUSHB hStrings
>PUSHW STRID
>PUSHW ZPStrBuf1,x
>SYSCALL StrVGet
.8 rts
*--------------------------------------
RT.IntSet sty VAR.ADDR
stx VAR.ADDR+1
2021-07-09 13:54:42 +00:00
2021-08-05 11:35:37 +00:00
RT.IntUpd >PULLA
sta (VAR.ADDR)
2021-07-09 13:54:42 +00:00
>PULLA
ldy #1
2021-08-05 11:35:37 +00:00
sta (VAR.ADDR),y
2021-07-09 13:54:42 +00:00
rts
*--------------------------------------
2021-08-05 11:35:37 +00:00
RT.IntGet sty VAR.ADDR
stx VAR.ADDR+1
ldy #1
2021-08-05 11:35:37 +00:00
lda (VAR.ADDR),y
>PUSHA
2021-08-05 11:35:37 +00:00
lda (VAR.ADDR)
>PUSHA
2021-06-03 17:43:28 +00:00
rts
*--------------------------------------
RT.IntOut >PUSHW L.MSG.INT16
2021-08-05 11:35:37 +00:00
ldy #3
lda (pStack),y
>PUSHA
lda (pStack),y
>PUSHA
2021-08-05 11:35:37 +00:00
>PUSHBI 2
>SYSCALL PrintF
inc pStack
inc pStack
rts
*--------------------------------------
RT.DATEd ldx #0
bra RT.TIMEd.1
RT.TIMEd ldx #2
2021-08-05 11:35:37 +00:00
RT.TIMEd.1 >PUSHW ZPStrBuf1
>PUSHW L.FMT.DATE,x
>PUSHEA.G TimeBuf
>PUSHEA.G TimeBuf
>SYSCALL Time
>SYSCALL StrFTime
2021-08-05 11:35:37 +00:00
>PUSHWZ RVALUE in buffer
rts
2021-06-03 17:43:28 +00:00
*--------------------------------------
RT.GET jsr RT.GetChar
2021-08-05 11:35:37 +00:00
sta (ZPStrBuf1)
2021-07-09 13:54:42 +00:00
ldy #1
2021-07-24 20:42:23 +00:00
lda #0
2021-08-05 11:35:37 +00:00
sta (ZPStrBuf1),y
2021-07-24 20:42:23 +00:00
2021-08-05 11:35:37 +00:00
>PUSHWZ RVALUE in buffer
clc
rts
2021-07-09 13:54:42 +00:00
*--------------------------------------
RT.INPUT lda #0
2021-08-05 11:35:37 +00:00
sta (ZPStrBuf1)
stz ZPPtr1
ldx #0 OUT.ELW
jsr RT.OUTX
.1 jsr RT.GetChar
2021-08-05 11:35:37 +00:00
bcs .9
ldy ZPPtr1
cmp #C.SPACE
bcs .7
cmp #C.CR
bne .2
lda #0
2021-08-05 11:35:37 +00:00
sta (ZPStrBuf1),y
ldx #4 OUT.CRLF
jsr RT.OUTX
2021-08-05 11:35:37 +00:00
bra .8
.2 cmp #C.BS
bne .1
cpy #0
beq .1
ldx 6 OUT.BSSPBS
jsr RT.OUTX
dec ZPPtr1
bra .1
.7 cpy #255
bcs .1
2021-08-05 11:35:37 +00:00
sta (ZPStrBuf1),y
>SYSCALL PutChar
inc ZPPtr1
bra .1
2021-08-05 11:35:37 +00:00
.8 ldx #2 OUT.DLW
jsr RT.OUTX
2021-08-05 11:35:37 +00:00
>PUSHWZ RVALUE in buffer
clc
2021-08-05 11:35:37 +00:00
.9 rts
*--------------------------------------
RT.LEFTd >PULLB ZPPtr2 cnt
inc pStack
2021-08-05 11:35:37 +00:00
jsr RT.StrPull
2021-08-05 11:35:37 +00:00
ldy ZPPtr2
lda #0
2021-08-05 11:35:37 +00:00
sta (ZPStrBuf1),y
2021-08-05 11:35:37 +00:00
.8 >PUSHWZ RVALUE in buffer
clc
rts
*--------------------------------------
2021-08-05 11:35:37 +00:00
RT.LEN jsr RT.StrPull
ldy #$ff
.1 iny
lda (ZPStrBuf1),y
bne .1
>PUSHYA
rts
*--------------------------------------
2021-08-05 11:35:37 +00:00
RT.MIDd >PULLB ZPPtr2+1 len
inc pStack
>PULLB ZPPtr2 start
inc pStack
2021-08-05 11:35:37 +00:00
jsr RT.StrPull
ldy #0
2021-08-05 11:35:37 +00:00
.1 lda (ZPStrBuf1),y
beq .8
iny
2021-08-05 11:35:37 +00:00
cpy ZPPtr2 start
bne .1
tya
clc
2021-08-05 11:35:37 +00:00
adc ZPStrBuf1
sta ZPPtr1
2021-08-05 11:35:37 +00:00
lda ZPStrBuf1+1
adc #0
sta ZPPtr1+1
2021-08-05 11:35:37 +00:00
ldy #$ff
2021-08-05 11:35:37 +00:00
.3 iny
cpy ZPPtr2+1 len
beq .8
lda (ZPPtr1),y
2021-08-05 11:35:37 +00:00
sta (ZPStrBuf1),y
bne .3
2021-08-05 11:35:37 +00:00
.8 lda #0
sta (ZPStrBuf1),y
2021-08-05 11:35:37 +00:00
.80 >PUSHWZ RVALUE in buffer
clc
rts
*--------------------------------------
RT.RIGHTd >PULLB ZPPtr2 cnt
inc pStack
2021-08-05 11:35:37 +00:00
jsr RT.StrPull
ldy #$ff
.1 iny
2021-08-05 11:35:37 +00:00
lda (ZPStrBuf1),y
bne .1
tya
sec
sbc ZPPtr2
bcc .8
beq .8
clc
2021-08-05 11:35:37 +00:00
adc ZPStrBuf1
sta ZPPtr1
2021-08-05 11:35:37 +00:00
lda ZPStrBuf1+1
adc #0
sta ZPPtr1+1
ldy #$ff
.3 iny
lda (ZPPtr1),y
2021-08-05 11:35:37 +00:00
sta (ZPStrBuf1),y
bne .3
2021-08-05 11:35:37 +00:00
.8 >PUSHWZ RVALUE in buffer
clc
rts
*--------------------------------------
RT.STRd >PULLYA int
pha
2021-08-05 11:35:37 +00:00
>PUSHW ZPStrBuf1
>PUSHW L.MSG.INT16
pla
>PUSHYA
>PUSHBI 2
>SYSCALL sprintf
2021-08-05 11:35:37 +00:00
>PUSHWZ RVALUE in buffer
rts
*--------------------------------------
RT.VAL >PULLYA str
>SYSCALL atoi
>PUSHYA
rts
*--------------------------------------
RT.OUTCRLF ldx #4 CRLF
2021-08-05 11:35:37 +00:00
RT.OUTX ldy #S.PS.hStdOut
lda (pPS),y
>PUSHA
>PUSHW L.OUT,x
>SYSCALL FPutS
rts
*--------------------------------------
* TODO: handle lost conn CS and remap VT100 ESC codes
*--------------------------------------
RT.GetChar >SYSCALL GetChar
cmp #C.CR
bne .8
>SYSCALL GetChar LF
lda #C.CR
.8 clc
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