mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-04 03:05:43 +00:00
435 lines
6.9 KiB
Plaintext
435 lines
6.9 KiB
Plaintext
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
|
||
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 >PSTR "Uthernet II"
|
||
Offset .BS 2
|
||
TotalSize .BS 2
|
||
*--------------------------------------
|
||
DRV.U2 .EQ *
|
||
.PH DRV.NIC.START
|
||
|
||
DRV.U2.START jmp DRV.U2.Write
|
||
|
||
DRV.U2.Read php
|
||
sei
|
||
|
||
ldx DRV.START
|
||
|
||
>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
|
||
sta DRV.Offset+1
|
||
ldy W5100.DR,x get the received ptr LO
|
||
sty DRV.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 DRV.TotalSize+1
|
||
lda W5100.DR,x get RX.Size LO
|
||
sta DRV.TotalSize
|
||
|
||
* lda DRV.TotalSize
|
||
sec
|
||
sbc #2 MACRAW:strip 2 bytes Header from Size
|
||
sta DRV.BufSize
|
||
eor #$ff
|
||
sta DRV.nCnt
|
||
|
||
lda DRV.TotalSize+1
|
||
sbc #0
|
||
sta DRV.BufSize+1
|
||
eor #$ff
|
||
sta DRV.nCnt+1
|
||
|
||
>LDYA DRV.InBuf
|
||
>STYA .4+1
|
||
|
||
ldy #0
|
||
|
||
.2 inc DRV.nCnt
|
||
bne .3
|
||
|
||
inc DRV.nCnt+1
|
||
beq .8
|
||
|
||
.3 lda W5100.DR,x
|
||
.4 sta $FFFF,y SELF MODIFIED
|
||
iny
|
||
bne .2
|
||
|
||
inc .4+2
|
||
bra .2
|
||
|
||
.8 >AR.SELECT S0.RX.RD
|
||
|
||
lda DRV.Offset
|
||
clc
|
||
adc DRV.TotalSize
|
||
pha save LO
|
||
|
||
lda DRV.Offset+1
|
||
adc DRV.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
|
||
|
||
plp
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DRV.U2.9 plp
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DRV.U2.Write php
|
||
sei
|
||
|
||
>STYA DRV.BufSize
|
||
|
||
eor #$ff
|
||
sta DRV.nCnt+1
|
||
|
||
tya
|
||
eor #$ff
|
||
sta DRV.nCnt
|
||
|
||
>LDYA DRV.OutBuf
|
||
>STYA .3+1
|
||
|
||
ldx DRV.START
|
||
|
||
>AR.SELECT S0.TX.FSR
|
||
lda W5100.DR,x get send size HI
|
||
nop
|
||
nop
|
||
ldy W5100.DR,x LO
|
||
cpy DRV.BufSize
|
||
sbc DRV.BufSize+1
|
||
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
|
||
sta DRV.Offset+1
|
||
tya
|
||
sta W5100.AR+1,x Write LO
|
||
sta DRV.Offset
|
||
|
||
ldy #0
|
||
|
||
.2 inc DRV.nCnt
|
||
bne .3
|
||
|
||
inc DRV.nCnt+1
|
||
beq .8
|
||
|
||
.3 lda $FFFF,y SELF MODIFIED
|
||
sta W5100.DR,x
|
||
iny
|
||
bne .2
|
||
|
||
inc .3+2
|
||
bra .2
|
||
|
||
.8 >AR.SELECT S0.TX.WR
|
||
lda DRV.Offset
|
||
clc
|
||
adc DRV.BufSize
|
||
pha save LO
|
||
lda DRV.Offset+1
|
||
adc DRV.BufSize+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
|
||
*--------------------------------------
|
||
DRV.Offset .BS 2
|
||
DRV.BufSize .BS 2
|
||
DRV.TotalSize .BS 2
|
||
DRV.nCnt .BS 2
|
||
*--------------------------------------
|
||
.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
|