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
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.TF SBIN/DHCPCLNT
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
.INB INC/ETH.I
|
|
|
|
|
.INB INC/LIBTCPIP.I
|
|
|
|
|
.INB INC/NET.DHCP.I
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-09 16:38:27 +00:00
|
|
|
|
TIMEOUT.MAX .EQ 200 20 sec.
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
2016-03-27 21:00:19 +00:00
|
|
|
|
ZPIPCfgPtr .EQ ZPBIN
|
|
|
|
|
ZPFrameBase .EQ ZPBIN+2
|
|
|
|
|
ZPFramePtr .EQ ZPBIN+4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
2018-09-25 06:25:32 +00:00
|
|
|
|
.DA #S.PS.F.EVENT
|
|
|
|
|
.DA #0
|
2017-10-06 06:33:21 +00:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
2018-07-25 15:26:14 +00:00
|
|
|
|
.DA #64 SS
|
2017-10-06 06:33:21 +00:00
|
|
|
|
.DA #6 ZP
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
|
|
|
|
L.IPCFG .DA IPCFG
|
2016-03-27 21:00:19 +00:00
|
|
|
|
L.Socket .DA Socket
|
2016-03-13 21:54:28 +00:00
|
|
|
|
L.MSG.CFG1 .DA MSG.CFG1
|
|
|
|
|
L.MSG.CFG2 .DA MSG.CFG2
|
2016-01-09 22:39:10 +00:00
|
|
|
|
L.MSG.CFG.KO .DA MSG.CFG.KO
|
|
|
|
|
L.MSG.CFG.OK .DA MSG.CFG.OK
|
2016-03-13 21:54:28 +00:00
|
|
|
|
L.MSG.CFG.ND .DA MSG.CFG.ND
|
2016-01-09 22:39:10 +00:00
|
|
|
|
L.MSG.CFG.NA .DA MSG.CFG.NA
|
2016-03-27 21:00:19 +00:00
|
|
|
|
L.DHCP.DISC .DA DHCP.DISC
|
|
|
|
|
L.DHCP.REQ .DA DHCP.REQ
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-01-09 22:39:10 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
2018-07-19 15:33:55 +00:00
|
|
|
|
>SYSCALL LoadLib
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG
|
|
|
|
|
bcs .9
|
2018-07-26 06:03:49 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
>STYA ZPIPCfgPtr
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
lda (ZPIPCfgPtr)
|
2016-01-16 22:05:07 +00:00
|
|
|
|
and #S.IPCFG.STATUS.OK
|
|
|
|
|
bne .99 Already Configured, exit
|
2018-07-26 06:03:49 +00:00
|
|
|
|
|
2018-08-08 15:13:37 +00:00
|
|
|
|
ldy #S.IPCFG.hFD
|
2016-03-27 21:00:19 +00:00
|
|
|
|
lda (ZPIPCfgPtr),y
|
2016-03-13 21:54:28 +00:00
|
|
|
|
beq .98
|
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
ldy #S.IPCFG-1
|
2018-07-26 06:03:49 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.1 lda (ZPIPCfgPtr),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta IPCFG,y
|
2016-03-27 21:00:19 +00:00
|
|
|
|
dey
|
|
|
|
|
bne .1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2018-07-26 06:03:49 +00:00
|
|
|
|
stz IPCFG+S.IPCFG.STATUS
|
2016-03-27 21:00:19 +00:00
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
ldx #3
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
.11 lda A2osX.TIMER16,x
|
|
|
|
|
sta DHCP.DISC.XID,x
|
|
|
|
|
sta DHCP.REQ.XID,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .11
|
|
|
|
|
|
2018-07-26 06:03:49 +00:00
|
|
|
|
ldx #5
|
|
|
|
|
|
2016-01-16 22:05:07 +00:00
|
|
|
|
.2 lda IPCFG+S.IPCFG.MAC,x
|
2016-03-27 21:00:19 +00:00
|
|
|
|
sta DHCP.DISC.CHADDR,x
|
|
|
|
|
sta DHCP.REQ.CHADDR,x
|
2015-03-14 21:48:35 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
2016-01-09 22:39:10 +00:00
|
|
|
|
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.98 >LDYA L.MSG.CFG.ND
|
|
|
|
|
bra .90
|
2016-01-09 22:39:10 +00:00
|
|
|
|
.99 >LDYA L.MSG.CFG.NA
|
2018-09-10 15:07:26 +00:00
|
|
|
|
|
2018-08-23 15:16:20 +00:00
|
|
|
|
.90 >SYSCALL puts
|
2016-01-09 22:39:10 +00:00
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-18 06:28:51 +00:00
|
|
|
|
CS.RUN >PUSHW L.Socket
|
2017-01-30 21:03:12 +00:00
|
|
|
|
|
2017-02-15 21:46:21 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.New
|
2016-03-27 21:00:19 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
jmp CS.RUN.KO
|
|
|
|
|
|
2018-09-25 06:25:32 +00:00
|
|
|
|
.1 >STA.G hSocket
|
2016-03-27 21:00:19 +00:00
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.CFG1
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>SYSCALL puts
|
2016-01-09 22:39:10 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
jsr Init.Timeout
|
|
|
|
|
|
2018-09-17 15:42:38 +00:00
|
|
|
|
CS.RUN.SDISC >PUSHWI DHCP.DISC.LEN
|
2016-03-27 21:00:19 +00:00
|
|
|
|
>PUSHW L.DHCP.DISC
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>LDA.G hSocket
|
2018-09-25 06:25:32 +00:00
|
|
|
|
|
2018-08-29 15:01:02 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.Send
|
2016-03-27 21:00:19 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
jmp CS.RUN.KO
|
2016-03-13 21:54:28 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.1 lda #S.IPCFG.STATUS.SDISC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta IPCFG
|
2016-03-13 21:54:28 +00:00
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
CS.RUN.ROFFER >SLEEP
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
jsr CS.RUN.SKT.RCVD
|
|
|
|
|
bcc .1
|
2016-03-13 21:54:28 +00:00
|
|
|
|
jsr Wait.Timeout
|
2017-03-09 07:11:44 +00:00
|
|
|
|
bne CS.RUN.ROFFER
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
lda #1
|
|
|
|
|
jmp CS.RUN.KO
|
|
|
|
|
|
|
|
|
|
.1 jsr CheckDHCPOffer
|
|
|
|
|
|
|
|
|
|
bcs CS.RUN.ROFFER
|
|
|
|
|
|
|
|
|
|
lda #S.IPCFG.STATUS.ROFFER
|
|
|
|
|
sta IPCFG
|
|
|
|
|
|
|
|
|
|
CS.RUN.SREQ ldx #3
|
2016-03-13 21:54:28 +00:00
|
|
|
|
|
|
|
|
|
.1 >PUSHB IPCFG+S.IPCFG.DHCPSRVR,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 4
|
2016-03-13 21:54:28 +00:00
|
|
|
|
>LDYA L.MSG.CFG2
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-03-13 21:54:28 +00:00
|
|
|
|
|
2017-02-13 07:26:18 +00:00
|
|
|
|
>PUSHWI DHCP.REQ.LEN
|
2018-09-17 15:42:38 +00:00
|
|
|
|
>PUSHW L.DHCP.REQ
|
|
|
|
|
>LDA.G hSocket
|
2018-08-29 15:01:02 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.Send
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs CS.RUN.KO
|
|
|
|
|
|
|
|
|
|
lda #S.IPCFG.STATUS.SREQ
|
|
|
|
|
sta IPCFG
|
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
CS.RUN.RACK >SLEEP
|
2016-03-27 21:00:19 +00:00
|
|
|
|
|
|
|
|
|
jsr CS.RUN.SKT.RCVD
|
|
|
|
|
bcc .1
|
2016-03-13 21:54:28 +00:00
|
|
|
|
jsr Wait.Timeout
|
2017-03-09 07:11:44 +00:00
|
|
|
|
bne CS.RUN.RACK
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #2
|
2016-03-27 21:00:19 +00:00
|
|
|
|
bra CS.RUN.KO
|
2016-03-13 21:54:28 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.1 jsr CheckDHCPAck
|
|
|
|
|
bcs CS.RUN.RACK
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
CS.RUN.OK lda #S.IPCFG.STATUS.OK
|
|
|
|
|
sta IPCFG
|
|
|
|
|
|
|
|
|
|
>PUSHW L.IPCFG
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SET.IPCFG
|
|
|
|
|
|
2016-01-09 22:39:10 +00:00
|
|
|
|
ldx #3
|
|
|
|
|
.1 lda IPCFG+S.IPCFG.MASK,x
|
|
|
|
|
>PUSHA
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
.2 lda IPCFG+S.IPCFG.IP,x
|
|
|
|
|
>PUSHA
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 8
|
2016-01-09 22:39:10 +00:00
|
|
|
|
>LDYA L.MSG.CFG.OK
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2015-03-14 21:48:35 +00:00
|
|
|
|
lda #0 Leave with NO ERROR
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2016-03-27 21:00:19 +00:00
|
|
|
|
|
|
|
|
|
CS.RUN.KO pha
|
|
|
|
|
>PUSHA
|
2018-08-23 15:16:20 +00:00
|
|
|
|
>PUSHBI 1
|
2016-03-27 21:00:19 +00:00
|
|
|
|
>LDYA L.MSG.CFG.KO
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2016-03-27 21:00:19 +00:00
|
|
|
|
pla
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-07-26 06:03:49 +00:00
|
|
|
|
CS.RUN.SKT.RCVD >LDA.G hSocket
|
2018-08-29 15:01:02 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.Rcvd
|
2016-03-27 21:00:19 +00:00
|
|
|
|
bcs .9
|
2018-07-26 06:03:49 +00:00
|
|
|
|
>STA.G hFrame
|
|
|
|
|
|
2018-07-18 15:30:42 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2016-03-27 21:00:19 +00:00
|
|
|
|
>STYA ZPFrameBase
|
|
|
|
|
.9 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
CS.DOEVENT lda (pEvent)
|
2017-01-26 21:57:35 +00:00
|
|
|
|
bpl .9 is it a TIMER event?
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-03-13 21:54:28 +00:00
|
|
|
|
ldy #TimeOut
|
|
|
|
|
lda (pData),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
beq .9
|
2017-01-26 21:57:35 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
dec
|
2016-03-13 21:54:28 +00:00
|
|
|
|
sta (pData),y
|
2017-01-26 21:57:35 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.9 sec do not discard TIMER event
|
2016-03-13 21:54:28 +00:00
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-26 06:03:49 +00:00
|
|
|
|
CS.QUIT >LDA.G hSocket
|
2017-03-16 07:32:24 +00:00
|
|
|
|
beq .1
|
2018-07-26 06:03:49 +00:00
|
|
|
|
|
2018-07-23 15:28:42 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.Close
|
2016-03-27 21:00:19 +00:00
|
|
|
|
|
2017-03-16 07:32:24 +00:00
|
|
|
|
.1 lda hLIBTCPIP
|
2018-07-20 14:10:10 +00:00
|
|
|
|
>SYSCALL UnloadLib
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-27 21:00:19 +00:00
|
|
|
|
CheckDHCPOffer jsr CheckDHCPXID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
lda ZPFrameBase
|
|
|
|
|
clc
|
|
|
|
|
adc #S.DHCP.OPTIONS
|
|
|
|
|
sta ZPFramePtr
|
|
|
|
|
|
|
|
|
|
lda ZPFrameBase+1
|
|
|
|
|
adc /S.DHCP.OPTIONS
|
|
|
|
|
sta ZPFramePtr+1
|
|
|
|
|
|
|
|
|
|
lda (ZPFramePtr)
|
|
|
|
|
cmp #S.DHCP.OPTIONS.MSGTYPE
|
|
|
|
|
bne .9
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
ldy #2
|
2016-03-27 21:00:19 +00:00
|
|
|
|
lda (ZPFramePtr),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
cmp #S.DHCP.OPTIONS.DHCPOffer
|
|
|
|
|
bne .9
|
|
|
|
|
|
2017-03-09 16:38:27 +00:00
|
|
|
|
ldy #S.DHCP.GIADDR+3
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldx #3
|
2017-03-09 07:11:44 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.1 lda (ZPFrameBase),y
|
2017-03-09 16:38:27 +00:00
|
|
|
|
sta DHCP.REQ.GIADDR,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldy #S.DHCP.YIADDR+3
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPFrameBase),y
|
2016-03-27 21:00:19 +00:00
|
|
|
|
sta DHCP.REQ.OPT.REQIP,x
|
2017-03-09 07:11:44 +00:00
|
|
|
|
sta IPCFG+S.IPCFG.IP,x
|
2015-03-14 21:48:35 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
2017-03-09 16:38:27 +00:00
|
|
|
|
bpl .2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IP.SRC+3
|
|
|
|
|
ldx #3
|
2017-03-09 07:11:44 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.3 lda (ZPFrameBase),y
|
|
|
|
|
sta DHCP.REQ.OPT.SVRIP,x
|
2017-03-09 07:11:44 +00:00
|
|
|
|
sta IPCFG+S.IPCFG.DHCPSRVR,x
|
2015-03-14 21:48:35 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.5 inc ZPFramePtr skip Option 53 (DHCPOffer:530102)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .6
|
2016-03-27 21:00:19 +00:00
|
|
|
|
inc ZPFramePtr+1
|
2017-03-09 07:11:44 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.6 lda (ZPFramePtr)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
2016-03-27 21:00:19 +00:00
|
|
|
|
adc ZPFramePtr add option len + 1
|
|
|
|
|
sta ZPFramePtr
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcc .7
|
2016-03-27 21:00:19 +00:00
|
|
|
|
inc ZPFramePtr+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.7 lda (ZPFramePtr)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
cmp #S.DHCP.OPTIONS.END
|
|
|
|
|
beq .8
|
|
|
|
|
jsr GetDHCPOption
|
|
|
|
|
bra .5
|
2017-01-29 21:47:19 +00:00
|
|
|
|
|
|
|
|
|
.8 jsr CS.RUN.DISCARD
|
|
|
|
|
clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2017-01-29 21:47:19 +00:00
|
|
|
|
.9 jsr CS.RUN.DISCARD
|
|
|
|
|
sec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-07-26 06:03:49 +00:00
|
|
|
|
CS.RUN.DISCARD >LDA.G hFrame
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
GetDHCPOption cmp #S.DHCP.OPTIONS.MASK
|
|
|
|
|
bne .1
|
2016-11-27 21:59:46 +00:00
|
|
|
|
ldx #S.IPCFG.MASK
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bra GetDHCPOption.CopyIP
|
|
|
|
|
|
|
|
|
|
.1 cmp #S.DHCP.OPTIONS.GW
|
|
|
|
|
bne .2
|
2016-11-27 21:59:46 +00:00
|
|
|
|
|
|
|
|
|
ldx #S.IPCFG.GW
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bra GetDHCPOption.CopyIP
|
|
|
|
|
|
|
|
|
|
.2 cmp #S.DHCP.OPTIONS.DNS
|
|
|
|
|
bne .3
|
2016-11-27 21:59:46 +00:00
|
|
|
|
|
|
|
|
|
ldx #S.IPCFG.DNS1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bra GetDHCPOption.CopyIP
|
|
|
|
|
|
|
|
|
|
.3 cmp #S.DHCP.OPTIONS.DOMAIN
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
|
2016-11-27 21:59:46 +00:00
|
|
|
|
lda (ZPFramePtr),y Get String len
|
|
|
|
|
cmp #80
|
|
|
|
|
bcc .4
|
|
|
|
|
lda #79
|
|
|
|
|
|
|
|
|
|
.4 sta IPCFG+S.IPCFG.DOMAIN store len
|
|
|
|
|
tax
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-11-27 21:59:46 +00:00
|
|
|
|
.5 iny
|
|
|
|
|
lda (ZPFramePtr),y
|
|
|
|
|
sta IPCFG+S.IPCFG.DOMAIN-1,y
|
|
|
|
|
dex
|
|
|
|
|
bne .5
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.9 rts
|
2016-11-27 21:59:46 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
GetDHCPOption.CopyIP
|
2016-11-27 21:59:46 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPFramePtr),y Get Byte count
|
|
|
|
|
cmp #9
|
|
|
|
|
bcc .1
|
|
|
|
|
lda #8 max 8 bytes (2 DNS)
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
|
|
|
|
|
.2 pha
|
|
|
|
|
|
|
|
|
|
lda (ZPFramePtr),y
|
|
|
|
|
sta IPCFG,x
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
inx
|
2016-11-27 21:59:46 +00:00
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
dec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2016-11-27 21:59:46 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-27 21:00:19 +00:00
|
|
|
|
CheckDHCPAck jsr CheckDHCPXID
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
lda ZPFrameBase
|
|
|
|
|
clc
|
|
|
|
|
adc #S.DHCP.OPTIONS
|
|
|
|
|
sta ZPFramePtr
|
|
|
|
|
|
|
|
|
|
lda ZPFrameBase+1
|
|
|
|
|
adc /S.DHCP.OPTIONS
|
|
|
|
|
sta ZPFramePtr+1
|
|
|
|
|
|
|
|
|
|
lda (ZPFramePtr)
|
|
|
|
|
cmp #S.DHCP.OPTIONS.MSGTYPE
|
|
|
|
|
bne .9
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-03-09 07:11:44 +00:00
|
|
|
|
ldy #2
|
2016-03-27 21:00:19 +00:00
|
|
|
|
lda (ZPFramePtr),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
cmp #S.DHCP.OPTIONS.DHCPAck
|
|
|
|
|
bne .9
|
|
|
|
|
|
2017-01-29 21:47:19 +00:00
|
|
|
|
jsr CS.RUN.DISCARD
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-01-29 21:47:19 +00:00
|
|
|
|
.9 jsr CS.RUN.DISCARD
|
|
|
|
|
sec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CheckDHCPXID ldy #S.DHCP.XID+3
|
|
|
|
|
ldx #3
|
2017-03-09 07:11:44 +00:00
|
|
|
|
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.1 lda (ZPFrameBase),y
|
|
|
|
|
cmp DHCP.DISC.XID,x same XID ?
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .9
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2017-01-29 21:47:19 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-01-29 21:47:19 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-03-13 21:54:28 +00:00
|
|
|
|
Init.Timeout ldy #TimeOut
|
|
|
|
|
lda #TIMEOUT.MAX
|
|
|
|
|
sta (pData),y
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-03-09 07:11:44 +00:00
|
|
|
|
Wait.TimeOut ldy #TimeOut
|
2016-03-13 21:54:28 +00:00
|
|
|
|
lda (pData),y
|
2017-03-09 07:11:44 +00:00
|
|
|
|
rts
|
2016-03-13 21:54:28 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
CS.END
|
2018-04-11 15:35:51 +00:00
|
|
|
|
LIBTCPIP .AZ "libtcpip.o"
|
2018-08-23 15:16:20 +00:00
|
|
|
|
MSG.CFG1 .AZ "DHCPCLNT:Searching for DHCP servers..."
|
2018-04-11 15:35:51 +00:00
|
|
|
|
MSG.CFG2 .AZ "DHCPCLNT:Reply from DHCP Server at %d.%d.%d.%d, requesting...\r\n"
|
|
|
|
|
MSG.CFG.KO .AZ "DHCPCLNT:Time Out [%h].\r\n"
|
|
|
|
|
MSG.CFG.OK .AZ "DHCPCLNT:Success:[IP=%d.%d.%d.%d/%d.%d.%d.%d]\r\n"
|
2018-08-23 15:16:20 +00:00
|
|
|
|
MSG.CFG.ND .AZ "DHCPCLNT:No Device, exiting."
|
|
|
|
|
MSG.CFG.NA .AZ "DHCPCLNT:TCPIP Already configured, exiting."
|
2016-03-13 21:54:28 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
|
|
|
|
IPCFG .BS S.IPCFG
|
2016-03-27 21:00:19 +00:00
|
|
|
|
*--------------------------------------
|
2018-09-28 15:24:44 +00:00
|
|
|
|
Socket .DA #S.SOCKET.T.DGRAM
|
2016-03-27 21:00:19 +00:00
|
|
|
|
.BS 3
|
|
|
|
|
.HS 00.00.00.00 Socket.Src.Addr
|
|
|
|
|
.DA UDP.PORT.DHCPC Socket.Src.Port
|
|
|
|
|
.HS FF.FF.FF.FF Socket.Dst.Addr
|
|
|
|
|
.DA UDP.PORT.DHCPS Socket.Dst.Port
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DHCP.DISC .HS 01010600 OP,HTYPE,HLEN,HOPS
|
|
|
|
|
DHCP.DISC.XID .BS 4
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.HS 0000 SECS
|
2017-03-16 16:59:24 +00:00
|
|
|
|
.DA S.DHCP.FLAGS.BRDCST
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.HS 00000000 CIADDR
|
2016-03-27 21:00:19 +00:00
|
|
|
|
DHCP.DISC.YIADDR .HS 00000000
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.HS 00000000 SIADDR
|
2017-03-09 16:38:27 +00:00
|
|
|
|
DHCP.DISC.GIADDR .HS 00000000
|
2016-03-27 21:00:19 +00:00
|
|
|
|
DHCP.DISC.CHADDR .HS 00000000.00000000.00000000.00000000
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.BS 64 SNAME
|
|
|
|
|
.BS 128 FILE
|
|
|
|
|
.HS 63825363 COOKIE
|
|
|
|
|
.HS 3501 OPT
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA #S.DHCP.OPTIONS.DHCPDiscover
|
|
|
|
|
.HS 37040103060FFF
|
2016-03-27 21:00:19 +00:00
|
|
|
|
DHCP.DISC.LEN .EQ *-DHCP.DISC
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DHCP.REQ .HS 01010600 OP,HTYPE,HLEN,HOPS
|
|
|
|
|
DHCP.REQ.XID .BS 4
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.HS 0000 SECS
|
2017-03-16 16:59:24 +00:00
|
|
|
|
.DA S.DHCP.FLAGS.BRDCST
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.HS 00000000 CIADDR
|
2016-03-27 21:00:19 +00:00
|
|
|
|
DHCP.REQ.YIADDR .HS 00000000
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.HS 00000000 SIADDR
|
2017-03-09 16:38:27 +00:00
|
|
|
|
DHCP.REQ.GIADDR .HS 00000000
|
2016-03-27 21:00:19 +00:00
|
|
|
|
DHCP.REQ.CHADDR .HS 00000000.00000000.00000000.00000000
|
2016-03-13 21:54:28 +00:00
|
|
|
|
.BS 64 SNAME
|
|
|
|
|
.BS 128 FILE
|
|
|
|
|
.HS 63825363 COOKIE
|
|
|
|
|
.HS 3501 OPT
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA #S.DHCP.OPTIONS.DHCPRequest
|
|
|
|
|
.HS 3204
|
2016-03-27 21:00:19 +00:00
|
|
|
|
DHCP.REQ.OPT.REQIP .BS 4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.HS 3604
|
2016-03-27 21:00:19 +00:00
|
|
|
|
DHCP.REQ.OPT.SVRIP .BS 4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.HS FF
|
2016-03-27 21:00:19 +00:00
|
|
|
|
DHCP.REQ.LEN .EQ *-DHCP.REQ
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
DS.START
|
2016-03-13 21:54:28 +00:00
|
|
|
|
TimeOut .BS 1
|
2016-03-27 21:00:19 +00:00
|
|
|
|
hSocket .BS 1
|
|
|
|
|
hFrame .BS 1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
DS.END
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SBIN/DHCPCLNT.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|