mirror of
https://github.com/A2osX/A2osX.git
synced 2024-10-31 23:09:33 +00:00
369 lines
5.7 KiB
Plaintext
369 lines
5.7 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
RT.NOT >PULLA
|
||
ora (pStack)
|
||
beq .1
|
||
|
||
lda #1
|
||
|
||
.1 dec
|
||
sta (pStack)
|
||
>PUSHA
|
||
rts
|
||
*--------------------------------------
|
||
RT.StrAdd ldx #2
|
||
jsr RT.StrPullX
|
||
|
||
jsr RT.StrPull
|
||
|
||
>PUSHW ZPStrBuf1
|
||
>PUSHW ZPStrBuf2
|
||
>SYSCALL strcat
|
||
|
||
>PUSHWZ RVALUE in buffer
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
RT.StrCmp ldx #2
|
||
jsr RT.StrPullX
|
||
|
||
jsr RT.StrPull
|
||
|
||
>PUSHW ZPStrBuf1
|
||
>PUSHW ZPStrBuf2
|
||
>SYSCALL strcmp
|
||
|
||
>PUSHYA
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
* 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
|
||
|
||
ldy #2
|
||
lda (pStack),y
|
||
>PUSHA
|
||
lda (pStack),y
|
||
>PUSHA
|
||
|
||
>PUSHW ZPStrBuf1
|
||
>SYSCALL StrVGet
|
||
|
||
.1 >PUSHB hStrings
|
||
>PUSHW STRID
|
||
>PUSHW ZPStrBuf1
|
||
>SYSCALL StrVSet
|
||
|
||
inc pStack
|
||
inc pStack
|
||
|
||
rts
|
||
*--------------------------------------
|
||
RT.StrOut jsr RT.StrPull
|
||
|
||
ldy #S.PS.hStdOut
|
||
lda (pPS),y
|
||
>PUSHA
|
||
|
||
>PUSHW ZPStrBuf1
|
||
>PUSHBI 0
|
||
>SYSCALL fprintf
|
||
rts
|
||
*--------------------------------------
|
||
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
|
||
|
||
RT.IntUpd >PULLA
|
||
sta (VAR.ADDR)
|
||
>PULLA
|
||
ldy #1
|
||
sta (VAR.ADDR),y
|
||
rts
|
||
*--------------------------------------
|
||
RT.IntGet sty VAR.ADDR
|
||
stx VAR.ADDR+1
|
||
|
||
ldy #1
|
||
lda (VAR.ADDR),y
|
||
>PUSHA
|
||
lda (VAR.ADDR)
|
||
>PUSHA
|
||
rts
|
||
*--------------------------------------
|
||
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 ZPStrBuf1
|
||
>PUSHW L.FMT.DATE,x
|
||
>PUSHEA.G TimeBuf
|
||
|
||
>PUSHEA.G TimeBuf
|
||
>SYSCALL Time
|
||
|
||
>SYSCALL StrFTime
|
||
|
||
>PUSHWZ RVALUE in buffer
|
||
|
||
rts
|
||
*--------------------------------------
|
||
RT.GET jsr RT.GetChar
|
||
sta (ZPStrBuf1)
|
||
|
||
ldy #1
|
||
|
||
lda #0
|
||
sta (ZPStrBuf1),y
|
||
|
||
>PUSHWZ RVALUE in buffer
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
RT.INPUT lda #0
|
||
sta (ZPStrBuf1)
|
||
|
||
stz ZPPtr1
|
||
|
||
ldx #0 OUT.ELW
|
||
jsr RT.OUTX
|
||
|
||
.1 jsr RT.GetChar
|
||
bcs .9
|
||
|
||
ldy ZPPtr1
|
||
|
||
cmp #C.SPACE
|
||
bcs .7
|
||
|
||
cmp #C.CR
|
||
bne .2
|
||
|
||
lda #0
|
||
sta (ZPStrBuf1),y
|
||
|
||
ldx #4 OUT.CRLF
|
||
jsr RT.OUTX
|
||
|
||
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
|
||
|
||
sta (ZPStrBuf1),y
|
||
>SYSCALL PutChar
|
||
inc ZPPtr1
|
||
bra .1
|
||
|
||
.8 ldx #2 OUT.DLW
|
||
jsr RT.OUTX
|
||
|
||
>PUSHWZ RVALUE in buffer
|
||
clc
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
RT.LEFTd >PULLB ZPPtr2 cnt
|
||
inc pStack
|
||
|
||
jsr RT.StrPull
|
||
|
||
ldy ZPPtr2
|
||
lda #0
|
||
sta (ZPStrBuf1),y
|
||
|
||
.8 >PUSHWZ RVALUE in buffer
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
RT.LEN jsr RT.StrPull
|
||
|
||
ldy #$ff
|
||
|
||
.1 iny
|
||
lda (ZPStrBuf1),y
|
||
bne .1
|
||
|
||
>PUSHYA
|
||
rts
|
||
*--------------------------------------
|
||
RT.MIDd >PULLB ZPPtr2+1 len
|
||
inc pStack
|
||
>PULLB ZPPtr2 start
|
||
inc pStack
|
||
|
||
jsr RT.StrPull
|
||
|
||
ldy #0
|
||
|
||
.1 lda (ZPStrBuf1),y
|
||
beq .8
|
||
|
||
iny
|
||
cpy ZPPtr2 start
|
||
bne .1
|
||
|
||
tya
|
||
clc
|
||
adc ZPStrBuf1
|
||
sta ZPPtr1
|
||
|
||
lda ZPStrBuf1+1
|
||
adc #0
|
||
sta ZPPtr1+1
|
||
|
||
ldy #$ff
|
||
|
||
.3 iny
|
||
cpy ZPPtr2+1 len
|
||
beq .8
|
||
|
||
lda (ZPPtr1),y
|
||
sta (ZPStrBuf1),y
|
||
bne .3
|
||
|
||
.8 lda #0
|
||
sta (ZPStrBuf1),y
|
||
|
||
.80 >PUSHWZ RVALUE in buffer
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
RT.RIGHTd >PULLB ZPPtr2 cnt
|
||
inc pStack
|
||
|
||
jsr RT.StrPull
|
||
|
||
ldy #$ff
|
||
|
||
.1 iny
|
||
lda (ZPStrBuf1),y
|
||
bne .1
|
||
|
||
tya
|
||
sec
|
||
sbc ZPPtr2
|
||
bcc .8
|
||
beq .8
|
||
|
||
clc
|
||
adc ZPStrBuf1
|
||
sta ZPPtr1
|
||
|
||
lda ZPStrBuf1+1
|
||
adc #0
|
||
sta ZPPtr1+1
|
||
|
||
ldy #$ff
|
||
|
||
.3 iny
|
||
lda (ZPPtr1),y
|
||
sta (ZPStrBuf1),y
|
||
bne .3
|
||
|
||
.8 >PUSHWZ RVALUE in buffer
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
RT.STRd >PULLYA int
|
||
pha
|
||
>PUSHW ZPStrBuf1
|
||
>PUSHW L.MSG.INT16
|
||
pla
|
||
>PUSHYA
|
||
>PUSHBI 2
|
||
>SYSCALL sprintf
|
||
|
||
>PUSHWZ RVALUE in buffer
|
||
|
||
rts
|
||
*--------------------------------------
|
||
RT.VAL >PULLYA str
|
||
>SYSCALL atoi
|
||
>PUSHYA
|
||
rts
|
||
*--------------------------------------
|
||
RT.OUTCRLF ldx #4 CRLF
|
||
|
||
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
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/acos.s.rt
|
||
LOAD usr/src/bin/acos.s
|
||
ASM
|