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