mirror of
https://github.com/A2osX/A2osX.git
synced 2025-04-06 02:40:10 +00:00
Kernel version 0.9 : UTHERNET2.DRV.S.txt & UTHER2.AI.DRV.S.txt , code rework
This commit is contained in:
parent
173256a691
commit
d71c265058
@ -143,7 +143,7 @@ DEV.HEADER cld
|
||||
jmp (DRV.CS.START,x)
|
||||
.DA #0
|
||||
.BS 6
|
||||
DEV.HEADER.NAME >PSTR "ETH7" NAME
|
||||
DEV.HEADER.NAME >PSTR "ETH7"
|
||||
*--------------------------------------
|
||||
* Driver Code
|
||||
*--------------------------------------
|
||||
@ -171,23 +171,25 @@ STATUS >LDYA L.DEVSTAT
|
||||
READBLOCK ldx DEVSLOTx0
|
||||
|
||||
>AR.SELECT S0.RX.RSR
|
||||
lda W5100.DR,x get the received size HI
|
||||
ora W5100.DR,x LO
|
||||
lda W5100.DR,x get the received size HI
|
||||
ora W5100.DR,x LO
|
||||
bne READBLOCK.RxOK
|
||||
|
||||
|
||||
lda #ERR.DEV.NOFRAME
|
||||
|
||||
READBLOCK.Err sec
|
||||
rts
|
||||
|
||||
|
||||
sec
|
||||
READBLOCK.RTS rts
|
||||
|
||||
READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
||||
lda W5100.DR,x get the received ptr HI
|
||||
ldy W5100.DR,x get the received ptr LO
|
||||
lda W5100.DR,x get the received ptr HI
|
||||
ldy W5100.DR,x get the received ptr LO
|
||||
and /RXTX.MASK
|
||||
ora /RX.BASE
|
||||
sta W5100.AR,x
|
||||
sta offset+1
|
||||
tya
|
||||
sta W5100.AR+1,x
|
||||
sta offset
|
||||
|
||||
ldy #0
|
||||
|
||||
@ -197,9 +199,9 @@ READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
||||
cpy #4
|
||||
bne .10
|
||||
|
||||
ldy W5100.DR,x get RX.Size HI
|
||||
ldy W5100.DR,x get RX.Size HI
|
||||
sty RXTX.Size+1
|
||||
lda W5100.DR,x get RX.Size LO
|
||||
lda W5100.DR,x get RX.Size LO
|
||||
sta RXTX.Size
|
||||
|
||||
clc
|
||||
@ -207,12 +209,14 @@ READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
||||
pha
|
||||
tya
|
||||
adc /S.IP
|
||||
ply
|
||||
|
||||
>PUSHYA
|
||||
>PUSHA
|
||||
pla
|
||||
>PUSHA
|
||||
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs READBLOCK.Err
|
||||
bcs READBLOCK.RTS
|
||||
|
||||
>STYA ZPTmpPTR
|
||||
stx .8+1
|
||||
sty .8+3
|
||||
@ -220,23 +224,24 @@ READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
||||
|
||||
lda RXTX.Size
|
||||
sta (ZPTmpPTR)
|
||||
pha
|
||||
eor #$ff
|
||||
sta Counter
|
||||
pla
|
||||
* clc
|
||||
adc #6 Header Size
|
||||
sta RXTX.Size
|
||||
|
||||
ldy #1
|
||||
|
||||
lda RXTX.Size+1
|
||||
sta (ZPTmpPTR),y
|
||||
pha
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
lda RXTX.Size
|
||||
clc
|
||||
adc #6 Header Size
|
||||
sta Offset
|
||||
|
||||
lda RXTX.Size+1
|
||||
pla
|
||||
adc #0
|
||||
sta Offset+1
|
||||
sta RXTX.Size+1
|
||||
|
||||
ldy #S.IP.DST+3
|
||||
ldx #3
|
||||
@ -262,32 +267,34 @@ READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
||||
bne .2
|
||||
inc ZPTmpPTR+1
|
||||
bne .2
|
||||
|
||||
|
||||
.4 >AR.SELECT S0.RX.RD
|
||||
ldy W5100.DR,x Get HI
|
||||
lda W5100.DR,x Get LO
|
||||
|
||||
lda Offset
|
||||
clc
|
||||
adc Offset
|
||||
adc RXTX.Size
|
||||
pha save LO
|
||||
tya
|
||||
adc Offset+1
|
||||
pha
|
||||
>AR.SELECT S0.RX.RD
|
||||
pla
|
||||
|
||||
lda Offset+1
|
||||
adc RXTX.Size+1
|
||||
|
||||
and /RXTX.MASK
|
||||
ora /RX.BASE
|
||||
|
||||
sta W5100.DR,x write HI
|
||||
pla
|
||||
sta W5100.DR,x write LO
|
||||
|
||||
|
||||
>AR.SELECT S0.CR
|
||||
lda #W5100.AR.S0.CR.RCVD
|
||||
sta W5100.DR,x
|
||||
|
||||
|
||||
.8 ldx #$ff hMem
|
||||
ldy #$ff PtrLO
|
||||
lda #$ff PtrHI
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
*--------------------------------------
|
||||
WRITEBLOCK >STYA ZPTmpPTR
|
||||
|
||||
lda (ZPTmpPTR)
|
||||
@ -296,7 +303,7 @@ WRITEBLOCK >STYA ZPTmpPTR
|
||||
sta RXTX.Size
|
||||
eor #$ff
|
||||
sta Counter
|
||||
|
||||
|
||||
ldy #1
|
||||
lda (ZPTmpPTR),y
|
||||
sbc /S.IP-2
|
||||
@ -331,13 +338,6 @@ WRITEBLOCK.1 >AR.SELECT S0.DIPR
|
||||
lda (ZPTmpPTR),y
|
||||
sta W5100.DR,x
|
||||
|
||||
* >AR.SELECT S0.TOS
|
||||
stz W5100.DR,x
|
||||
|
||||
* >AR.SELECT S0.TTL
|
||||
lda #K.IP.TTL
|
||||
sta W5100.DR,x
|
||||
|
||||
>AR.SELECT S0.TX.WR
|
||||
lda W5100.DR,x Get HI
|
||||
ldy W5100.DR,x Get LO
|
||||
@ -353,6 +353,7 @@ WRITEBLOCK.1 >AR.SELECT S0.DIPR
|
||||
|
||||
.2 inc Counter
|
||||
bne .3
|
||||
|
||||
inc Counter+1
|
||||
beq .8
|
||||
|
||||
@ -365,8 +366,8 @@ WRITEBLOCK.1 >AR.SELECT S0.DIPR
|
||||
|
||||
.8 >AR.SELECT S0.TX.WR
|
||||
|
||||
clc
|
||||
lda Offset
|
||||
clc
|
||||
adc RXTX.Size
|
||||
pha save LO
|
||||
|
||||
@ -381,6 +382,7 @@ WRITEBLOCK.1 >AR.SELECT S0.DIPR
|
||||
>AR.SELECT S0.CR
|
||||
lda #W5100.AR.S0.CR.SEND
|
||||
sta W5100.DR,x
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -391,29 +393,38 @@ OPEN jsr CLOSE
|
||||
|
||||
>AR.SELECT GAR
|
||||
|
||||
ldy #8 GAR,SUBR
|
||||
ldy #4
|
||||
|
||||
.1 stz W5100.DR,x
|
||||
dey
|
||||
bne .1
|
||||
|
||||
* >AR.SELECT SUBR
|
||||
|
||||
ldy #4
|
||||
lda #255
|
||||
|
||||
.2 sta W5100.DR,x
|
||||
dey
|
||||
bne .2
|
||||
|
||||
* >AR.SELECT SHAR
|
||||
|
||||
ldy #0
|
||||
|
||||
.2 lda MAC,y
|
||||
.3 lda MAC,y
|
||||
sta W5100.DR,x
|
||||
iny
|
||||
cpy #6
|
||||
bne .2
|
||||
bne .3
|
||||
|
||||
* >AR.SELECT SIPR
|
||||
|
||||
ldy #4
|
||||
|
||||
.3 stz W5100.DR,x
|
||||
.4 stz W5100.DR,x
|
||||
dey
|
||||
bne .3
|
||||
bne .4
|
||||
|
||||
>AR.SELECT RMSR
|
||||
lda #3 8k,0k,0k,0k
|
||||
@ -468,6 +479,13 @@ CONTROL.OPEN >AR.SELECT S0.MR
|
||||
lda #W5100.AR.S0.MR.IPRAW+W5100.AR.S0.MR.MF
|
||||
sta W5100.DR,x
|
||||
|
||||
>AR.SELECT S0.TOS
|
||||
stz W5100.DR,x
|
||||
|
||||
* >AR.SELECT S0.TTL
|
||||
lda #K.IP.TTL
|
||||
sta W5100.DR,x
|
||||
|
||||
>AR.SELECT S0.CR
|
||||
lda #W5100.AR.S0.CR.OPEN
|
||||
sta W5100.DR,x
|
||||
@ -478,7 +496,7 @@ CONTROL.OPEN >AR.SELECT S0.MR
|
||||
CLOSE ldx DEVSLOTx0
|
||||
lda #W5100.MR.RST
|
||||
sta W5100.MR,x
|
||||
|
||||
|
||||
lda $C019 we can use VBL as we are not on //c
|
||||
.1 eor $C019
|
||||
bpl .1
|
||||
@ -487,6 +505,7 @@ CLOSE ldx DEVSLOTx0
|
||||
.2 eor $C019
|
||||
bpl .2
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
DRV.CS.END
|
||||
@ -498,6 +517,7 @@ DEVSTAT .DA #0
|
||||
.DA #S.DEVSTAT.TYPE.NET
|
||||
.BS 1 Subtype
|
||||
.BS 2 Version
|
||||
*--------------------------------------
|
||||
FLAGS .DA #S.DEVSTAT.NET.FLAGS.ARPOFFLOAD+S.DEVSTAT.NET.FLAGS.IPOFFLOAD
|
||||
LINK.STATUS .DA #S.DEVSTAT.NET.STATUS.OK+S.DEVSTAT.NET.STATUS.FD+S.DEVSTAT.NET.STATUS.100
|
||||
MAC .BS 6
|
||||
|
@ -171,7 +171,7 @@ READBLOCK ldx DEVSLOTx0
|
||||
|
||||
>AR.SELECT S0.RX.RSR
|
||||
lda W5100.DR,x get the received size HI
|
||||
ora W5100.DR,x LO
|
||||
ora W5100.DR,x LO
|
||||
bne READBLOCK.RxOK
|
||||
|
||||
lda #ERR.DEV.NOFRAME
|
||||
@ -180,30 +180,24 @@ READBLOCK ldx DEVSLOTx0
|
||||
rts
|
||||
|
||||
READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
||||
lda W5100.DR,x get the received ptr HI
|
||||
ldy W5100.DR,x get the received ptr LO
|
||||
lda W5100.DR,x get the received ptr HI
|
||||
ldy W5100.DR,x get the received ptr LO
|
||||
and /RXTX.MASK
|
||||
ora /RX.BASE
|
||||
sta W5100.AR,x
|
||||
sta offset+1
|
||||
tya
|
||||
sta W5100.AR+1,x
|
||||
sta offset
|
||||
|
||||
lda W5100.DR,x get RX.Size HI
|
||||
sta Offset+1
|
||||
>PUSHA for SYS.GetMem
|
||||
tay
|
||||
lda W5100.DR,x get RX.Size LO
|
||||
sta Offset
|
||||
>PUSHA for SYS.GetMem
|
||||
lda W5100.DR,x get RX.Size HI
|
||||
sta RXTX.Size+1
|
||||
>PUSHA for SYS.GetMem
|
||||
|
||||
sec
|
||||
sbc #2
|
||||
lda W5100.DR,x get RX.Size LO
|
||||
sta RXTX.Size
|
||||
bcs .1
|
||||
dey
|
||||
.1 sty RXTX.Size+1
|
||||
|
||||
* >PUSHYA Already pushed....
|
||||
>PUSHA for SYS.GetMem
|
||||
|
||||
>PUSHBI 0
|
||||
>SYSCALL GetMem
|
||||
bcs .99
|
||||
@ -213,13 +207,16 @@ READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
||||
sta .8+5
|
||||
|
||||
lda RXTX.Size
|
||||
sec
|
||||
sbc #2 Header Size
|
||||
sta (ZPTmpPTR)
|
||||
eor #$ff
|
||||
sta Counter
|
||||
|
||||
ldy #1
|
||||
|
||||
|
||||
lda RXTX.Size+1
|
||||
sbc #0
|
||||
sta (ZPTmpPTR),y
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
@ -241,16 +238,18 @@ READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
||||
bne .2
|
||||
|
||||
.4 >AR.SELECT S0.RX.RD
|
||||
ldy W5100.DR,x Get HI
|
||||
lda W5100.DR,x Get LO
|
||||
|
||||
lda Offset
|
||||
clc
|
||||
adc Offset
|
||||
adc RXTX.Size
|
||||
pha save LO
|
||||
tya
|
||||
adc Offset+1
|
||||
pha
|
||||
>AR.SELECT S0.RX.RD
|
||||
pla
|
||||
|
||||
lda Offset+1
|
||||
adc RXTX.Size+1
|
||||
|
||||
and /RXTX.MASK
|
||||
ora /RX.BASE
|
||||
|
||||
sta W5100.DR,x write HI
|
||||
pla
|
||||
sta W5100.DR,x write LO
|
||||
@ -318,7 +317,7 @@ WRITEBLOCK.1 ldy #S.ETH.SRCMAC+5
|
||||
bne .3
|
||||
|
||||
inc Counter+1
|
||||
beq .4
|
||||
beq .8
|
||||
|
||||
.3 lda (ZPTmpPTR),y
|
||||
sta W5100.DR,x
|
||||
@ -327,7 +326,7 @@ WRITEBLOCK.1 ldy #S.ETH.SRCMAC+5
|
||||
inc ZPTmpPTR+1
|
||||
bne .2
|
||||
|
||||
.4 >AR.SELECT S0.TX.WR
|
||||
.8 >AR.SELECT S0.TX.WR
|
||||
|
||||
lda Offset
|
||||
clc
|
||||
@ -345,7 +344,7 @@ WRITEBLOCK.1 ldy #S.ETH.SRCMAC+5
|
||||
>AR.SELECT S0.CR
|
||||
lda #W5100.AR.S0.CR.SEND
|
||||
sta W5100.DR,x
|
||||
|
||||
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
@ -357,6 +356,7 @@ OPEN jsr CLOSE
|
||||
>AR.SELECT SHAR
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 lda MAC,y
|
||||
sta W5100.DR,x
|
||||
iny
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -38,7 +38,6 @@ SET.IPCFG >PULLW ZPTmpPtr1
|
||||
lda IPCFG+S.IPCFG.HDEV
|
||||
|
||||
>SYSCALL GetDevByIDA
|
||||
>STYA ZPTmpPtr2
|
||||
>STYA NetDevJmp+1
|
||||
|
||||
ldx #DEVMGR.STATUS
|
||||
|
Loading…
x
Reference in New Issue
Block a user