2018-08-25 16:26:41 +00:00
|
|
|
|
NEW
|
2019-05-02 09:52:32 +00:00
|
|
|
|
AUTO 3,1
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DO U2AI=1
|
|
|
|
|
.TF DRV/UTHER2.AI.DRV
|
|
|
|
|
.ELSE
|
|
|
|
|
.TF DRV/UTHERNET2.DRV
|
|
|
|
|
.FIN
|
|
|
|
|
*--------------------------------------
|
2019-09-07 06:41:17 +00:00
|
|
|
|
ZPArgPtr .EQ ZPBIN
|
|
|
|
|
DEVSLOT0x .EQ ZPBIN+2
|
2018-08-25 16:26:41 +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 0
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* 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.DRV.CS.START .DA DRV.CS.START
|
|
|
|
|
L.FD.DEV .DA FD.DEV
|
|
|
|
|
L.FD.DEV.NAME .DA FD.DEV.NAME
|
|
|
|
|
L.SSCANF.MAC .DA SSCANF.MAC
|
|
|
|
|
L.MAC0 .DA DCB+S.DCB.NIC.MAC
|
|
|
|
|
L.MAC1 .DA DCB+S.DCB.NIC.MAC+1
|
|
|
|
|
L.MAC2 .DA DCB+S.DCB.NIC.MAC+2
|
|
|
|
|
L.MAC3 .DA DCB+S.DCB.NIC.MAC+3
|
|
|
|
|
L.MAC4 .DA DCB+S.DCB.NIC.MAC+4
|
|
|
|
|
L.MAC5 .DA DCB+S.DCB.NIC.MAC+5
|
|
|
|
|
.DA 0 End Of Reloc Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Dev.Detect >STYA ARGS
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.DETECT
|
|
|
|
|
>SYSCALL puts
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
ldx #$70+$88
|
|
|
|
|
ldy #7
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.1 lda A2osX.S,y IO based detection, avoid scanning in Disk Controller IO!!!!
|
|
|
|
|
bne .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
lda #W5100.MR.RST
|
|
|
|
|
sta W5100.MR,x
|
|
|
|
|
|
|
|
|
|
lda #0
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.10 dec give some time....
|
|
|
|
|
bne .10
|
|
|
|
|
|
|
|
|
|
lda #W5100.MR.AI+W5100.MR.IND
|
|
|
|
|
sta W5100.MR,x
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
lda W5100.MR,x
|
|
|
|
|
cmp #W5100.MR.AI+W5100.MR.IND
|
|
|
|
|
bne .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>AR.SELECT RTR
|
|
|
|
|
lda W5100.DR,x Get RTR HI
|
|
|
|
|
cmp /2000
|
|
|
|
|
bne .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
lda W5100.DR,x Get RTR LO
|
|
|
|
|
cmp #2000
|
|
|
|
|
beq .3
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.2 dec FD.DEV.NAME+3
|
|
|
|
|
txa
|
|
|
|
|
sec
|
|
|
|
|
sbc #$10
|
|
|
|
|
tax
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>LDYA L.MSG.DETECT.KO
|
|
|
|
|
>SYSCALL puts
|
|
|
|
|
|
|
|
|
|
lda #MLI.E.NODEV
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.3 stx DEVSLOTx0
|
2019-09-07 06:41:17 +00:00
|
|
|
|
sty DEVSLOT0x
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
lda #A2osX.S.NIC
|
|
|
|
|
sta A2osX.S,y
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
jsr Dev.ParseArgs
|
2020-02-14 16:32:52 +00:00
|
|
|
|
bcs .99
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2020-02-14 07:21:56 +00:00
|
|
|
|
>PUSHW L.MSG.DETECT.OK
|
2019-10-23 09:34:25 +00:00
|
|
|
|
>PUSHW L.FD.DEV.NAME
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>PUSHBI 2
|
2020-02-14 16:32:52 +00:00
|
|
|
|
>SYSCALL printf
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>PUSHWI DRV.END
|
2019-07-22 06:31:01 +00:00
|
|
|
|
>PUSHWI DRV.CS.END-DRV.CS.START
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>PUSHWI DRV.CS.START
|
|
|
|
|
>LDYA L.DRV.CS.START
|
|
|
|
|
>SYSCALL InsDrv
|
2020-02-14 16:32:52 +00:00
|
|
|
|
.99 bcs .9
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>STYA FD.DEV+S.FD.DEV.DRVPTR
|
2018-12-11 16:41:25 +00:00
|
|
|
|
>PUSHW L.FD.DEV.NAME
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>LDYA L.FD.DEV
|
|
|
|
|
>SYSCALL MKDEV
|
2019-09-07 06:41:17 +00:00
|
|
|
|
bcs .9
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-09-07 06:41:17 +00:00
|
|
|
|
ldx DEVSLOT0x
|
|
|
|
|
lda #A2osX.S.NIC
|
|
|
|
|
sta A2osX.S,x
|
|
|
|
|
* clc
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
Dev.ParseArgs >LDYA ARGS
|
|
|
|
|
>STYA ZPArgPTR
|
|
|
|
|
lda (ZPArgPTR)
|
|
|
|
|
bne .1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
lda A2osX.RANDOM16
|
|
|
|
|
eor A2osX.TIMER16
|
|
|
|
|
sta DCB+S.DCB.NIC.MAC+3
|
|
|
|
|
eor A2osX.RANDOM16+1
|
|
|
|
|
sta DCB+S.DCB.NIC.MAC+4
|
|
|
|
|
eor A2osX.TIMER16+1
|
|
|
|
|
sta DCB+S.DCB.NIC.MAC+5
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2020-02-14 16:32:52 +00:00
|
|
|
|
.1 >PUSHW ZPArgPtr
|
|
|
|
|
>PUSHW L.SSCANF.MAC
|
|
|
|
|
|
|
|
|
|
ldx #10
|
2019-10-23 15:12:58 +00:00
|
|
|
|
|
|
|
|
|
.2 >PUSHW L.MAC0,x
|
|
|
|
|
dex
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>PUSHBI 12 6 x byte PTRs
|
2020-02-14 16:32:52 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>SYSCALL sscanf
|
|
|
|
|
bcc .8
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-10-21 20:54:07 +00:00
|
|
|
|
lda #E.SYN
|
2019-10-23 09:34:25 +00:00
|
|
|
|
* sec
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
ARGS .BS 2
|
|
|
|
|
.DO U2AI=1
|
|
|
|
|
MSG.DETECT .AZ "UtherNet2/W5100 Driver (ARP/IP Offload)."
|
|
|
|
|
.ELSE
|
|
|
|
|
MSG.DETECT .AZ "UtherNet2/W5100 Driver."
|
|
|
|
|
.FIN
|
|
|
|
|
MSG.DETECT.OK .AZ "UtherNet2/W5100 Installed As Device : %s\r\n"
|
|
|
|
|
MSG.DETECT.KO .AZ "Hardware Not Found."
|
|
|
|
|
SSCANF.MAC .AZ "%h:%h:%h:%h:%h:%h"
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
FD.DEV .DA #S.FD.T.CDEV
|
|
|
|
|
.DA #0 HANDLER
|
|
|
|
|
.DA #0 BUSID
|
|
|
|
|
.DA #0 DEVID
|
|
|
|
|
.DA 0 BUSPTR
|
|
|
|
|
.BS 2 DRVPTR
|
2018-12-13 16:39:24 +00:00
|
|
|
|
.DA 0 DCBPTR
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.DA 0 BUFPTR
|
2019-12-03 15:42:17 +00:00
|
|
|
|
FD.DEV.NAME .AZ "eth7"
|
2018-08-25 16:26:41 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Driver Code
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPIOCTL .EQ ZPDRV
|
|
|
|
|
ZPBufPtr .EQ ZPDRV+2
|
|
|
|
|
Counter .EQ ZPDRV+4
|
|
|
|
|
Offset .EQ ZPDRV+6
|
|
|
|
|
RXTX.Size .EQ ZPDRV+8
|
2019-10-23 15:12:58 +00:00
|
|
|
|
BUF.Size .EQ ZPDRV+10
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.DO U2AI=1
|
2019-10-23 15:12:58 +00:00
|
|
|
|
RX.IP .EQ ZPDRV+12
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.FIN
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.1 .DA STATUS
|
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.DA A2osX.BADCALL
|
2018-08-27 05:39:42 +00:00
|
|
|
|
.DO U2AI=1
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.DA CONTROL
|
2018-08-27 05:39:42 +00:00
|
|
|
|
.ELSE
|
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.FIN
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.DA A2osX.BADCALL
|
|
|
|
|
.DA OPEN
|
|
|
|
|
.DA CLOSE
|
|
|
|
|
.DA READ
|
|
|
|
|
.DA WRITE
|
|
|
|
|
.DA 0 end or relocation
|
|
|
|
|
*--------------------------------------
|
2019-10-28 10:55:02 +00:00
|
|
|
|
STATUS jsr GET.IOCTLBUFPTR
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
ldy #S.IOCTL.STATCODE
|
|
|
|
|
lda (ZPIOCTL),y
|
|
|
|
|
beq .1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
cmp #S.IOCTL.STATCODE.GETDIB
|
|
|
|
|
bne STATUS.DCB
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.DIB-1
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.HS 2C bit abs
|
|
|
|
|
|
2019-10-23 09:34:25 +00:00
|
|
|
|
.1 ldy #3
|
|
|
|
|
|
|
|
|
|
.2 lda DIB,y
|
|
|
|
|
sta (ZPBufPtr),y
|
|
|
|
|
dey
|
2018-08-25 16:26:41 +00:00
|
|
|
|
bpl .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
STATUS.DCB cmp #S.IOCTL.STATCODE.GETDCB
|
|
|
|
|
bne STATUS.9
|
|
|
|
|
|
2019-10-23 09:34:25 +00:00
|
|
|
|
ldy #S.DCB.NIC-1
|
|
|
|
|
|
|
|
|
|
.1 lda DCB,y
|
|
|
|
|
sta (ZPBufPtr),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2018-08-25 16:26:41 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
STATUS.9 lda #MLI.E.BADCTL
|
|
|
|
|
sec
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2018-08-25 16:26:41 +00:00
|
|
|
|
*--------------------------------------
|
2018-08-27 05:39:42 +00:00
|
|
|
|
.DO U2AI=1
|
2019-10-28 10:55:02 +00:00
|
|
|
|
CONTROL jsr GET.IOCTLBUFPTR
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
ldy #S.IOCTL.CTRLCODE
|
|
|
|
|
lda (ZPIOCTL),y
|
|
|
|
|
cmp #S.IOCTL.CTRLCODE.SETDCB
|
|
|
|
|
bne STATUS.9
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.DCB.NIC-1
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPBufPtr),y
|
|
|
|
|
sta DCB,y
|
|
|
|
|
dey
|
2018-08-25 16:26:41 +00:00
|
|
|
|
bpl .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
|
|
|
|
bra OPEN.I
|
2018-08-27 05:39:42 +00:00
|
|
|
|
.FIN
|
2018-08-25 16:26:41 +00:00
|
|
|
|
*--------------------------------------
|
2019-05-02 09:52:32 +00:00
|
|
|
|
OPEN lda #S.DIB.S.OPENED
|
|
|
|
|
bit DIB+S.DIB.S
|
2019-10-23 09:34:25 +00:00
|
|
|
|
beq OPEN.I
|
2019-05-02 09:52:32 +00:00
|
|
|
|
|
|
|
|
|
lda #MLI.E.OPEN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
|
|
|
|
OPEN.I jsr CLOSE
|
2018-08-25 16:26:41 +00:00
|
|
|
|
|
|
|
|
|
* ldx DEVSLOTx0 Done by CLOSE
|
|
|
|
|
|
|
|
|
|
lda #W5100.MR.AI+W5100.MR.IND
|
|
|
|
|
sta W5100.MR,x
|
|
|
|
|
|
|
|
|
|
>AR.SELECT SHAR
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 lda DCB+S.DCB.NIC.MAC,y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #6
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>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
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.DO U2AI=1
|
|
|
|
|
lda #W5100.AR.S0.MR.IPRAW+W5100.AR.S0.MR.MF
|
|
|
|
|
.ELSE
|
2018-08-25 16:26:41 +00:00
|
|
|
|
lda #W5100.AR.S0.MR.MACRAW+W5100.AR.S0.MR.MF
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.FIN
|
2018-08-25 16:26:41 +00:00
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.DO U2AI=1
|
2019-12-20 19:46:21 +00:00
|
|
|
|
>AR.SELECT S0.PROTO
|
|
|
|
|
lda #S.IP.PROTOCOL.UDP For initial DHCP request
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
|
|
|
|
* >AR.SELECT S0.TOS
|
2018-08-26 09:06:04 +00:00
|
|
|
|
stz W5100.DR,x
|
2019-12-20 19:46:21 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
* >AR.SELECT S0.TTL
|
|
|
|
|
lda #K.IP.TTL
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
>AR.SELECT GAR
|
|
|
|
|
|
|
|
|
|
ldy #0
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.2 lda DCB+S.DCB.NIC.GW,y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #4
|
|
|
|
|
bne .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
* >AR.SELECT SUBR Implicit, next to GAR
|
|
|
|
|
ldy #0
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.3 lda DCB+S.DCB.NIC.MASK,y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #4
|
|
|
|
|
bne .3
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
>AR.SELECT SIPR
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
ldy #0
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.4 lda DCB+S.DCB.NIC.IP,y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #4
|
|
|
|
|
bne .4
|
|
|
|
|
.FIN
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>AR.SELECT S0.CR
|
|
|
|
|
lda #W5100.AR.S0.CR.OPEN
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
2019-10-23 09:34:25 +00:00
|
|
|
|
lda #S.DIB.S.OPENED
|
|
|
|
|
tsb DIB+S.DIB.S
|
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
|
|
|
|
lda $C019
|
|
|
|
|
.2 eor $C019
|
|
|
|
|
bpl .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
|
|
|
|
lda #S.DIB.S.OPENED
|
|
|
|
|
trb DIB+S.DIB.S
|
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
READ php
|
|
|
|
|
sei
|
|
|
|
|
|
|
|
|
|
>STYA ZPIOCTL
|
|
|
|
|
|
|
|
|
|
ldx DEVSLOTx0
|
|
|
|
|
|
|
|
|
|
>AR.SELECT S0.RX.RSR
|
|
|
|
|
lda W5100.DR,x get the received size HI
|
|
|
|
|
ora W5100.DR,x LO
|
2019-10-28 10:55:02 +00:00
|
|
|
|
bne .1
|
|
|
|
|
jmp READWRITE.NODATA
|
2018-08-25 16:26:41 +00:00
|
|
|
|
|
|
|
|
|
.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
|
2018-08-26 09:06:04 +00:00
|
|
|
|
|
|
|
|
|
.DO U2AI=1
|
|
|
|
|
ldy #0
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-10-23 15:12:58 +00:00
|
|
|
|
.10 lda W5100.DR,x IPRAW:Get Source IP
|
2018-08-26 09:06:04 +00:00
|
|
|
|
sta RX.IP,y
|
|
|
|
|
iny
|
|
|
|
|
cpy #4
|
2019-10-03 06:25:27 +00:00
|
|
|
|
bne .10
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-10-23 15:12:58 +00:00
|
|
|
|
lda W5100.DR,x get RX.Size HI (not including 6 bytes Header)
|
|
|
|
|
sta RXTX.Size+1
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter+1
|
2018-08-26 09:06:04 +00:00
|
|
|
|
lda W5100.DR,x get RX.Size LO
|
|
|
|
|
sta RXTX.Size
|
2019-10-23 15:12:58 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter
|
|
|
|
|
|
|
|
|
|
eor #$ff
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #S.IP
|
2019-10-23 15:12:58 +00:00
|
|
|
|
sta BUF.Size
|
|
|
|
|
ldy #S.IOCTL.BYTECNT
|
2018-08-25 16:26:41 +00:00
|
|
|
|
sta (ZPIOCTL),y
|
2019-10-23 15:12:58 +00:00
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda RXTX.Size+1
|
|
|
|
|
adc /S.IP
|
|
|
|
|
sta BUF.Size+1
|
2018-08-25 16:26:41 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
lda RXTX.Size
|
|
|
|
|
clc
|
2019-10-28 10:55:02 +00:00
|
|
|
|
adc #6 IPRAW: Add 6 bytes to Total Size
|
2018-08-26 09:06:04 +00:00
|
|
|
|
sta RXTX.Size
|
2019-10-28 10:55:02 +00:00
|
|
|
|
bcc .11
|
|
|
|
|
inc RXTX.Size+1
|
|
|
|
|
.11
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.ELSE
|
2019-10-23 15:12:58 +00:00
|
|
|
|
lda W5100.DR,x get RX.Size HI (Frame size + 2)
|
|
|
|
|
sta RXTX.Size+1
|
|
|
|
|
lda W5100.DR,x get RX.Size LO
|
|
|
|
|
sta RXTX.Size
|
|
|
|
|
|
|
|
|
|
ldy #S.IOCTL.BYTECNT
|
2018-08-25 16:26:41 +00:00
|
|
|
|
sec
|
2019-10-23 15:12:58 +00:00
|
|
|
|
sbc #2 MACRAW:strip 2 bytes Header from Size
|
2018-08-25 16:26:41 +00:00
|
|
|
|
sta (ZPIOCTL),y
|
2019-10-23 15:12:58 +00:00
|
|
|
|
sta BUF.Size
|
2018-08-25 16:26:41 +00:00
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter
|
|
|
|
|
|
2019-10-23 15:12:58 +00:00
|
|
|
|
iny
|
2018-08-25 16:26:41 +00:00
|
|
|
|
lda RXTX.Size+1
|
|
|
|
|
sbc #0
|
|
|
|
|
sta (ZPIOCTL),y
|
2019-10-23 15:12:58 +00:00
|
|
|
|
sta BUF.Size+1
|
2018-08-25 16:26:41 +00:00
|
|
|
|
eor #$ff
|
2019-10-28 10:55:02 +00:00
|
|
|
|
sta Counter+1
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.FIN
|
2019-10-23 15:12:58 +00:00
|
|
|
|
|
|
|
|
|
>LDYA BUF.Size
|
|
|
|
|
>SYSCALL2 getmem
|
2019-12-20 19:46:21 +00:00
|
|
|
|
bcc .14
|
|
|
|
|
|
|
|
|
|
jmp READWRITE.9
|
2019-10-23 15:12:58 +00:00
|
|
|
|
|
2019-12-20 19:46:21 +00:00
|
|
|
|
.14 >STYA ZPBufPtr
|
2019-10-23 15:12:58 +00:00
|
|
|
|
phx
|
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
ldy #S.IOCTL.BUFPTR+1
|
|
|
|
|
sta (ZPIOCTL),y
|
|
|
|
|
dey
|
|
|
|
|
pla
|
|
|
|
|
sta (ZPIOCTL),y
|
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.DO U2AI=1
|
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.IP.SRC+3
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2019-10-28 10:55:02 +00:00
|
|
|
|
.12 lda RX.IP,x
|
2018-08-26 09:06:04 +00:00
|
|
|
|
sta (ZPBufPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
2019-10-28 10:55:02 +00:00
|
|
|
|
bpl .12
|
2018-08-25 16:26:41 +00:00
|
|
|
|
|
2019-12-19 20:52:30 +00:00
|
|
|
|
ldx #3
|
|
|
|
|
ldy #S.IP.DST+3
|
|
|
|
|
|
|
|
|
|
.13 lda DCB+S.DCB.NIC.IP,x
|
|
|
|
|
sta (ZPBufPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .13
|
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
ldy #S.IP
|
|
|
|
|
.ELSE
|
2018-08-25 16:26:41 +00:00
|
|
|
|
ldy #0
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.FIN
|
2019-06-04 20:44:56 +00:00
|
|
|
|
|
|
|
|
|
ldx DEVSLOTx0
|
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.2 inc Counter
|
|
|
|
|
bne .3
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
inc Counter+1
|
|
|
|
|
beq .4
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.3 lda W5100.DR,x
|
|
|
|
|
sta (ZPBufPtr),y
|
|
|
|
|
iny
|
|
|
|
|
bne .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
inc ZPBufPtr+1
|
2019-10-23 15:12:58 +00:00
|
|
|
|
bra .2
|
2018-08-25 16:26:41 +00:00
|
|
|
|
|
|
|
|
|
.4 >AR.SELECT S0.RX.RD
|
|
|
|
|
|
|
|
|
|
lda Offset
|
|
|
|
|
clc
|
|
|
|
|
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
|
|
|
|
|
|
2019-12-20 19:46:21 +00:00
|
|
|
|
.DO U2AI=1
|
|
|
|
|
>AR.SELECT S0.PROTO
|
|
|
|
|
lda W5100.DR,x
|
|
|
|
|
ldy #S.IP.PROTOCOL
|
|
|
|
|
sta (ZPBufPtr),y
|
|
|
|
|
.FIN
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>AR.SELECT S0.CR
|
|
|
|
|
lda #W5100.AR.S0.CR.RCVD
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
2019-05-12 20:45:11 +00:00
|
|
|
|
pla hMem
|
2018-08-25 16:26:41 +00:00
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
clc
|
2019-10-28 10:55:02 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
READWRITE.NODATA
|
|
|
|
|
lda #E.NODATA
|
|
|
|
|
|
|
|
|
|
READWRITE.9 plp
|
2019-10-23 15:12:58 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2018-08-25 16:26:41 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
WRITE php
|
|
|
|
|
sei
|
2019-10-28 10:55:02 +00:00
|
|
|
|
|
|
|
|
|
jsr GET.IOCTLBUFPTR
|
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
ldy #S.IOCTL.BYTECNT
|
|
|
|
|
lda (ZPIOCTL),y
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.DO U2AI=1
|
|
|
|
|
sec
|
|
|
|
|
sbc #S.IP
|
|
|
|
|
.FIN
|
2018-08-25 16:26:41 +00:00
|
|
|
|
sta RXTX.Size
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPIOCTL),y
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.DO U2AI=1
|
|
|
|
|
sbc /S.IP
|
|
|
|
|
.FIN
|
2018-08-25 16:26:41 +00:00
|
|
|
|
sta RXTX.Size+1
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta Counter+1
|
2019-10-23 15:12:58 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
ldx DEVSLOTx0
|
|
|
|
|
|
2018-08-25 16:26:41 +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
|
2019-10-28 10:55:02 +00:00
|
|
|
|
bcc READWRITE.NODATA
|
2018-08-25 16:26:41 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.DO U2AI=1
|
|
|
|
|
>AR.SELECT S0.DIPR
|
2019-10-23 15:12:58 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
ldy #S.IP.DST
|
|
|
|
|
|
|
|
|
|
.1 lda (ZPBufPtr),y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #S.IP.DST+4
|
|
|
|
|
bne .1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
>AR.SELECT S0.PROTO
|
2019-10-23 15:12:58 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
ldy #S.IP.PROTOCOL
|
|
|
|
|
lda (ZPBufPtr),y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
.ELSE
|
2018-08-25 16:26:41 +00:00
|
|
|
|
ldy #S.ETH.SRCMAC+5
|
|
|
|
|
ldx #5
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.1 lda DCB+S.DCB.NIC.MAC,x
|
|
|
|
|
sta (ZPBufPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldx DEVSLOTx0
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.FIN
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>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
|
2019-10-28 10:55:02 +00:00
|
|
|
|
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.DO U2AI=1
|
|
|
|
|
ldy #S.IP
|
|
|
|
|
.ELSE
|
2018-08-25 16:26:41 +00:00
|
|
|
|
ldy #0
|
2018-08-26 09:06:04 +00:00
|
|
|
|
.FIN
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.2 inc Counter
|
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
inc Counter+1
|
|
|
|
|
beq .8
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.3 lda (ZPBufPtr),y
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
iny
|
|
|
|
|
bne .2
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
inc ZPBufPtr+1
|
2019-10-23 09:34:25 +00:00
|
|
|
|
bra .2
|
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
.8 >AR.SELECT S0.TX.WR
|
|
|
|
|
lda Offset
|
|
|
|
|
clc
|
|
|
|
|
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
|
2019-10-23 09:34:25 +00:00
|
|
|
|
|
2018-08-25 16:26:41 +00:00
|
|
|
|
>AR.SELECT S0.CR
|
|
|
|
|
lda #W5100.AR.S0.CR.SEND
|
|
|
|
|
sta W5100.DR,x
|
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-10-28 10:55:02 +00:00
|
|
|
|
GET.IOCTLBUFPTR >STYA ZPIOCTL
|
|
|
|
|
ldy #S.IOCTL.BUFPTR
|
2019-10-23 09:34:25 +00:00
|
|
|
|
lda (ZPIOCTL),y
|
|
|
|
|
sta ZPBufPtr
|
|
|
|
|
iny
|
|
|
|
|
lda (ZPIOCTL),y
|
|
|
|
|
sta ZPBufPtr+1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-08-25 16:26:41 +00:00
|
|
|
|
DRV.CS.END
|
|
|
|
|
DEVSLOTx0 .BS 1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DIB .DA #0
|
|
|
|
|
.DA #0,#0,#0 size
|
|
|
|
|
>PSTR "UtherNetII/W5100"
|
|
|
|
|
.DA #S.DIB.T.NIC
|
|
|
|
|
.BS 1 Subtype
|
|
|
|
|
.DA K.VER Version
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DCB .DA #S.DCB.T.NIC
|
|
|
|
|
.DO U2AI=1
|
|
|
|
|
.DA #S.DCB.NIC.FLAGS.ARPOFFLOAD+S.DCB.NIC.FLAGS.IPOFFLOAD
|
|
|
|
|
.ELSE
|
|
|
|
|
.DA #0 FLAGS
|
|
|
|
|
.FIN
|
|
|
|
|
.DA #S.DCB.NIC.LINK.OK+S.DCB.NIC.LINK.FD
|
|
|
|
|
.DA #S.DCB.NIC.SPEED.100
|
|
|
|
|
.HS 0008DC123456 MAC
|
|
|
|
|
.DA #0,#0,#0,#0 IP
|
|
|
|
|
.DA #255,#255,#255,#255 MASK
|
|
|
|
|
.DA #0,#0,#0,#0 GW
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.END
|
|
|
|
|
MAN
|
2018-12-11 16:41:25 +00:00
|
|
|
|
SAVE USR/SRC/DRV/X.U2.DRV.S
|
2019-05-04 21:13:50 +00:00
|
|
|
|
LOAD USR/SRC/DRV/UTHERNET2.DRV.S
|
2018-08-25 16:26:41 +00:00
|
|
|
|
ASM
|