PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
				.LIST OFF	
*--------------------------------------
*  PULLW = PTR to S.IPCFG
*--------------------------------------
SET.IPCFG		>PULLW ZPTmpPtr1
				ldy #0
.1				lda (ZPTmpPtr1),y
				sta IPCFG,y
				iny
				cpy #S.IPCFG
				bne .1
				
				ldx #5
.2				lda IPCFG+S.IPCFG.MAC,x
				sta ARP.REQ.SRCMAC,x
				sta ARP.REQ.SHA,x
				sta ARP.REP.SRCMAC,x
				sta ARP.REP.SHA,x
				dex
				bpl .2
				
				ldx #3
.3				lda IPCFG+S.IPCFG.IP,x
				sta ARP.REQ.SPA,x
				sta ARP.REP.SPA,x
				sta DNS.SOCKET.SA,x
				dex
				bpl .3
						
				lda IPCFG+S.IPCFG.HDEV
				
				>SYSCALL SYS.GetDevByIDA
				>STYA NetDevJmp+1

				ldx #DEVMGR.GETINFO
				jsr NetDevJmp
				
				>STYA ZPTmpPtr2
				ldy #S.DEVINFO.FLAGS
				lda (ZPTmpPtr2),y
				sta DevFlags
				and #S.DEVINFO.NET.FLAGS.ARPOFFLOAD
				beq .4
				
				>LDYA ZPTmpPtr1
				ldx #DEVMGR.SETIPCFG
				jsr NetDevJmp
				
.4				lda hDNSSocket1
				beq .41
				jsr SKT.CLOSEA
				
.41				lda hDNSSocket2
				beq .42
				jsr SKT.CLOSEA
				
.42				lda IPCFG+S.IPCFG.DNS1
				beq .6
				
				ldx #3
.5				lda IPCFG+S.IPCFG.DNS1,x
				sta DNS.SOCKET.DA,x
				dex
				bpl .5
				
				>PUSHW L.DNS.SOCKET
				jsr SKT.NEW
				bcs .9

				stx hDNSSocket1
				
.6				lda IPCFG+S.IPCFG.DNS2
				beq .8
				
				ldx #3
.7				lda IPCFG+S.IPCFG.DNS2,x
				sta DNS.SOCKET.DA,x
				dex
				bpl .7
				
				>PUSHW L.DNS.SOCKET
				jsr SKT.NEW
				bcs .9
			
				stx hDNSSocket2
				
.8				>LDYA ZPTmpPtr1
				clc
.9				rts
*--------------------------------------
* grab a copy on the fly for lib function
* OUT :
*  Y,A = PTR to S.IPCFG
*--------------------------------------
GET.IPCFG		>LDYA L.IPCFG
				clc
				rts
*--------------------------------------
MAN
SAVE LIB/LIBTCPIP.S.CFG
LOAD LIB/LIBTCPIP.S
ASM
