A2osX/DRV/PPPSSC.DRV.S.E.txt

271 lines
3.5 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
PPP.ETCFILE >PUSHW L.ETCFILE
>PUSHBI O.RDONLY
>PUSHBI 0
>PUSHWZ
>SYSCALL FOpen
bcs .99
sta hETCFILE
>PUSHW L.MSG.ETCFILE
>PUSHW L.ETCFILE
>PUSHBI 2
>SYSCALL PrintF
.1 >PUSHB hETCFILE
>PUSHW L.IN.Buf
>PUSHWI 255
>SYSCALL FGetS
bcs .8
lda IN.Buf
beq .1
cmp #'#'
beq .1
>LDYA L.IN.Buf
>SYSCALL PutS
lda IN.Buf
cmp #'>'
bne .2
>LDYA L.IN.Bufp1
jsr SSC.Write
bcs .9
.10 bra .1
.99 rts
.2 cmp #'?'
bne .7
*--------------------------------------
.3 jsr SSC.Read
bcs .9
tya
beq .3
lda #0
sta IN.Buf,y
>LDYA L.IN.Buf
>STYA ZPPtr2
.4 jsr PPP.SkipCRLFPtr2
bcs .3
ldy #$ff
.5 iny
lda IN.Buf+1,y skip !
beq .10
.6 cmp (ZPPtr2),y
beq .5
lda (ZPPtr2),y
beq .60
cmp #C.CR
beq .60
jsr PPP.ETCFILE.ERR1
bra .9
.60 jsr PPP.NextStrPtr2
lda (ZPPtr2)
bne .4
.7 jsr PPP.ETCFILE.ERR2
bra .9
.8 cmp #MLI.E.EOF
sec
bne .9
lda #0
clc
.9 php
pha
lda hETCFILE
>SYSCALL FClose
pla
plp
rts
*--------------------------------------
PPP.SkipCRLFPtr2
.1 lda (ZPPtr2)
beq .9
cmp #C.CR
bne .8
ldy #1
lda (ZPPtr2),y
beq .9
cmp #C.LF
bne .2
iny
.2 tya
clc
adc ZPPtr2
sta ZPPtr2
bcc .1
inc ZPPtr2+1
bra .1
.8 clc
rts
.9 sec
rts
*--------------------------------------
PPP.NextStrPtr2 ldy #$ff
.1 iny
lda (ZPPtr2),y
beq .2
cmp #C.CR
bne .1
.2 tya
clc
adc ZPPtr2
sta ZPPtr2
bcc .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
PPP.ETCFILE.ERR1
>PUSHW L.MSG.UNEXPECTED
>PUSHW L.IN.Buf
bra PPP.ETCFILE.ERR
*--------------------------------------
PPP.ETCFILE.ERR2
>PUSHW L.MSG.SYNTAX
>PUSHW L.IN.Buf
PPP.ETCFILE.ERR >PUSHBI 2
>SYSCALL PrintF
lda #MLI.E.IO
sec
rts
*--------------------------------------
SSC.Write >STYA ZPPtr1
ldy #$ff
.10 iny
lda (ZPPtr1),y
bne .10
lda #C.CR
sta (ZPPtr1),y
iny
lda #C.LF
sta (ZPPtr1),y
iny
sty Len
php
sei
ldx DEVSLOTn08F
ldy #0
.1 phy
ldy #0
.2 lda SSC.STATUS-$8F,x
bit #SSC.STATUS.nDCD true when 0
bne .9
bit #SSC.STATUS.TDRE Register Empty ?
bne .3
iny
bne .2
.9 pla
lda #MLI.E.IO
plp
sec
rts
.3 ply
lda (ZPPtr1),y
.6 sta SSC.DATA-$8F,x
iny
cpy Len
bne .1
plp
clc
rts
*--------------------------------------
SSC.Read php
sei
ldx DEVSLOTn08F
ldy #0
.1 phy
ldy #0
.2 lda SSC.STATUS-$8F,x
bit #SSC.STATUS.nDCD true when 0
bne .9
bit #SSC.STATUS.RDRF incoming char?
bne .3
iny
bne .2
ply
plp
clc
rts
.3 ply
lda SSC.DATA-$8F,x
sta IN.Buf,y
iny
bra .1
.9 lda #MLI.E.IO
plp
sec
rts
*--------------------------------------
MAN
SAVE usr/src/drv/pppssc.drv.s.e
LOAD usr/src/drv/pppssc.drv.s
ASM