2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2016-04-04 20:48:20 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.TF /A2OSX.BUILD/DRV/UTHER2.AI.DRV
|
2016-04-04 20:48:20 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/A2OSX.I
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MLI.ERR.I
|
2017-12-22 21:24:30 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/NIC.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/NIC.W5100.I
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/LIBTCPIP.I
|
2016-04-04 20:48:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPTmpPTR .EQ ZPDRV
|
2017-04-14 15:04:39 +00:00
|
|
|
|
RXTX.Size .EQ ZPDRV+2
|
|
|
|
|
Counter .EQ ZPDRV+4
|
|
|
|
|
Offset .EQ ZPDRV+6
|
|
|
|
|
RX.IP .EQ ZPDRV+8
|
2016-04-04 20:48:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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 DEV.HEADER-CS.START Device Header Offset
|
|
|
|
|
.DA DRV.CS.START-CS.START Driver Code Offset
|
|
|
|
|
.DA DRV.CS.END-DRV.CS.START Drv Code Length
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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.DEV.HEADER.NAME .DA DEV.HEADER.NAME
|
|
|
|
|
.DA 0 End Of Reloc Table
|
|
|
|
|
*--------------------------------------
|
2016-10-17 15:47:50 +00:00
|
|
|
|
Dev.Detect >STYA Args
|
2016-04-04 20:48:20 +00:00
|
|
|
|
>LDYA L.MSG.DETECT
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2017-04-24 21:32:57 +00:00
|
|
|
|
ldx #$70+$88
|
|
|
|
|
ldy #7
|
2017-04-14 15:04:39 +00:00
|
|
|
|
|
2017-10-19 15:27:38 +00:00
|
|
|
|
.1 lda A2osX.S,y IO based detection, avoid scanning in Disk Controller IO!!!!
|
2017-04-14 15:04:39 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
lda #W5100.MR.RST
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta W5100.MR,x
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
lda #0
|
|
|
|
|
|
|
|
|
|
.10 dec give some time....
|
|
|
|
|
bne .10
|
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
lda #W5100.MR.AI+W5100.MR.IND
|
|
|
|
|
sta W5100.MR,x
|
2017-04-14 15:04:39 +00:00
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
pla
|
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
lda W5100.MR,x
|
|
|
|
|
cmp #W5100.MR.AI+W5100.MR.IND
|
|
|
|
|
bne .2
|
|
|
|
|
|
2017-04-17 19:36:00 +00:00
|
|
|
|
>AR.SELECT RTR
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
lda W5100.DR,x Get RTR HI
|
|
|
|
|
cmp /2000
|
|
|
|
|
bne .2
|
|
|
|
|
lda W5100.DR,x Get RTR LO
|
|
|
|
|
cmp #2000
|
|
|
|
|
beq .3
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.2 dec DEV.HEADER.NAME+4
|
2016-04-04 20:48:20 +00:00
|
|
|
|
txa
|
2017-04-14 15:04:39 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc #$10
|
2016-04-04 20:48:20 +00:00
|
|
|
|
tax
|
2017-04-24 21:32:57 +00:00
|
|
|
|
dey
|
2017-04-14 15:04:39 +00:00
|
|
|
|
bne .1
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.DETECT.KO
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
lda #MLI.E.NODEV
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.3 stx DEVSLOTx0
|
2017-10-19 15:27:38 +00:00
|
|
|
|
lda #A2osX.S.NIC
|
|
|
|
|
sta A2osX.S,y
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
>LDYA ARGS
|
|
|
|
|
>STYA ZPTmpPTR
|
|
|
|
|
lda (ZPTmpPTR)
|
2016-04-04 20:48:20 +00:00
|
|
|
|
bne .4
|
2016-10-17 15:47:50 +00:00
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
lda #$00
|
|
|
|
|
sta MAC
|
|
|
|
|
lda #$08
|
|
|
|
|
sta MAC+1
|
|
|
|
|
lda #$DC
|
|
|
|
|
sta MAC+2
|
|
|
|
|
lda A2osX.RANDOM16
|
|
|
|
|
eor A2osX.TIMER16
|
|
|
|
|
sta MAC+3
|
|
|
|
|
eor A2osX.RANDOM16+1
|
|
|
|
|
sta MAC+4
|
|
|
|
|
eor A2osX.TIMER16+1
|
|
|
|
|
sta MAC+5
|
|
|
|
|
bra .8
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.4 jsr DecodeMac
|
2016-04-04 20:48:20 +00:00
|
|
|
|
bcc .8
|
2017-10-26 16:01:54 +00:00
|
|
|
|
lda #K.E.SYN
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2016-10-17 15:47:50 +00:00
|
|
|
|
.8 >PUSHW L.DEV.HEADER.NAME
|
|
|
|
|
>LDYA L.MSG.DETECT.OK
|
2017-08-25 15:02:16 +00:00
|
|
|
|
>SYSCALL PrintF.YA
|
2016-04-04 20:48:20 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.INB /A2OSX.SRC/DRV/X.NET.DRV.S
|
2016-04-04 20:48:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2017-04-14 15:04:39 +00:00
|
|
|
|
MSG.DETECT >CSTR "UtherNet2/W5100 Driver.\r\n"
|
|
|
|
|
MSG.DETECT.OK >CSTR "UtherNet2/W5100 Installed As Device : %S\r\n"
|
|
|
|
|
MSG.DETECT.KO >CSTR "Hardware Not Found.\r\n"
|
2016-10-17 15:47:50 +00:00
|
|
|
|
Args .BS 2
|
2016-04-04 20:48:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Device Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DEV.HEADER cld
|
|
|
|
|
jmp (DRV.CS.START,x)
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.DA #0
|
|
|
|
|
.BS 6
|
2017-04-25 15:44:21 +00:00
|
|
|
|
DEV.HEADER.NAME >PSTR "ETH7"
|
2016-04-04 20:48:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Driver Code
|
|
|
|
|
*--------------------------------------
|
2017-04-14 15:04:39 +00:00
|
|
|
|
DRV.CS.START .DA STATUS
|
|
|
|
|
.DA READBLOCK
|
|
|
|
|
.DA WRITEBLOCK
|
2017-07-06 15:30:40 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.DA CONTROL
|
2017-07-06 15:30:40 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.DA OPEN
|
2016-04-04 20:48:20 +00:00
|
|
|
|
.DA CLOSE
|
2017-07-06 15:30:40 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.DA A2osX.BADCALL
|
2017-04-14 15:04:39 +00:00
|
|
|
|
L.DEVSTAT .DA DEVSTAT
|
2016-04-04 20:48:20 +00:00
|
|
|
|
.DA 0 end or relocation
|
|
|
|
|
*--------------------------------------
|
2017-04-14 15:04:39 +00:00
|
|
|
|
STATUS >LDYA L.DEVSTAT
|
2016-04-04 20:48:20 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-04-14 15:04:39 +00:00
|
|
|
|
READBLOCK ldx DEVSLOTx0
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
>AR.SELECT S0.RX.RSR
|
2017-04-25 15:44:21 +00:00
|
|
|
|
lda W5100.DR,x get the received size HI
|
|
|
|
|
ora W5100.DR,x LO
|
2017-04-14 15:04:39 +00:00
|
|
|
|
bne READBLOCK.RxOK
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
lda #ERR.DEV.NOFRAME
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
READBLOCK.RTS rts
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
READBLOCK.RxOK >AR.SELECT S0.RX.RD
|
2017-04-25 15:44:21 +00:00
|
|
|
|
lda W5100.DR,x get the received ptr HI
|
2017-04-27 20:08:12 +00:00
|
|
|
|
sta offset+1
|
2017-04-25 15:44:21 +00:00
|
|
|
|
ldy W5100.DR,x get the received ptr LO
|
2017-04-27 20:08:12 +00:00
|
|
|
|
sty offset
|
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
and /RXTX.MASK
|
|
|
|
|
ora /RX.BASE
|
|
|
|
|
sta W5100.AR,x
|
|
|
|
|
tya
|
|
|
|
|
sta W5100.AR+1,x
|
|
|
|
|
|
2016-04-20 06:51:10 +00:00
|
|
|
|
ldy #0
|
2017-04-14 15:04:39 +00:00
|
|
|
|
|
2016-04-20 06:51:10 +00:00
|
|
|
|
.10 lda W5100.DR,x
|
|
|
|
|
sta RX.IP,y
|
|
|
|
|
iny
|
|
|
|
|
cpy #4
|
|
|
|
|
bne .10
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2017-04-25 15:44:21 +00:00
|
|
|
|
ldy W5100.DR,x get RX.Size HI
|
2016-04-05 15:46:11 +00:00
|
|
|
|
sty RXTX.Size+1
|
2017-04-25 15:44:21 +00:00
|
|
|
|
lda W5100.DR,x get RX.Size LO
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta RXTX.Size
|
|
|
|
|
|
|
|
|
|
clc
|
2016-04-05 15:46:11 +00:00
|
|
|
|
adc #S.IP
|
2016-04-04 20:48:20 +00:00
|
|
|
|
pha
|
|
|
|
|
tya
|
2016-04-05 15:46:11 +00:00
|
|
|
|
adc /S.IP
|
2017-07-06 15:30:40 +00:00
|
|
|
|
ply
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
>SYSCALL GetMem.YA
|
2017-04-25 15:44:21 +00:00
|
|
|
|
bcs READBLOCK.RTS
|
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
>STYA ZPTmpPTR
|
2017-04-14 15:04:39 +00:00
|
|
|
|
stx .8+1
|
|
|
|
|
sty .8+3
|
|
|
|
|
sta .8+5
|
2016-04-07 21:05:38 +00:00
|
|
|
|
|
2016-04-05 15:46:11 +00:00
|
|
|
|
lda RXTX.Size
|
2016-04-20 06:51:10 +00:00
|
|
|
|
sta (ZPTmpPTR)
|
2017-04-25 15:44:21 +00:00
|
|
|
|
pha
|
2016-04-07 21:05:38 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter
|
2017-04-25 15:44:21 +00:00
|
|
|
|
pla
|
|
|
|
|
* clc
|
|
|
|
|
adc #6 Header Size
|
|
|
|
|
sta RXTX.Size
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
ldy #1
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2016-04-05 15:46:11 +00:00
|
|
|
|
lda RXTX.Size+1
|
2016-04-20 06:51:10 +00:00
|
|
|
|
sta (ZPTmpPTR),y
|
2017-04-25 15:44:21 +00:00
|
|
|
|
pha
|
2016-04-07 21:05:38 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter+1
|
2017-04-25 15:44:21 +00:00
|
|
|
|
pla
|
2016-04-20 06:51:10 +00:00
|
|
|
|
adc #0
|
2017-04-25 15:44:21 +00:00
|
|
|
|
sta RXTX.Size+1
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IP.DST+3
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
.1 lda RX.IP,x
|
|
|
|
|
sta (ZPTmpPTR),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
ldx DEVSLOTx0
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IP
|
2016-04-20 06:51:10 +00:00
|
|
|
|
|
|
|
|
|
.2 inc Counter
|
2016-04-04 20:48:20 +00:00
|
|
|
|
bne .3
|
2016-04-20 06:51:10 +00:00
|
|
|
|
inc Counter+1
|
2017-04-14 15:04:39 +00:00
|
|
|
|
beq .4
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2016-04-20 06:51:10 +00:00
|
|
|
|
.3 lda W5100.DR,x
|
|
|
|
|
sta (ZPTmpPTR),y
|
|
|
|
|
iny
|
2016-04-04 20:48:20 +00:00
|
|
|
|
bne .2
|
2016-04-20 06:51:10 +00:00
|
|
|
|
inc ZPTmpPTR+1
|
2016-04-04 20:48:20 +00:00
|
|
|
|
bne .2
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.4 >AR.SELECT S0.RX.RD
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
|
|
|
|
lda Offset
|
2016-04-04 20:48:20 +00:00
|
|
|
|
clc
|
2017-04-25 15:44:21 +00:00
|
|
|
|
adc RXTX.Size
|
2016-04-04 20:48:20 +00:00
|
|
|
|
pha save LO
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
|
|
|
|
lda Offset+1
|
|
|
|
|
adc RXTX.Size+1
|
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta W5100.DR,x write HI
|
|
|
|
|
pla
|
|
|
|
|
sta W5100.DR,x write LO
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
>AR.SELECT S0.CR
|
2017-04-14 15:04:39 +00:00
|
|
|
|
lda #W5100.AR.S0.CR.RCVD
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta W5100.DR,x
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.8 ldx #$ff hMem
|
|
|
|
|
ldy #$ff PtrLO
|
|
|
|
|
lda #$ff PtrHI
|
2016-04-04 20:48:20 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-04-25 15:44:21 +00:00
|
|
|
|
*--------------------------------------
|
2017-04-17 19:36:00 +00:00
|
|
|
|
WRITEBLOCK >STYA ZPTmpPTR
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2016-04-20 06:51:10 +00:00
|
|
|
|
lda (ZPTmpPTR)
|
|
|
|
|
sec
|
|
|
|
|
sbc #S.IP-2
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta RXTX.Size
|
2016-04-07 21:05:38 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2016-04-20 06:51:10 +00:00
|
|
|
|
ldy #1
|
2016-04-04 20:48:20 +00:00
|
|
|
|
lda (ZPTmpPTR),y
|
2016-04-20 06:51:10 +00:00
|
|
|
|
sbc /S.IP-2
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta RXTX.Size+1
|
2016-04-07 21:05:38 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter+1
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
ldx DEVSLOTx0
|
2016-04-04 20:48:20 +00:00
|
|
|
|
>AR.SELECT S0.TX.FSR
|
|
|
|
|
|
|
|
|
|
lda W5100.DR,x get send size HI
|
|
|
|
|
ldy W5100.DR,x LO
|
|
|
|
|
cpy RXTX.Size
|
|
|
|
|
sbc RXTX.Size+1
|
2017-04-14 15:04:39 +00:00
|
|
|
|
bcs WRITEBLOCK.1
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
lda #ERR.DEV.NOBUFFER
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
WRITEBLOCK.1 >AR.SELECT S0.DIPR
|
2016-04-04 20:48:20 +00:00
|
|
|
|
ldy #S.IP.DST
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPTmpPTR),y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.IP.DST+4
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>AR.SELECT S0.PROTO
|
|
|
|
|
ldy #S.IP.PROTOCOL
|
|
|
|
|
lda (ZPTmpPTR),y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
|
|
|
|
>AR.SELECT S0.TX.WR
|
|
|
|
|
lda W5100.DR,x Get HI
|
|
|
|
|
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 #S.IP
|
|
|
|
|
|
2016-04-07 21:05:38 +00:00
|
|
|
|
.2 inc Counter
|
2016-04-04 20:48:20 +00:00
|
|
|
|
bne .3
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2016-04-07 21:05:38 +00:00
|
|
|
|
inc Counter+1
|
|
|
|
|
beq .8
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2016-04-07 21:05:38 +00:00
|
|
|
|
.3 lda (ZPTmpPTR),y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
2016-04-04 20:48:20 +00:00
|
|
|
|
bne .2
|
2016-04-07 21:05:38 +00:00
|
|
|
|
inc ZPTmpPTR+1
|
2016-04-04 20:48:20 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
2016-04-07 21:05:38 +00:00
|
|
|
|
.8 >AR.SELECT S0.TX.WR
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
lda Offset
|
2017-04-25 15:44:21 +00:00
|
|
|
|
clc
|
2016-04-04 20:48:20 +00:00
|
|
|
|
adc RXTX.Size
|
|
|
|
|
pha save LO
|
|
|
|
|
|
|
|
|
|
lda Offset+1
|
|
|
|
|
adc RXTX.Size+1
|
|
|
|
|
sta W5100.DR,x write HI
|
|
|
|
|
pla
|
|
|
|
|
sta W5100.DR,x write LO
|
|
|
|
|
|
2016-04-07 21:05:38 +00:00
|
|
|
|
>AR.SELECT S0.CR
|
2017-04-14 15:04:39 +00:00
|
|
|
|
lda #W5100.AR.S0.CR.SEND
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta W5100.DR,x
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-04-14 15:04:39 +00:00
|
|
|
|
OPEN jsr CLOSE
|
|
|
|
|
|
|
|
|
|
lda #W5100.MR.AI+W5100.MR.IND
|
|
|
|
|
sta W5100.MR,x
|
|
|
|
|
|
|
|
|
|
>AR.SELECT GAR
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2017-04-25 15:44:21 +00:00
|
|
|
|
ldy #4
|
2017-04-14 15:04:39 +00:00
|
|
|
|
|
|
|
|
|
.1 stz W5100.DR,x
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
2017-04-25 15:44:21 +00:00
|
|
|
|
* >AR.SELECT SUBR
|
|
|
|
|
|
|
|
|
|
ldy #4
|
|
|
|
|
lda #255
|
|
|
|
|
|
|
|
|
|
.2 sta W5100.DR,x
|
|
|
|
|
dey
|
|
|
|
|
bne .2
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
* >AR.SELECT SHAR
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
2017-04-25 15:44:21 +00:00
|
|
|
|
.3 lda MAC,y
|
2017-04-14 15:04:39 +00:00
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #6
|
2017-04-25 15:44:21 +00:00
|
|
|
|
bne .3
|
2017-04-14 15:04:39 +00:00
|
|
|
|
|
|
|
|
|
* >AR.SELECT SIPR
|
|
|
|
|
|
|
|
|
|
ldy #4
|
|
|
|
|
|
2017-04-25 15:44:21 +00:00
|
|
|
|
.4 stz W5100.DR,x
|
2017-04-14 15:04:39 +00:00
|
|
|
|
dey
|
2017-04-25 15:44:21 +00:00
|
|
|
|
bne .4
|
2017-04-14 15:04:39 +00:00
|
|
|
|
|
|
|
|
|
>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
|
|
|
|
|
|
|
|
|
|
bra CONTROL.OPEN
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CONTROL >STYA ZPTmpPTR
|
|
|
|
|
|
|
|
|
|
ldx DEVSLOTx0
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
>AR.SELECT S0.CR
|
2017-04-14 15:04:39 +00:00
|
|
|
|
lda #W5100.AR.S0.CR.CLOSE
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
2016-04-20 06:51:10 +00:00
|
|
|
|
.10 >AR.SELECT S0.SR
|
|
|
|
|
lda W5100.DR,x
|
|
|
|
|
bne .10 CLOSED ???
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
>AR.SELECT GAR
|
2016-04-20 06:51:10 +00:00
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
ldy #S.IPCFG.GW
|
2016-04-20 06:51:10 +00:00
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
.1 lda (ZPTmpPTR),y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.IPCFG.GW+4
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
* >AR.SELECT SUBR Implicit, next to GAR
|
|
|
|
|
|
|
|
|
|
ldy #S.IPCFG.MASK
|
2016-04-20 06:51:10 +00:00
|
|
|
|
|
2016-04-04 20:48:20 +00:00
|
|
|
|
.2 lda (ZPTmpPTR),y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.IPCFG.MASK+4
|
|
|
|
|
bne .2
|
|
|
|
|
|
2016-04-20 06:51:10 +00:00
|
|
|
|
>AR.SELECT SIPR
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IPCFG.IP
|
2016-04-20 06:51:10 +00:00
|
|
|
|
|
|
|
|
|
.3 lda (ZPTmpPTR),y
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.IPCFG.IP+4
|
2016-04-20 06:51:10 +00:00
|
|
|
|
bne .3
|
2016-04-04 20:48:20 +00:00
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
CONTROL.OPEN >AR.SELECT S0.MR
|
2016-04-20 06:51:10 +00:00
|
|
|
|
lda #W5100.AR.S0.MR.IPRAW+W5100.AR.S0.MR.MF
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
2017-04-25 15:44:21 +00:00
|
|
|
|
>AR.SELECT S0.TOS
|
|
|
|
|
stz W5100.DR,x
|
|
|
|
|
|
|
|
|
|
* >AR.SELECT S0.TTL
|
|
|
|
|
lda #K.IP.TTL
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
2017-04-14 15:04:39 +00:00
|
|
|
|
>AR.SELECT S0.CR
|
|
|
|
|
lda #W5100.AR.S0.CR.OPEN
|
2016-04-04 20:48:20 +00:00
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-04-14 15:04:39 +00:00
|
|
|
|
CLOSE ldx DEVSLOTx0
|
2016-04-04 20:48:20 +00:00
|
|
|
|
lda #W5100.MR.RST
|
|
|
|
|
sta W5100.MR,x
|
2017-04-25 15:44:21 +00:00
|
|
|
|
|
2016-04-20 06:51:10 +00:00
|
|
|
|
lda $C019 we can use VBL as we are not on //c
|
|
|
|
|
.1 eor $C019
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
lda $C019
|
|
|
|
|
.2 eor $C019
|
|
|
|
|
bpl .2
|
|
|
|
|
|
2017-04-25 15:44:21 +00:00
|
|
|
|
clc
|
2016-04-04 20:48:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.CS.END
|
2017-04-14 15:04:39 +00:00
|
|
|
|
DEVSLOTx0 .BS 1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DEVSTAT .DA #0
|
|
|
|
|
.BS 3 size
|
|
|
|
|
>PSTR "UtherNetII/W5100"
|
2017-10-27 06:36:46 +00:00
|
|
|
|
.DA #S.DSTAT.T.NET
|
2017-04-14 15:04:39 +00:00
|
|
|
|
.BS 1 Subtype
|
|
|
|
|
.BS 2 Version
|
2017-04-25 15:44:21 +00:00
|
|
|
|
*--------------------------------------
|
2017-12-22 21:24:30 +00:00
|
|
|
|
FLAGS .DA #S.DSTAT.NIC.FLAGS.ARPOFFLOAD+S.DSTAT.NIC.FLAGS.IPOFFLOAD
|
|
|
|
|
LINK.STATUS .DA #S.DSTAT.NIC.STATUS.OK+S.DSTAT.NIC.STATUS.FD+S.DSTAT.NIC.STATUS.100
|
2016-04-04 20:48:20 +00:00
|
|
|
|
MAC .BS 6
|
|
|
|
|
MAN
|
2017-04-14 15:04:39 +00:00
|
|
|
|
SAVE /A2OSX.SRC/DRV/UTHER2.AI.DRV.S
|
2016-04-04 20:48:20 +00:00
|
|
|
|
ASM
|