A2osX/SYS/PM.VEDRIVE.S.U2.txt
burniouf 9e960a234e KERNEL: modification for CC (Slist API) updated FORTH,SH, CSH, SM....
KERNEL: modification for Softcard //e (may help...or not)
KERNEL: bugfix for VS/VE drive detetcion and report on KCONFIG
CC: some progress on STRUCT & UNION
SHARED/PrintF: removed support for /n..... (now in S-C MASM3.1 & A2osX-ASM)
2022-09-17 13:35:52 +02:00

443 lines
7.1 KiB
Plaintext
Raw Permalink 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
*--------------------------------------
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
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"
Offset .BS 2
TotalSize .BS 2
*--------------------------------------
DRV.U2 .PH DRV.NIC.START
jmp DRV.U2.SendARP
jmp DRV.U2.SendUDP
DRV.U2.Rcvd php
sei
ldx DRV.BLK.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 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.FrameSize
eor #$ff
sta DRV.nCnt
lda DRV.TotalSize+1
sbc #0
sta DRV.FrameSize+1
eor #$ff
sta DRV.nCnt+1
>LDYAI DRV.InBuf
>STYA DRV.A1L
ldy #0
.2 inc DRV.nCnt
bne .3
inc DRV.nCnt+1
beq .8
.3 lda W5100.DR,x
sta (DRV.A1L),y
iny
bne .2
inc DRV.A1H
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.SendARP >LDYAI S.ARP
>STYA DRV.FrameSize
>LDYAI DRV.ARPBuf
bra DRV.U2.Send
*--------------------------------------
DRV.U2.SendUDP >STYA DRV.FrameSize
jsr DRV.BLK.IPUDPCheksum
>LDYAI DRV.UDPBuf
DRV.U2.Send >STYA DRV.A1L
lda DRV.FrameSize+1
eor #$ff
sta DRV.nCnt+1
lda DRV.FrameSize
eor #$ff
sta DRV.nCnt
php
sei
ldx DRV.BLK.Slotn0
>AR.SELECT S0.TX.FSR
lda W5100.DR,x get send size HI
nop
nop
ldy W5100.DR,x LO
cpy DRV.FrameSize
sbc DRV.FrameSize+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 (DRV.A1L),y
sta W5100.DR,x
iny
bne .2
inc DRV.A1H
bra .2
.8 >AR.SELECT S0.TX.WR
lda DRV.Offset
clc
adc DRV.FrameSize
pha save LO
lda DRV.Offset+1
adc DRV.FrameSize+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.TotalSize .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