2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.TF /A2OSX.BOOT/SBIN/TCPIP
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-26 20:49:08 +00:00
|
|
|
|
.INB /A2OSX.DEV/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.DEV/INC/A2OSX.I
|
|
|
|
|
.INB /A2OSX.DEV/INC/LIBTCPIP.I
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-03-16 07:19:54 +00:00
|
|
|
|
ZPIPCfgPtr .EQ ZPBIN
|
|
|
|
|
ZPIPDevPtr .EQ ZPBIN+2
|
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
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START Code Length To Relocate
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
.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
|
2016-01-16 22:05:07 +00:00
|
|
|
|
L.DEVNAME .DA DEVNAME
|
|
|
|
|
L.MSG.DEV.KO .DA MSG.DEV.KO
|
|
|
|
|
L.MSG.DEV.OK .DA MSG.DEV.OK
|
2016-01-09 22:38:03 +00:00
|
|
|
|
L.MSG.CFG .DA MSG.CFG
|
|
|
|
|
L.MSG.CFG.KO .DA MSG.CFG.KO
|
|
|
|
|
L.MSG.CFG.OK .DA MSG.CFG.OK
|
|
|
|
|
L.HOSTNAME .DA HOSTNAME
|
|
|
|
|
L.TCPIP.CONF .DA TCPIP.CONF
|
2016-01-16 22:05:07 +00:00
|
|
|
|
L.HOSTS .DA HOSTS
|
2015-03-14 21:48:35 +00:00
|
|
|
|
L.IPCFG .DA IPCFG
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL LoadLibYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
sta hLIBTCPIP
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-01-16 22:05:07 +00:00
|
|
|
|
jsr CS.INIT.DEV
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bcs .99
|
2017-01-26 21:57:35 +00:00
|
|
|
|
|
2016-01-09 22:38:03 +00:00
|
|
|
|
jsr CFG.Read continue even if error opening CFG file
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-01-16 22:05:07 +00:00
|
|
|
|
lda IPCFG+S.IPCFG.HOSTNAME
|
|
|
|
|
bne .4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
.2 lda DefaultHostName,y
|
|
|
|
|
beq .3
|
2016-01-16 22:05:07 +00:00
|
|
|
|
sta IPCFG+S.IPCFG.HOSTNAME,y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
|
|
|
|
bne .2
|
|
|
|
|
|
2016-01-16 22:05:07 +00:00
|
|
|
|
.3 lda A2osX.TIMER16
|
|
|
|
|
jsr A2CharAX
|
|
|
|
|
sta IPCFG+S.IPCFG.HOSTNAME,y
|
|
|
|
|
iny
|
|
|
|
|
txa
|
|
|
|
|
sta IPCFG+S.IPCFG.HOSTNAME,y
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda A2osX.TIMER16+1
|
|
|
|
|
jsr A2CharAX
|
|
|
|
|
sta IPCFG+S.IPCFG.HOSTNAME,y
|
|
|
|
|
iny
|
|
|
|
|
txa
|
|
|
|
|
sta IPCFG+S.IPCFG.HOSTNAME,y
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta IPCFG+S.IPCFG.HOSTNAME,y
|
|
|
|
|
|
|
|
|
|
.4 >PUSHW L.IPCFG
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.SET.IPCFG
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pPs)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pPs)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2016-01-16 22:05:07 +00:00
|
|
|
|
CS.INIT.DEV >LDYA L.DEVNAME
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetDevByNameYA
|
2016-01-16 22:05:07 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
inc DEVNAME+4
|
|
|
|
|
lda DEVNAME+4
|
|
|
|
|
cmp #'8'
|
|
|
|
|
bne CS.INIT.DEV
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.DEV.KO
|
2016-11-03 16:24:41 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2017-01-26 21:57:35 +00:00
|
|
|
|
lda #$28 MLI.ERR.NODEV
|
2016-01-16 22:05:07 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2017-01-26 21:57:35 +00:00
|
|
|
|
.1 >STYA ZPIPDevPtr
|
2017-03-15 16:44:15 +00:00
|
|
|
|
>STYA NetDevJmp+1
|
2017-01-26 21:57:35 +00:00
|
|
|
|
stx hNetDev
|
|
|
|
|
stx IPCFG+S.IPCFG.HDEV
|
|
|
|
|
|
2016-01-16 22:05:07 +00:00
|
|
|
|
>PUSHW L.DEVNAME
|
|
|
|
|
>LDYA L.MSG.DEV.OK
|
2016-11-03 16:24:41 +00:00
|
|
|
|
>SYSCALL CPrintFYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
ldx #DEVMGR.OPEN
|
2017-01-26 21:57:35 +00:00
|
|
|
|
jsr NetDevJmp
|
2016-01-16 22:05:07 +00:00
|
|
|
|
bcs .9
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-01-26 21:57:35 +00:00
|
|
|
|
ldx #DEVMGR.STATUS
|
|
|
|
|
jsr NetDevJmp
|
2016-01-16 22:05:07 +00:00
|
|
|
|
bcs .9
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>STYA ZPIPDevPtr
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-01-26 21:57:35 +00:00
|
|
|
|
ldy #S.DEVSTAT+2 MAC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldx #S.IPCFG.MAC
|
2016-01-09 22:38:03 +00:00
|
|
|
|
|
2016-01-16 22:05:07 +00:00
|
|
|
|
.2 lda (ZPIPDevPtr),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sta IPCFG,x
|
|
|
|
|
iny
|
2015-06-03 18:30:57 +00:00
|
|
|
|
inx
|
|
|
|
|
cpx #S.IPCFG.MAC+6
|
2016-01-16 22:05:07 +00:00
|
|
|
|
bne .2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-01-16 22:05:07 +00:00
|
|
|
|
|
|
|
|
|
.9 sec
|
2015-03-25 16:30:00 +00:00
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-29 21:47:19 +00:00
|
|
|
|
CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.POLL
|
|
|
|
|
clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2017-01-26 21:57:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT lda (pEvent)
|
2017-01-30 21:03:12 +00:00
|
|
|
|
bpl .9
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2016-03-20 22:16:28 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.PULSEA
|
|
|
|
|
|
|
|
|
|
.9 sec never discard TIME event
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-01-16 22:05:07 +00:00
|
|
|
|
CS.QUIT lda IPCFG+S.IPCFG.HDEV
|
|
|
|
|
beq .1
|
|
|
|
|
ldx #DEVMGR.CLOSE
|
2017-01-26 21:57:35 +00:00
|
|
|
|
jsr NetDevJmp
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2016-01-16 22:05:07 +00:00
|
|
|
|
.1 lda hLIBTCPIP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL UnloadLibA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-01-16 22:05:07 +00:00
|
|
|
|
A2CharAX pha
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
and #$0F
|
|
|
|
|
ora #$30
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcc .1
|
|
|
|
|
adc #6
|
|
|
|
|
.1 tax
|
|
|
|
|
pla
|
|
|
|
|
and #$0F
|
|
|
|
|
ora #$30
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcc .8
|
|
|
|
|
adc #6
|
|
|
|
|
.8 rts
|
2016-01-09 22:38:03 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-26 21:57:35 +00:00
|
|
|
|
NetDevJmp jmp *
|
2016-09-22 06:19:49 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB SBIN/TCPIP.S.CFG
|
2016-01-09 22:38:03 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
LIBTCPIP >PSTR "libtcpip.o"
|
|
|
|
|
DEVNAME >PSTR "ETH1"
|
2017-02-28 16:58:36 +00:00
|
|
|
|
MSG.DEV.KO >CSTR "TCPIP:No Device Found, exiting.\r\n"
|
|
|
|
|
MSG.DEV.OK >CSTR "TCPIP:Bound To Device : %S\r\n"
|
2016-10-24 15:54:43 +00:00
|
|
|
|
MSG.CFG >CSTR "TCPIP:Reading %S..."
|
2017-02-28 16:58:36 +00:00
|
|
|
|
MSG.CFG.KO >CSTR "Failed!!! [%h]\r\n"
|
|
|
|
|
MSG.CFG.OK >CSTR "OK.\r\n"
|
2016-10-24 15:54:43 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
HOSTNAME >PSTR "${A2OSX}ETC/HOSTNAME"
|
|
|
|
|
TCPIP.CONF >PSTR "${A2OSX}ETC/TCPIP.CONF"
|
|
|
|
|
HOSTS >PSTR "${A2OSX}ETC/HOSTS"
|
|
|
|
|
DefaultHostName >CSTR "a2osx-"
|
|
|
|
|
CFG.Keywords >PSTR "DOMAIN"
|
|
|
|
|
>PSTR "IP"
|
|
|
|
|
>PSTR "MASK"
|
|
|
|
|
>PSTR "GW"
|
|
|
|
|
>PSTR "DNS1"
|
|
|
|
|
>PSTR "DNS2"
|
2016-01-09 22:38:03 +00:00
|
|
|
|
CFG.Keyword.Map .DA #0 End Of Keyword table and NA Keyword
|
|
|
|
|
.DA #S.IPCFG.IP
|
|
|
|
|
.DA #S.IPCFG.MASK
|
|
|
|
|
.DA #S.IPCFG.GW
|
2016-01-16 22:05:07 +00:00
|
|
|
|
.DA #S.IPCFG.DNS1
|
|
|
|
|
.DA #S.IPCFG.DNS2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
2016-01-09 22:38:03 +00:00
|
|
|
|
hNetDev .BS 1
|
2016-01-16 22:05:07 +00:00
|
|
|
|
IPCFG .BS S.IPCFG
|
2016-01-09 22:38:03 +00:00
|
|
|
|
CFG.hCfgFile .BS 1
|
2016-10-26 20:49:08 +00:00
|
|
|
|
CFG.hCfgPath .BS 1
|
2016-01-09 22:38:03 +00:00
|
|
|
|
CFG.FileLen .BS 2
|
|
|
|
|
CFG.Keyword .BS 1
|
|
|
|
|
CFG.StrBuf .BS 4
|
|
|
|
|
CFG.HexByte .BS 1
|
|
|
|
|
CFG.IP .BS 5
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SBIN/TCPIP.S
|
|
|
|
|
ASM
|