A2osX/SYS/PM.VEDRIVE.S.U2.txt

443 lines
7.1 KiB
Plaintext
Raw Permalink Normal View History

2022-03-13 12:58:15 +00:00
NEW
AUTO 3,1
*--------------------------------------
U2.Init lda CONF.SLOT
asl
asl
asl
asl
clc
adc #$88
sta Slotn0
tax
lda #W5100.MR.RST
sta W5100.MR,x
lda #0
.1 dec give some time....
bne .1
lda #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND
sta W5100.MR,x
pha
pla
lda W5100.MR,x
cmp #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND
bne .9
>AR.SELECT RTR
lda W5100.DR,x Get RTR HI
cmp /2000
bne .9
lda W5100.DR,x Get RTR LO
cmp #2000
beq .3
.9 sec
rts
.3 lda CONF.SLOT
pha
lda #0
pha
pha
lda #U2.Name
pha
lda /U2.Name
pha
>LDYAI VEDRIVE.NICOK
jsr PrintFYA
ldx Slotn0
lda #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND
sta W5100.MR,x
>AR.SELECT SHAR
ldy #0
.4 lda CONF.SRCMAC,y
sta W5100.DR,x
iny
cpy #6
bne .4
>AR.SELECT RMSR
lda #3 8k,0k,0k,0k
sta W5100.DR,x ...for Socket RX Buffers
sta W5100.DR,x ...for Socket TX Buffers
>AR.SELECT S0.MR
lda #W5100.AR.Sn.MR.MACRAW+W5100.AR.Sn.MR.MF
sta W5100.DR,x
>AR.SELECT S0.CR
lda #W5100.AR.Sn.CR.OPEN
sta W5100.DR,x
clc
rts
*--------------------------------------
U2.Read php
sei
ldx Slotn0
>AR.SELECT S0.RX.RSR
lda W5100.DR,x get the received size HI
nop
nop
ora W5100.DR,x LO
bne .1
jmp U2.READWRITE.9
.1 >AR.SELECT S0.RX.RD
lda W5100.DR,x get the received ptr HI
sta Offset+1
ldy W5100.DR,x get the received ptr LO
sty Offset
and /RXTX.MASK
ora /RX.BASE
sta W5100.AR,x
tya
sta W5100.AR+1,x
lda W5100.DR,x get RX.Size HI (Frame size + 2)
sta TotalSize+1
lda W5100.DR,x get RX.Size LO
sta TotalSize
sec
sbc #2 MACRAW:strip 2 bytes Header from Size
sta ZPBufCnt
eor #$ff
sta ZPnCnt
lda TotalSize+1
sbc #0
sta ZPBufCnt+1
2022-03-13 12:58:15 +00:00
eor #$ff
sta ZPnCnt+1
lda ZPBufPtr+1
pha
ldy #0
.2 inc ZPnCnt
bne .3
inc ZPnCnt+1
beq .8
.3 lda W5100.DR,x
sta (ZPBufPtr),y
iny
bne .2
inc ZPBufPtr+1
bra .2
.8 >AR.SELECT S0.RX.RD
lda Offset
clc
adc TotalSize
pha save LO
lda Offset+1
adc TotalSize+1
sta W5100.DR,x write HI
pla
sta W5100.DR,x write LO
>AR.SELECT S0.CR
lda #W5100.AR.Sn.CR.RCVD
sta W5100.DR,x
pla
sta ZPBufPtr+1
plp
clc
rts
*--------------------------------------
U2.READWRITE.9 plp
sec
rts
*--------------------------------------
U2.Write php
sei
ldx Slotn0
lda ZPBufCnt
eor #$ff
sta ZPnCnt
lda ZPBufCnt+1
eor #$ff
sta ZPnCnt+1
>AR.SELECT S0.TX.FSR
lda W5100.DR,x get send size HI
nop
nop
ldy W5100.DR,x LO
cpy ZPBufCnt
sbc ZPBufCnt+1
bcc U2.READWRITE.9
>AR.SELECT S0.TX.WR
lda W5100.DR,x Get HI
nop
nop
ldy W5100.DR,x Get LO
and /RXTX.MASK
ora /TX.BASE
sta W5100.AR,x Write HI
sta Offset+1
tya
sta W5100.AR+1,x Write LO
sta Offset
ldy #0
.2 inc ZPnCnt
bne .3
inc ZPnCnt+1
beq .8
.3 lda (ZPBufPtr),y
sta W5100.DR,x
iny
bne .2
inc ZPBufPtr+1
bra .2
.8 >AR.SELECT S0.TX.WR
lda Offset
clc
adc ZPBufCnt
pha save LO
lda Offset+1
adc ZPBufCnt+1
sta W5100.DR,x write HI
pla
sta W5100.DR,x write LO
>AR.SELECT S0.CR
lda #W5100.AR.Sn.CR.SEND
sta W5100.DR,x
plp
clc
rts
*--------------------------------------
U2.Name .PS "Uthernet II"
2022-03-13 12:58:15 +00:00
Offset .BS 2
TotalSize .BS 2
*--------------------------------------
2022-04-19 18:24:34 +00:00
DRV.U2 .PH DRV.NIC.START
2022-03-13 12:58:15 +00:00
2022-04-19 18:24:34 +00:00
jmp DRV.U2.SendARP
jmp DRV.U2.SendUDP
2022-03-13 12:58:15 +00:00
2022-04-19 18:24:34 +00:00
DRV.U2.Rcvd php
2022-03-13 12:58:15 +00:00
sei
2022-04-19 18:24:34 +00:00
ldx DRV.BLK.Slotn0
2022-03-13 12:58:15 +00:00
>AR.SELECT S0.RX.RSR
lda W5100.DR,x get the received size HI
nop
nop
ora W5100.DR,x LO
bne .1
jmp DRV.U2.9
.1 >AR.SELECT S0.RX.RD
lda W5100.DR,x get the received ptr HI
2022-03-15 19:33:19 +00:00
sta DRV.Offset+1
2022-03-13 12:58:15 +00:00
ldy W5100.DR,x get the received ptr LO
2022-03-15 19:33:19 +00:00
sty DRV.Offset
2022-03-13 12:58:15 +00:00
and /RXTX.MASK
ora /RX.BASE
sta W5100.AR,x
tya
sta W5100.AR+1,x
lda W5100.DR,x get RX.Size HI (Frame size + 2)
2022-03-15 19:33:19 +00:00
sta DRV.TotalSize+1
2022-03-13 12:58:15 +00:00
lda W5100.DR,x get RX.Size LO
2022-03-15 19:33:19 +00:00
sta DRV.TotalSize
2022-03-13 12:58:15 +00:00
2022-03-15 19:33:19 +00:00
* lda DRV.TotalSize
2022-03-13 12:58:15 +00:00
sec
sbc #2 MACRAW:strip 2 bytes Header from Size
2022-04-19 18:24:34 +00:00
sta DRV.FrameSize
2022-03-13 12:58:15 +00:00
eor #$ff
2022-03-15 19:33:19 +00:00
sta DRV.nCnt
2022-03-13 12:58:15 +00:00
2022-03-15 19:33:19 +00:00
lda DRV.TotalSize+1
2022-03-13 12:58:15 +00:00
sbc #0
2022-04-19 18:24:34 +00:00
sta DRV.FrameSize+1
2022-03-13 12:58:15 +00:00
eor #$ff
2022-03-15 19:33:19 +00:00
sta DRV.nCnt+1
2022-04-19 18:24:34 +00:00
>LDYAI DRV.InBuf
>STYA DRV.A1L
2022-03-13 12:58:15 +00:00
ldy #0
2022-03-15 19:33:19 +00:00
.2 inc DRV.nCnt
2022-03-13 12:58:15 +00:00
bne .3
2022-03-15 19:33:19 +00:00
inc DRV.nCnt+1
2022-03-13 12:58:15 +00:00
beq .8
.3 lda W5100.DR,x
2022-04-19 18:24:34 +00:00
sta (DRV.A1L),y
2022-03-13 12:58:15 +00:00
iny
bne .2
2022-04-19 18:24:34 +00:00
inc DRV.A1H
2022-03-13 12:58:15 +00:00
bra .2
.8 >AR.SELECT S0.RX.RD
2022-03-15 19:33:19 +00:00
lda DRV.Offset
2022-03-13 12:58:15 +00:00
clc
2022-03-15 19:33:19 +00:00
adc DRV.TotalSize
2022-03-13 12:58:15 +00:00
pha save LO
2022-03-15 19:33:19 +00:00
lda DRV.Offset+1
adc DRV.TotalSize+1
2022-03-13 12:58:15 +00:00
sta W5100.DR,x write HI
pla
sta W5100.DR,x write LO
>AR.SELECT S0.CR
lda #W5100.AR.Sn.CR.RCVD
sta W5100.DR,x
plp
clc
rts
*--------------------------------------
DRV.U2.9 plp
sec
rts
*--------------------------------------
2022-04-19 18:24:34 +00:00
DRV.U2.SendARP >LDYAI S.ARP
>STYA DRV.FrameSize
>LDYAI DRV.ARPBuf
bra DRV.U2.Send
*--------------------------------------
DRV.U2.SendUDP >STYA DRV.FrameSize
2022-03-13 12:58:15 +00:00
2022-04-19 18:24:34 +00:00
jsr DRV.BLK.IPUDPCheksum
2022-03-13 12:58:15 +00:00
2022-04-19 18:24:34 +00:00
>LDYAI DRV.UDPBuf
DRV.U2.Send >STYA DRV.A1L
lda DRV.FrameSize+1
2022-03-13 12:58:15 +00:00
eor #$ff
2022-03-15 19:33:19 +00:00
sta DRV.nCnt+1
2022-03-13 12:58:15 +00:00
2022-04-19 18:24:34 +00:00
lda DRV.FrameSize
2022-03-13 12:58:15 +00:00
eor #$ff
2022-03-15 19:33:19 +00:00
sta DRV.nCnt
2022-03-13 12:58:15 +00:00
2022-04-19 18:24:34 +00:00
php
sei
2022-03-13 12:58:15 +00:00
2022-04-19 18:24:34 +00:00
ldx DRV.BLK.Slotn0
2022-03-13 12:58:15 +00:00
>AR.SELECT S0.TX.FSR
lda W5100.DR,x get send size HI
nop
nop
ldy W5100.DR,x LO
2022-04-19 18:24:34 +00:00
cpy DRV.FrameSize
sbc DRV.FrameSize+1
2022-03-13 12:58:15 +00:00
bcc DRV.U2.9
>AR.SELECT S0.TX.WR
lda W5100.DR,x Get HI
nop
nop
ldy W5100.DR,x Get LO
and /RXTX.MASK
ora /TX.BASE
sta W5100.AR,x Write HI
2022-03-15 19:33:19 +00:00
sta DRV.Offset+1
2022-03-13 12:58:15 +00:00
tya
sta W5100.AR+1,x Write LO
2022-03-15 19:33:19 +00:00
sta DRV.Offset
2022-03-13 12:58:15 +00:00
ldy #0
2022-03-15 19:33:19 +00:00
.2 inc DRV.nCnt
2022-03-13 12:58:15 +00:00
bne .3
2022-03-15 19:33:19 +00:00
inc DRV.nCnt+1
2022-03-13 12:58:15 +00:00
beq .8
2022-04-19 18:24:34 +00:00
.3 lda (DRV.A1L),y
2022-03-13 12:58:15 +00:00
sta W5100.DR,x
iny
bne .2
2022-04-19 18:24:34 +00:00
inc DRV.A1H
2022-03-13 12:58:15 +00:00
bra .2
.8 >AR.SELECT S0.TX.WR
2022-03-15 19:33:19 +00:00
lda DRV.Offset
2022-03-13 12:58:15 +00:00
clc
2022-04-19 18:24:34 +00:00
adc DRV.FrameSize
2022-03-13 12:58:15 +00:00
pha save LO
2022-03-15 19:33:19 +00:00
lda DRV.Offset+1
2022-04-19 18:24:34 +00:00
adc DRV.FrameSize+1
2022-03-13 12:58:15 +00:00
sta W5100.DR,x write HI
pla
sta W5100.DR,x write LO
>AR.SELECT S0.CR
lda #W5100.AR.Sn.CR.SEND
sta W5100.DR,x
plp
clc
rts
2022-03-15 19:33:19 +00:00
*--------------------------------------
DRV.Offset .BS 2
DRV.TotalSize .BS 2
*--------------------------------------
2022-03-13 12:58:15 +00:00
.EP
.LIST ON
DRV.U2.SIZE .EQ *-DRV.U2
.LIST OFF
*--------------------------------------
MAN
SAVE usr/src/sys/pm.vedrive.s.u2
LOAD usr/src/sys/pm.vedrive.s
ASM