mirror of
https://github.com/A2osX/A2osX.git
synced 2024-10-31 23:09:33 +00:00
1169 lines
22 KiB
Plaintext
1169 lines
22 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF drv/pppssc.drv
|
||
*--------------------------------------
|
||
.INB inc/macros.i
|
||
.INB inc/a2osx.i
|
||
.INB inc/mli.e.i
|
||
.INB inc/com.i
|
||
.INB inc/com.6551.i
|
||
.INB inc/nic.i
|
||
*--------------------------------------
|
||
INBUF.SIZE .EQ $800
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR ZPBIN
|
||
ZS.START
|
||
ZPArgsPtr .BS 2
|
||
ZPPtr1 .BS 2
|
||
ZPPtr2 .BS 2
|
||
ZPBufLen .BS 2
|
||
ZPIOCTL .BS 2
|
||
ZPBufPtr .BS 2
|
||
ZPCount .BS 2
|
||
ZPCount2 .BS 2
|
||
FCS .BS 2
|
||
Len .BS 1
|
||
hETCFILE .BS 1
|
||
|
||
ZS.END .ED
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp Dev.Detect cld,jmp abs=DRV
|
||
.DA #$61 6502,Level 1 (65c02)
|
||
.DA #1 DRV Layout Version 1
|
||
.DA 0
|
||
.DA CS.END-CS.START Code Length
|
||
.DA 0
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Relocation Table
|
||
*--------------------------------------
|
||
L.MSG.DETECT .DA MSG.DETECT
|
||
L.MSG.DETECT.OK .DA MSG.DETECT.OK
|
||
L.MSG.DETECT.KO .DA MSG.DETECT.KO
|
||
L.DRV.CS.START .DA DRV.CS.START
|
||
L.FD.DEV .DA FD.DEV
|
||
L.FD.DEV.NAME .DA FD.DEV.NAME
|
||
L.ETCFILE .DA ETCFILE
|
||
L.MSG.ETCFILE .DA MSG.ETCFILE
|
||
L.MSG.UNEXPECTED .DA MSG.UNEXPECTED
|
||
L.MSG.SYNTAX .DA MSG.SYNTAX
|
||
L.MSG.DUMPBUF .DA MSG.DUMPBUFS
|
||
.DA MSG.DUMPBUFR
|
||
L.MSG.HEXDUMP .DA MSG.HEXDUMP
|
||
L.PPP.LCPReq .DA PPP.LCPReq
|
||
L.PPP.IPCPReq .DA PPP.IPCPReq
|
||
L.FILE.Buf .DA FILE.Buf
|
||
L.FILE.Bufp1 .DA FILE.Buf+1
|
||
L.RCV.Buf .DA RCV.Buf
|
||
L.RCV.Bufp1 .DA RCV.Buf+1
|
||
L.RCV.Bufp2 .DA RCV.Buf+2
|
||
.DA 0 End Of Reloc Table
|
||
*--------------------------------------
|
||
Dev.Detect >STYA ZPArgsPtr
|
||
|
||
>LDYA L.MSG.DETECT
|
||
>SYSCALL PutS
|
||
stz ZPPtr1
|
||
|
||
lda #$C1
|
||
sta ZPPtr1+1
|
||
|
||
.1 and #$0f
|
||
tay
|
||
lda A2osX.S,y
|
||
bne .3
|
||
|
||
ldx #DEVSIG.Length-1
|
||
|
||
.2 ldy DEVSIG.Offset,x
|
||
lda (ZPPtr1),y
|
||
cmp DEVSIG.Value,x
|
||
bne .3
|
||
|
||
dex
|
||
bpl .2
|
||
|
||
bra .4
|
||
|
||
.3 inc FD.DEV.NAME+3
|
||
inc ZPPtr1+1 no match, try next slot....
|
||
lda ZPPtr1+1
|
||
cmp #$C8
|
||
bne .1
|
||
|
||
>LDYA L.MSG.DETECT.KO
|
||
>SYSCALL PutS
|
||
|
||
lda #MLI.E.NODEV Not Found in any slot, exiting
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
.4 lda ZPPtr1+1
|
||
asl
|
||
asl
|
||
asl
|
||
asl
|
||
clc
|
||
adc #$8F
|
||
sta DEVSLOTn08F
|
||
|
||
jsr SSC.Init
|
||
jsr PPP.ETCFILE
|
||
bcs .99
|
||
|
||
jsr PPP.Init
|
||
bcs .99
|
||
|
||
>PUSHW L.MSG.DETECT.OK
|
||
>PUSHW L.FD.DEV.NAME
|
||
>PUSHBI 2
|
||
>SYSCALL PrintF
|
||
|
||
>PUSHWI DRV.END
|
||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||
>PUSHWI DRV.CS.START
|
||
>LDYA L.DRV.CS.START
|
||
>SYSCALL InsDrv
|
||
.99 bcs .9
|
||
|
||
>STYA FD.DEV+S.FD.DEV.DRVPTR
|
||
|
||
>PUSHW L.FD.DEV
|
||
>PUSHW L.FD.DEV.NAME
|
||
>SYSCALL MKDev
|
||
bcs .9
|
||
|
||
lda FD.DEV.NAME+3
|
||
and #$0F
|
||
tax
|
||
lda #A2osX.S.NIC
|
||
sta A2osX.S,x
|
||
|
||
lda #0
|
||
sec
|
||
rts
|
||
|
||
.9 ldx DEVSLOTn08F
|
||
stz SSC.RESET-$8F,x
|
||
|
||
Dev.Detect.RTS rts
|
||
*--------------------------------------
|
||
PPP.ETCFILE >PUSHW L.ETCFILE
|
||
>PUSHBI O.RDONLY
|
||
>PUSHBI 0
|
||
>PUSHWZ
|
||
>SYSCALL FOpen
|
||
bcs Dev.Detect.RTS
|
||
|
||
sta hETCFILE
|
||
|
||
>PUSHW L.MSG.ETCFILE
|
||
>PUSHW L.ETCFILE
|
||
>PUSHBI 2
|
||
>SYSCALL PrintF
|
||
|
||
.1 >PUSHB hETCFILE
|
||
>PUSHW L.FILE.Buf
|
||
>PUSHWI 255
|
||
>SYSCALL FGetS
|
||
bcs .8
|
||
|
||
lda FILE.Buf
|
||
beq .1
|
||
|
||
cmp #'#'
|
||
beq .1
|
||
|
||
>LDYA L.FILE.Buf
|
||
>SYSCALL PutS
|
||
|
||
lda FILE.Buf
|
||
cmp #'>'
|
||
bne .2
|
||
|
||
>LDYA L.FILE.Bufp1
|
||
jsr SSC.WriteYA
|
||
bcs .9
|
||
|
||
.10 bra .1
|
||
|
||
.2 cmp #'?'
|
||
bne .7
|
||
*--------------------------------------
|
||
.3 jsr SSC.Read
|
||
bcs .9
|
||
|
||
tya
|
||
beq .3
|
||
|
||
lda #0
|
||
sta RCV.Buf,y
|
||
|
||
>LDYA L.RCV.Buf
|
||
>STYA ZPPtr2
|
||
|
||
.4 jsr PPP.SkipCRLFPtr2
|
||
bcs .3
|
||
|
||
ldy #$ff
|
||
|
||
.5 iny
|
||
lda FILE.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.RCV.Buf
|
||
>PUSHBI 2
|
||
>SYSCALL PrintF
|
||
lda #MLI.E.IO
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
PPP.ETCFILE.ERR2
|
||
>PUSHW L.MSG.SYNTAX
|
||
>PUSHW L.FILE.Buf
|
||
>PUSHBI 2
|
||
>SYSCALL PrintF
|
||
lda #MLI.E.IO
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
PPP.Init >LDYAI PPP.LCPReq.LEN
|
||
>STYA ZPBufLen
|
||
>LDYA L.PPP.LCPReq
|
||
jsr PPPFCS16
|
||
|
||
>LDYA L.PPP.LCPReq
|
||
ldx #0
|
||
jsr DumpBuf
|
||
|
||
>LDYA L.PPP.LCPReq
|
||
ldx #PPP.LCPReq.LEN
|
||
|
||
jsr SSC.WriteYAX
|
||
bcs .9
|
||
|
||
.1 jsr SSC.Read
|
||
bcs .9
|
||
|
||
tya
|
||
beq .1
|
||
|
||
sty ZPBufLen
|
||
stz ZPBufLen+1
|
||
|
||
>LDYA L.RCV.Buf
|
||
ldx #2
|
||
jsr DumpBuf
|
||
|
||
>LDYAI PPP.IPCPReq.LEN
|
||
>STYA ZPBufLen
|
||
>LDYA L.PPP.IPCPReq
|
||
jsr PPPFCS16
|
||
|
||
>LDYA L.PPP.IPCPReq
|
||
ldx #0
|
||
jsr DumpBuf
|
||
|
||
>LDYA L.PPP.IPCPReq
|
||
ldx #PPP.IPCPReq.LEN
|
||
|
||
jsr SSC.WriteYAX
|
||
bcs .9
|
||
|
||
.2 jsr SSC.Read
|
||
bcs .9
|
||
|
||
tya
|
||
beq .2
|
||
|
||
sty ZPBufLen
|
||
stz ZPBufLen+1
|
||
|
||
>LDYA L.RCV.Buf
|
||
ldx #2
|
||
jsr DumpBuf
|
||
|
||
sec
|
||
|
||
* clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
SSC.Init ldx DEVSLOTn08F
|
||
stz SSC.RESET-$8F,x
|
||
|
||
lda #SSC.CTL.1S+SSC.CTL.8D+SSC.CTL.CLKINT+SSC.CTL.B115200
|
||
sta SSC.CTL-$8F,x
|
||
lda #SSC.CMD.NOP+SSC.CMD.TE+SSC.CMD.RIRQDIS+SSC.CMD.DTR
|
||
sta SSC.CMD-$8F,x
|
||
|
||
lda SSC.DATA-$8F,x discard any garbage byte
|
||
lda SSC.STATUS-$8F,x clear any IRQ pending
|
||
rts
|
||
*--------------------------------------
|
||
SSC.WriteYA >STYA ZPPtr1
|
||
|
||
ldy #$ff
|
||
|
||
.1 iny
|
||
lda (ZPPtr1),y
|
||
bne .1
|
||
|
||
lda #C.CR
|
||
sta (ZPPtr1),y
|
||
iny
|
||
|
||
lda #C.LF
|
||
sta (ZPPtr1),y
|
||
iny
|
||
|
||
sty Len
|
||
|
||
bra SSC.Write
|
||
|
||
SSC.WriteYAX >STYA ZPPtr1
|
||
stx Len
|
||
|
||
SSC.Write 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
|
||
pha
|
||
and #$7F
|
||
cmp #C.XON
|
||
beq .4
|
||
|
||
cmp #C.XOFF
|
||
bne .6
|
||
|
||
.4 lda #$7D
|
||
sta SSC.DATA-$8F,x
|
||
|
||
.5 lda SSC.STATUS-$8F,x
|
||
bit #SSC.STATUS.TDRE
|
||
beq .5
|
||
|
||
pla
|
||
ora #$20
|
||
.HS F0 BEQ
|
||
|
||
.6 pla
|
||
|
||
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 RCV.Buf,y
|
||
iny
|
||
|
||
bra .1
|
||
|
||
.9 lda #MLI.E.IO
|
||
plp
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DumpBuf >STYA ZPPtr1
|
||
|
||
>PUSHW L.MSG.DUMPBUF,x
|
||
>PUSHW ZPBufLen
|
||
>PUSHBI 2
|
||
>SYSCALL PrintF
|
||
bcs .9
|
||
|
||
lda (ZPPtr1)
|
||
cmp #$0D
|
||
bne DumpBuf.PPP
|
||
|
||
lda ZPBufLen
|
||
eor #$ff
|
||
sta ZPBufLen
|
||
lda ZPBufLen+1
|
||
eor #$ff
|
||
sta ZPBufLen+1
|
||
|
||
.1 inc ZPBufLen
|
||
bne .2
|
||
|
||
inc ZPBufLen+1
|
||
beq .9
|
||
|
||
.2 lda (ZPPtr1)
|
||
inc ZPPtr1
|
||
bne .3
|
||
|
||
inc ZPPtr1+1
|
||
|
||
.3 cmp #$0D
|
||
beq .4
|
||
|
||
cmp #$0A
|
||
beq .4
|
||
|
||
cmp #C.SPACE
|
||
bcs .4
|
||
|
||
ora #$20
|
||
|
||
.4 >SYSCALL PutChar
|
||
bcc .1
|
||
|
||
.9 rts
|
||
|
||
DumpBuf.PPP stz ZPPtr2
|
||
stz ZPPtr2+1
|
||
|
||
.1 >PUSHW L.MSG.HEXDUMP
|
||
>PUSHW ZPPtr2
|
||
|
||
ldy #0
|
||
|
||
.2 >PUSHB (ZPPtr1),y
|
||
iny
|
||
cpy #8
|
||
bne .2
|
||
|
||
>PUSHBI 10
|
||
>SYSCALL PrintF
|
||
bcs .9
|
||
|
||
lda ZPPtr1
|
||
adc #8
|
||
sta ZPPtr1
|
||
lda ZPPtr1+1
|
||
adc #0
|
||
sta ZPPtr1+1
|
||
|
||
lda ZPPtr2
|
||
adc #8
|
||
sta ZPPtr2
|
||
lda ZPPtr2+1
|
||
adc #0
|
||
sta ZPPtr2+1
|
||
|
||
lda ZPBufLen
|
||
sec
|
||
sbc #8
|
||
sta ZPBufLen
|
||
lda ZPBufLen+1
|
||
sbc #0
|
||
sta ZPBufLen+1
|
||
bcc .9
|
||
|
||
ora ZPBufLen
|
||
bne .1
|
||
|
||
clc
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
PPPFCS16 >STYA ZPPtr1
|
||
|
||
lda #$ff
|
||
sta FCS
|
||
sta FCS+1
|
||
|
||
lda ZPBufLen
|
||
sec
|
||
sbc #4 minus 7E .... FCS FCS 7E
|
||
eor #$ff
|
||
sta ZPPtr2
|
||
|
||
lda ZPBufLen+1
|
||
sbc #0
|
||
eor #$ff
|
||
sta ZPPtr2+1
|
||
|
||
.1 inc ZPPtr2
|
||
bne .2
|
||
|
||
inc ZPPtr2+1
|
||
beq .8
|
||
|
||
.2 inc ZPPtr1 skip First 7E
|
||
bne .3
|
||
|
||
inc ZPPtr1+1
|
||
|
||
.3 lda (ZPPtr1)
|
||
eor FCS
|
||
tax
|
||
|
||
lda FCS.LO,x
|
||
eor FCS+1
|
||
sta FCS
|
||
|
||
lda FCS.HI,x
|
||
sta FCS+1
|
||
|
||
bra .1
|
||
|
||
.8 lda FCS+1
|
||
eor #$ff
|
||
ldy #1
|
||
sta (ZPPtr1),y
|
||
|
||
lda FCS
|
||
eor #$ff
|
||
iny
|
||
sta (ZPPtr1),y
|
||
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
FCS.LO .DA #$0000,#$1189,#$2312,#$329b,#$4624,#$57ad,#$6536,#$74bf
|
||
.DA #$8c48,#$9dc1,#$af5a,#$bed3,#$ca6c,#$dbe5,#$e97e,#$f8f7
|
||
.DA #$1081,#$0108,#$3393,#$221a,#$56a5,#$472c,#$75b7,#$643e
|
||
.DA #$9cc9,#$8d40,#$bfdb,#$ae52,#$daed,#$cb64,#$f9ff,#$e876
|
||
.DA #$2102,#$308b,#$0210,#$1399,#$6726,#$76af,#$4434,#$55bd
|
||
.DA #$ad4a,#$bcc3,#$8e58,#$9fd1,#$eb6e,#$fae7,#$c87c,#$d9f5
|
||
.DA #$3183,#$200a,#$1291,#$0318,#$77a7,#$662e,#$54b5,#$453c
|
||
.DA #$bdcb,#$ac42,#$9ed9,#$8f50,#$fbef,#$ea66,#$d8fd,#$c974
|
||
.DA #$4204,#$538d,#$6116,#$709f,#$0420,#$15a9,#$2732,#$36bb
|
||
.DA #$ce4c,#$dfc5,#$ed5e,#$fcd7,#$8868,#$99e1,#$ab7a,#$baf3
|
||
.DA #$5285,#$430c,#$7197,#$601e,#$14a1,#$0528,#$37b3,#$263a
|
||
.DA #$decd,#$cf44,#$fddf,#$ec56,#$98e9,#$8960,#$bbfb,#$aa72
|
||
.DA #$6306,#$728f,#$4014,#$519d,#$2522,#$34ab,#$0630,#$17b9
|
||
.DA #$ef4e,#$fec7,#$cc5c,#$ddd5,#$a96a,#$b8e3,#$8a78,#$9bf1
|
||
.DA #$7387,#$620e,#$5095,#$411c,#$35a3,#$242a,#$16b1,#$0738
|
||
.DA #$ffcf,#$ee46,#$dcdd,#$cd54,#$b9eb,#$a862,#$9af9,#$8b70
|
||
.DA #$8408,#$9581,#$a71a,#$b693,#$c22c,#$d3a5,#$e13e,#$f0b7
|
||
.DA #$0840,#$19c9,#$2b52,#$3adb,#$4e64,#$5fed,#$6d76,#$7cff
|
||
.DA #$9489,#$8500,#$b79b,#$a612,#$d2ad,#$c324,#$f1bf,#$e036
|
||
.DA #$18c1,#$0948,#$3bd3,#$2a5a,#$5ee5,#$4f6c,#$7df7,#$6c7e
|
||
.DA #$a50a,#$b483,#$8618,#$9791,#$e32e,#$f2a7,#$c03c,#$d1b5
|
||
.DA #$2942,#$38cb,#$0a50,#$1bd9,#$6f66,#$7eef,#$4c74,#$5dfd
|
||
.DA #$b58b,#$a402,#$9699,#$8710,#$f3af,#$e226,#$d0bd,#$c134
|
||
.DA #$39c3,#$284a,#$1ad1,#$0b58,#$7fe7,#$6e6e,#$5cf5,#$4d7c
|
||
.DA #$c60c,#$d785,#$e51e,#$f497,#$8028,#$91a1,#$a33a,#$b2b3
|
||
.DA #$4a44,#$5bcd,#$6956,#$78df,#$0c60,#$1de9,#$2f72,#$3efb
|
||
.DA #$d68d,#$c704,#$f59f,#$e416,#$90a9,#$8120,#$b3bb,#$a232
|
||
.DA #$5ac5,#$4b4c,#$79d7,#$685e,#$1ce1,#$0d68,#$3ff3,#$2e7a
|
||
.DA #$e70e,#$f687,#$c41c,#$d595,#$a12a,#$b0a3,#$8238,#$93b1
|
||
.DA #$6b46,#$7acf,#$4854,#$59dd,#$2d62,#$3ceb,#$0e70,#$1ff9
|
||
.DA #$f78f,#$e606,#$d49d,#$c514,#$b1ab,#$a022,#$92b9,#$8330
|
||
.DA #$7bc7,#$6a4e,#$58d5,#$495c,#$3de3,#$2c6a,#$1ef1,#$0f78
|
||
*--------------------------------------
|
||
FCS.HI .DA /$0000,/$1189,/$2312,/$329b,/$4624,/$57ad,/$6536,/$74bf
|
||
.DA /$8c48,/$9dc1,/$af5a,/$bed3,/$ca6c,/$dbe5,/$e97e,/$f8f7
|
||
.DA /$1081,/$0108,/$3393,/$221a,/$56a5,/$472c,/$75b7,/$643e
|
||
.DA /$9cc9,/$8d40,/$bfdb,/$ae52,/$daed,/$cb64,/$f9ff,/$e876
|
||
.DA /$2102,/$308b,/$0210,/$1399,/$6726,/$76af,/$4434,/$55bd
|
||
.DA /$ad4a,/$bcc3,/$8e58,/$9fd1,/$eb6e,/$fae7,/$c87c,/$d9f5
|
||
.DA /$3183,/$200a,/$1291,/$0318,/$77a7,/$662e,/$54b5,/$453c
|
||
.DA /$bdcb,/$ac42,/$9ed9,/$8f50,/$fbef,/$ea66,/$d8fd,/$c974
|
||
.DA /$4204,/$538d,/$6116,/$709f,/$0420,/$15a9,/$2732,/$36bb
|
||
.DA /$ce4c,/$dfc5,/$ed5e,/$fcd7,/$8868,/$99e1,/$ab7a,/$baf3
|
||
.DA /$5285,/$430c,/$7197,/$601e,/$14a1,/$0528,/$37b3,/$263a
|
||
.DA /$decd,/$cf44,/$fddf,/$ec56,/$98e9,/$8960,/$bbfb,/$aa72
|
||
.DA /$6306,/$728f,/$4014,/$519d,/$2522,/$34ab,/$0630,/$17b9
|
||
.DA /$ef4e,/$fec7,/$cc5c,/$ddd5,/$a96a,/$b8e3,/$8a78,/$9bf1
|
||
.DA /$7387,/$620e,/$5095,/$411c,/$35a3,/$242a,/$16b1,/$0738
|
||
.DA /$ffcf,/$ee46,/$dcdd,/$cd54,/$b9eb,/$a862,/$9af9,/$8b70
|
||
.DA /$8408,/$9581,/$a71a,/$b693,/$c22c,/$d3a5,/$e13e,/$f0b7
|
||
.DA /$0840,/$19c9,/$2b52,/$3adb,/$4e64,/$5fed,/$6d76,/$7cff
|
||
.DA /$9489,/$8500,/$b79b,/$a612,/$d2ad,/$c324,/$f1bf,/$e036
|
||
.DA /$18c1,/$0948,/$3bd3,/$2a5a,/$5ee5,/$4f6c,/$7df7,/$6c7e
|
||
.DA /$a50a,/$b483,/$8618,/$9791,/$e32e,/$f2a7,/$c03c,/$d1b5
|
||
.DA /$2942,/$38cb,/$0a50,/$1bd9,/$6f66,/$7eef,/$4c74,/$5dfd
|
||
.DA /$b58b,/$a402,/$9699,/$8710,/$f3af,/$e226,/$d0bd,/$c134
|
||
.DA /$39c3,/$284a,/$1ad1,/$0b58,/$7fe7,/$6e6e,/$5cf5,/$4d7c
|
||
.DA /$c60c,/$d785,/$e51e,/$f497,/$8028,/$91a1,/$a33a,/$b2b3
|
||
.DA /$4a44,/$5bcd,/$6956,/$78df,/$0c60,/$1de9,/$2f72,/$3efb
|
||
.DA /$d68d,/$c704,/$f59f,/$e416,/$90a9,/$8120,/$b3bb,/$a232
|
||
.DA /$5ac5,/$4b4c,/$79d7,/$685e,/$1ce1,/$0d68,/$3ff3,/$2e7a
|
||
.DA /$e70e,/$f687,/$c41c,/$d595,/$a12a,/$b0a3,/$8238,/$93b1
|
||
.DA /$6b46,/$7acf,/$4854,/$59dd,/$2d62,/$3ceb,/$0e70,/$1ff9
|
||
.DA /$f78f,/$e606,/$d49d,/$c514,/$b1ab,/$a022,/$92b9,/$8330
|
||
.DA /$7bc7,/$6a4e,/$58d5,/$495c,/$3de3,/$2c6a,/$1ef1,/$0f78
|
||
*--------------------------------------
|
||
DEVSIG.Offset .HS 05070B0C
|
||
DEVSIG.Value .HS 38180131
|
||
DEVSIG.Length .EQ DEVSIG.Value-DEVSIG.Offset
|
||
MSG.DETECT .AZ "PPP Driver For Apple SSC."
|
||
MSG.DETECT.OK .AZ "PPP Installed As Device : %s\r\n"
|
||
MSG.DETECT.KO .AZ "No SSC Found."
|
||
ETCFILE .AZ "${ROOT}etc/ppp.conf"
|
||
*--------------------------------------
|
||
MSG.ETCFILE .AZ "Executing %s File...\r\n"
|
||
MSG.UNEXPECTED .AZ "\r\nERR:Unexpected reply From Modem\r\n{%s}\r\n"
|
||
MSG.SYNTAX .AZ "\r\nERR:Bad Syntax In ppp.conf\r\n{%s}\r\n"
|
||
MSG.DUMPBUFS .AZ "Send:%H\r\n"
|
||
MSG.DUMPBUFR .AZ "Recv:%H\r\n"
|
||
MSG.HEXDUMP .AZ "%H:%h %h %h %h %h %h %h %h\r\n"
|
||
*--------------------------------------
|
||
FD.DEV .DA #S.FD.T.CDEV
|
||
.DA #0 HANDLER
|
||
.DA #0 BUSID
|
||
.DA #0 DEVID
|
||
.DA 0 BUSPTR
|
||
.BS 2 DRVPTR
|
||
.DA 0 DCBPTR
|
||
.DA 0 BUFPTR
|
||
FD.DEV.NAME .AZ "eth1"
|
||
*--------------------------------------
|
||
PPP.LCPReq .HS 7E
|
||
PPP.LCPReq.START
|
||
.HS FF03
|
||
.HS C021 LCP
|
||
PPP.LCPReq.DATA .HS 01 Configure-Request
|
||
.HS 01 ID
|
||
.DA /PPP.LCPReq.DATA.LEN,#PPP.LCPReq.DATA.LEN
|
||
.HS 01.04 MRU
|
||
.DA /576,#576
|
||
.HS 02.06.000A0000 ACCM
|
||
.HS 05.06.002A2B78 MAGIC
|
||
* .HS 07.02
|
||
* .HS 08.02
|
||
PPP.LCPReq.DATA.LEN .EQ *-PPP.LCPReq.DATA
|
||
* .HS 0000 PADDING
|
||
.BS 2 FCS
|
||
.HS 7E
|
||
PPP.LCPReq.LEN .EQ *-PPP.LCPReq
|
||
*--------------------------------------
|
||
PPP.IPCPReq .HS 7E
|
||
PPP.IPCPReq.START
|
||
.HS FF03
|
||
.HS 8021 IPCP
|
||
PPP.IPCPReq.DATA .HS 01 Configure-Request
|
||
.HS 01 ID
|
||
.DA /PPP.IPCPReq.DATA.LEN,#PPP.IPCPReq.DATA.LEN
|
||
.HS 03.06.00.00.00.00 IP Address
|
||
PPP.IPCPReq.DATA.LEN .EQ *-PPP.IPCPReq.DATA
|
||
* .HS 0000 PADDING
|
||
.BS 2 FCS
|
||
.HS 7E
|
||
PPP.IPCPReq.LEN .EQ *-PPP.IPCPReq
|
||
*--------------------------------------
|
||
FILE.Buf .BS 256
|
||
RCV.Buf .BS 256
|
||
*--------------------------------------
|
||
* Driver Code
|
||
*--------------------------------------
|
||
DRV.CS.START cld
|
||
jmp (.1,x)
|
||
.1 .DA STATUS
|
||
.DA A2osX.BADCALL
|
||
.DA A2osX.BADCALL
|
||
.DA A2osX.BADCALL
|
||
.DA CONTROL
|
||
.DA A2osX.BADCALL
|
||
.DA OPEN
|
||
.DA CLOSE
|
||
.DA READ
|
||
.DA WRITE
|
||
.DA IRQ
|
||
.DA 0 end or relocation
|
||
*--------------------------------------
|
||
STATUS jsr STATUS.CONTROL.Init
|
||
ldy #S.IOCTL.S
|
||
lda (ZPIOCTL),y
|
||
beq .1
|
||
|
||
cmp #S.IOCTL.S.GETDIB
|
||
bne STATUS.DCB
|
||
|
||
ldy #S.DIB-1
|
||
.HS 2C bit abs
|
||
.1 ldy #3
|
||
|
||
.2 lda DIB,y
|
||
sta (ZPBufPtr),y
|
||
dey
|
||
bpl .2
|
||
|
||
clc
|
||
rts
|
||
|
||
STATUS.DCB cmp #S.IOCTL.S.GETDCB
|
||
bne .3
|
||
|
||
ldy #S.DCB.COM-1
|
||
.2 lda DCB,y
|
||
sta (ZPBufPtr),y
|
||
dey
|
||
bpl .2
|
||
|
||
clc
|
||
rts
|
||
|
||
.3 cmp #S.IOCTL.S.EOF
|
||
bne STATUS.9
|
||
|
||
lda DIB+S.DIB.S
|
||
and #S.DIB.S.OPENED
|
||
beq OPEN.E
|
||
|
||
lda INBUF.TAIL
|
||
eor INBUF.HEAD
|
||
bne .8 NO DATA? eof = TRUE
|
||
|
||
lda INBUF.TAIL+1
|
||
eor INBUF.HEAD+1
|
||
bne .8
|
||
|
||
lda #1
|
||
clc
|
||
rts
|
||
|
||
.8 lda #0
|
||
clc
|
||
rts
|
||
|
||
STATUS.9 lda #MLI.E.BADCTL
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
CONTROL jsr STATUS.CONTROL.Init
|
||
|
||
ldy #S.IOCTL.C
|
||
lda (ZPIOCTL),y
|
||
cmp #S.IOCTL.C.SETDCB
|
||
bne STATUS.9
|
||
|
||
ldy #S.DCB.COM-1
|
||
|
||
.2 lda (ZPBufPtr),y
|
||
sta DCB,y
|
||
dey
|
||
bpl .2
|
||
*--------------------------------------
|
||
OPEN lda DIB+S.DIB.S
|
||
bit #S.DIB.S.OPENED
|
||
beq OPEN.1
|
||
|
||
OPEN.E lda #MLI.E.OPEN
|
||
sec
|
||
rts
|
||
|
||
OPEN.1 >LDYAI INBUF.SIZE
|
||
>SYSCALL2 GetMem
|
||
bcs .9
|
||
|
||
stx hINBUF
|
||
>STYA INBUF.PTR
|
||
>STYA READ.BUF+1
|
||
>STYA IRQ.BUF+1
|
||
|
||
stz INBUF.TAIL
|
||
stz INBUF.TAIL+1
|
||
stz INBUF.HEAD
|
||
stz INBUF.HEAD+1
|
||
stz INBUF.CNT
|
||
stz INBUF.CNT+1
|
||
|
||
php
|
||
sei
|
||
ldx DEVSLOTn08F
|
||
stz SSC.RESET-$8F,x
|
||
|
||
lda #SSC.CTL.CLKINT+SSC.CTL.B115200+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
|
||
sta SSC.CTL-$8F,x
|
||
lda #SSC.CMD.TE+SSC.CMD.DTR
|
||
sta SSC.CMD-$8F,x
|
||
|
||
lda SSC.DATA-$8F,x discard any garbage byte
|
||
lda SSC.STATUS-$8F,x clear any IRQ pending
|
||
|
||
lda #S.DIB.S.OPENED
|
||
tsb DIB+S.DIB.S
|
||
|
||
plp
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
CLOSE php
|
||
sei
|
||
ldx DEVSLOTn08F
|
||
stz SSC.RESET-$8F,x
|
||
|
||
lda #S.DIB.S.OPENED
|
||
trb DIB+S.DIB.S
|
||
|
||
lda hINBUF
|
||
>SYSCALL2 FreeMem
|
||
|
||
plp
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
READ php
|
||
sei
|
||
jsr READ.WRITE.Init
|
||
|
||
lda INBUF.CNT
|
||
ora INBUF.CNT+1
|
||
beq READ.9
|
||
|
||
stz ZPCount2
|
||
stz ZPCount2+1
|
||
|
||
ldy INBUF.TAIL
|
||
|
||
READ.1 inc ZPCount
|
||
bne READ.BUF
|
||
|
||
inc ZPCount+1
|
||
beq READ.8
|
||
|
||
READ.BUF lda $FFFF,y SELF MODIFIED
|
||
sta (ZPBufPtr)
|
||
inc ZPBufPtr
|
||
bne .1
|
||
|
||
inc ZPBufPtr+1
|
||
|
||
.1 inc ZPCount2
|
||
bne .2
|
||
|
||
inc ZPCount2+1
|
||
|
||
.2 iny
|
||
bne .3
|
||
|
||
inc READ.BUF+2
|
||
|
||
inc INBUF.TAIL+1
|
||
lda INBUF.TAIL+1
|
||
cmp /INBUF.SIZE
|
||
bne .3
|
||
|
||
lda INBUF.PTR+1
|
||
sta READ.BUF+2
|
||
|
||
.3 lda INBUF.CNT
|
||
ldx INBUF.CNT+1
|
||
clc
|
||
sbc #0
|
||
bcs .4
|
||
dex
|
||
bmi .8
|
||
|
||
stx INBUF.CNT+1
|
||
|
||
.4 sta INBUF.CNT
|
||
bra READ.1
|
||
|
||
.8 sty INBUF.TAIL
|
||
|
||
READ.8 lda ZPCount2
|
||
ldy #S.IOCTL.BYTECNT
|
||
sta (ZPIOCTL),y
|
||
iny
|
||
lda ZPCount2+1
|
||
sta (ZPIOCTL),y
|
||
|
||
plp
|
||
clc
|
||
rts
|
||
|
||
READ.9 lda SSC.STATUS-$8F,x
|
||
bit #SSC.STATUS.nDCD true when 0
|
||
beq .99
|
||
|
||
lda #MLI.E.IO
|
||
.HS 2C BIT ABS
|
||
|
||
.99 lda #E.NODATA
|
||
plp
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
WRITE php
|
||
sei
|
||
jsr READ.WRITE.Init
|
||
|
||
lda SSC.STATUS-$8F,x
|
||
bit #SSC.STATUS.nDCD true when 0
|
||
bne .9
|
||
|
||
ldy #0
|
||
|
||
.1 inc ZPCount
|
||
bne .2
|
||
|
||
inc ZPCount+1
|
||
beq .8
|
||
|
||
.2 lda SSC.STATUS-$8F,x
|
||
and #SSC.STATUS.TDRE Register Empty ?
|
||
beq .2
|
||
|
||
lda (ZPBufPtr),y
|
||
sta SSC.DATA-$8F,x
|
||
iny
|
||
bne .1
|
||
|
||
inc ZPBufPtr+1
|
||
bra .1
|
||
|
||
.8 plp
|
||
clc
|
||
rts
|
||
|
||
.9 lda #MLI.E.IO
|
||
plp
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
READ.WRITE.Init ldx DEVSLOTn08F
|
||
|
||
STATUS.CONTROL.Init
|
||
>STYA ZPIOCTL
|
||
|
||
ldy #S.IOCTL.BUFPTR
|
||
lda (ZPIOCTL),y
|
||
sta ZPBufPtr
|
||
|
||
iny
|
||
|
||
lda (ZPIOCTL),y
|
||
sta ZPBufPtr+1
|
||
iny #S.IOCTL.BYTECNT
|
||
|
||
lda (ZPIOCTL),y
|
||
eor #$ff
|
||
sta ZPCount
|
||
|
||
iny
|
||
|
||
lda (ZPIOCTL),y
|
||
eor #$ff
|
||
sta ZPCount+1
|
||
rts
|
||
*--------------------------------------
|
||
* IRQ Handler
|
||
* on exit, CC if handled
|
||
*--------------------------------------
|
||
IRQ ldx DEVSLOTn08F
|
||
lda SSC.STATUS-$8F,x
|
||
* and #SSC.STATUS.IRQ
|
||
bpl IRQ.9 IRQ from this device ? no, exit !!!!Applewin bug #308!!!!
|
||
|
||
bit #SSC.STATUS.RDRF incoming char?
|
||
beq IRQ.8
|
||
|
||
ldy INBUF.HEAD
|
||
|
||
IRQ.1 lda SSC.DATA-$8F,x read data to clear IRQ
|
||
IRQ.BUF sta $FFFF,y SELF MODIFIED
|
||
|
||
inc INBUF.CNT
|
||
bne .1
|
||
|
||
inc INBUF.CNT+1
|
||
|
||
.1 iny
|
||
bne .2
|
||
|
||
inc IRQ.BUF+2
|
||
|
||
inc INBUF.HEAD+1
|
||
lda INBUF.HEAD+1
|
||
cmp /INBUF.SIZE
|
||
bne .2
|
||
|
||
lda INBUF.PTR+1
|
||
sta IRQ.BUF+2
|
||
|
||
lda #0
|
||
|
||
.2 bit SSC.STATUS-$8F,x
|
||
bmi IRQ.1
|
||
|
||
inc
|
||
bne .2
|
||
|
||
sty INBUF.HEAD
|
||
|
||
IRQ.8 clc
|
||
rts
|
||
|
||
IRQ.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.CS.END
|
||
*--------------------------------------
|
||
DEVSLOTn08F .BS 1
|
||
hINBUF .BS 1
|
||
INBUF.PTR .BS 2
|
||
INBUF.TAIL .BS 2
|
||
INBUF.HEAD .BS 2
|
||
INBUF.CNT .BS 2
|
||
*--------------------------------------
|
||
DIB .DA #S.DIB.S.IRQ
|
||
.DA #0,#0,#0 size
|
||
>PSTR "SSC/PPP Driver "
|
||
.DA #S.DIB.T.NIC
|
||
.DA #0
|
||
.DA K.VER
|
||
*--------------------------------------
|
||
DCB .DA #S.DCB.T.NIC
|
||
.DA #S.DCB.NIC.FLAGS.ARPOFFLOAD
|
||
.DA #S.DCB.NIC.LINK.OK+S.DCB.NIC.LINK.FD
|
||
.DA #S.DCB.NIC.SPEED.10
|
||
.HS 000000000000 MAC
|
||
.BS 12 IP/MASK/GW
|
||
*--------------------------------------
|
||
DRV.END
|
||
MAN
|
||
SAVE usr/src/drv/pppssc.drv.s
|
||
ASM
|