A2osX/BIN/IPCONFIG.S.ETC.txt

347 lines
5.8 KiB
Plaintext
Raw Normal View History

2018-12-06 16:39:53 +00:00
NEW
PREFIX
AUTO 4,1
.LIST OFF
*--------------------------------------
CFG.EtcFiles >LDYAI 256
>SYSCALL GetMem
2019-01-17 15:05:48 +00:00
bcc .1
rts
.1 >STYA ZPTmpPtr1
2018-12-06 16:39:53 +00:00
stx CFG.hBuf1
>LDYA L.HOSTNAME
jsr CFG.Read.PrintF
jsr CFG.Read.HOSTNAME
lda IPCFG+S.IPCFG.HOSTNAME
bne .4
2020-02-14 07:21:56 +00:00
>PUSHW L.IPCFG.HOSTNAME
>PUSHW L.CFG.DefaultHost
2019-01-14 16:37:56 +00:00
>PUSHW A2osX.TIMER16
>PUSHBI 2
>SYSCALL sprintf
2020-02-14 07:21:56 +00:00
2018-12-06 16:39:53 +00:00
.4 >LDYA L.TCPIP.CONF
jsr CFG.Read.PrintF
jsr CFG.Read.TCPIP.CONF
lda IPCFG+S.IPCFG.IP
beq .5
lda #S.IPCFG.STATUS.OK
2019-01-17 15:05:48 +00:00
sta IPCFG+S.NETCFG.STATUS
2018-12-06 16:39:53 +00:00
.5 >LDYA L.HOSTS
jsr CFG.Read.PrintF
jsr CFG.Read.HOSTS
2019-01-17 15:05:48 +00:00
>PUSHW L.IPCFG
>LIBCALL hLIBTCPIP,LIBTCPIP.SETCFG
2018-12-06 16:39:53 +00:00
lda CFG.hBuf1
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2019-10-03 06:25:27 +00:00
.9 rts
2018-12-06 16:39:53 +00:00
*--------------------------------------
2020-02-14 07:21:56 +00:00
CFG.Read.PrintF pha
>PUSHW L.MSG.CFG
pla
>PUSHYA
2018-12-06 16:39:53 +00:00
>PUSHBI 2
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2018-12-06 16:39:53 +00:00
rts
*--------------------------------------
CFG.Read.HOSTNAME
>LDYA L.HOSTNAME
jsr CFG.Read.Open
jsr CFG.Read.Result
bcs .9
.1 jsr CFG.Read.GetS
bcs .8
lda (ZPTmpPtr1)
beq .1 empty line...
cmp #'#
beq .1 comment...
ldy #0
.2 lda (ZPTmpPtr1),y
sta IPCFG+S.IPCFG.HOSTNAME,y
beq .8 end of name
iny
cpy #15
bne .2
.8 clc
.HS B0 BCS
.9 sec
jmp CFG.Read.Close
*--------------------------------------
CFG.Read.TCPIP.CONF
>LDYA L.TCPIP.CONF
jsr CFG.Read.Open
jsr CFG.Read.Result
bcs .9
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
.1 jsr CFG.Read.GetS
bcs .8
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
lda (ZPTmpPtr1)
beq .1 empty line...
2020-04-07 06:01:38 +00:00
cmp #'#'
2018-12-06 16:39:53 +00:00
beq .1 comment...
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
ldy #$ff
.2 iny
lda (ZPTmpPtr1),y
beq .3
2020-04-07 06:01:38 +00:00
cmp #C.SPACE
2018-12-06 16:39:53 +00:00
bne .2
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
.3 lda L.CFG.Keywords
sta ZPTmpPtr2
lda L.CFG.Keywords+1
sta ZPTmpPtr2+1
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
ldx #0
.4 phy save keyword len
tya
cmp (ZPTmpPtr2)
bne .6
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
.5 lda (ZPTmpPtr2),y
dey
cmp (ZPTmpPtr1),y
bne .6
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
tya
bne .5
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
ply discard keyword len
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
jsr .80
bra .1
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
.6 lda (ZPTmpPtr2)
sec
adc ZPTmpPtr2
sta ZPTmpPtr2
bcc .7
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
inc ZPTmpPtr2+1
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
.7 inx
inx
ply reset keyword len
lda (ZPTmpPtr2)
bne .4
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
bra .1
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
.8 clc
.HS B0 BCS
.9 sec
jmp CFG.Read.Close
2020-04-07 06:01:38 +00:00
2018-12-06 16:39:53 +00:00
.80 jmp (J.CFG.Keywords,x)
*--------------------------------------
CFG.Read.address
2020-04-07 06:01:38 +00:00
ldx #S.IPCFG.IP
2018-12-06 16:39:53 +00:00
bra CFG.Read.IP
CFG.Read.netmask
2020-04-07 06:01:38 +00:00
ldx #S.IPCFG.MASK
2018-12-06 16:39:53 +00:00
bra CFG.Read.IP
CFG.Read.gateway
2020-04-07 06:01:38 +00:00
ldx #S.IPCFG.GW
2018-12-06 16:39:53 +00:00
bra CFG.Read.IP
CFG.Read.nameserver
2020-04-07 06:01:38 +00:00
ldx #S.IPCFG.DNS1
2018-12-06 16:39:53 +00:00
lda IPCFG,x
beq CFG.Read.IP
2020-02-14 16:32:52 +00:00
2020-04-07 06:01:38 +00:00
ldx #S.IPCFG.DNS2
lda IPCFG,x
beq CFG.Read.IP
clc
rts
2020-02-14 16:32:52 +00:00
CFG.Read.IP lda (ZPTmpPtr2)
sec
adc ZPTmpPtr1
tay
lda ZPTmpPtr1+1
adc #0
>PUSHYA
>PUSHW L.CFG.IP.SScanF
ldy #4
2018-12-06 16:39:53 +00:00
.1 txa
clc
adc L.IPCFG
pha
lda L.IPCFG+1
adc #0
2020-04-07 06:01:38 +00:00
>PUSHA @IP[0][1][2][3]
2018-12-06 16:39:53 +00:00
pla
>PUSHA
2020-02-14 16:32:52 +00:00
inx
2018-12-06 16:39:53 +00:00
dey
2020-02-14 16:32:52 +00:00
bne .1
2018-12-06 16:39:53 +00:00
2020-02-14 16:32:52 +00:00
>PUSHBI 8 4 PTRs on stack
2018-12-06 16:39:53 +00:00
>SYSCALL SScanF
rts
CFG.Read.dnsdomain
lda (ZPTmpPtr2)
sec
adc ZPTmpPtr1
sta ZPTmpPtr1
bcc .1
inc ZPTmpPtr1+1
.1 ldy #$ff
.2 iny
lda (ZPTmpPtr1),y
sta IPCFG+S.IPCFG.DOMAIN,y
beq .8
cpy #K.DNS.MAXLEN
bne .2
lda #0
sta IPCFG+S.IPCFG.DOMAIN,y
.8 rts
*--------------------------------------
2019-01-15 16:37:32 +00:00
CFG.Read.HOSTS stz CFG.hBuf2
stz CFG.hBuf3
2018-12-06 16:39:53 +00:00
>LDYA L.HOSTS
jsr CFG.Read.Open
jsr CFG.Read.Result
bcs .9
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPTmpPtr2
stx CFG.hBuf2
>LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPTmpPtr3
stx CFG.hBuf3
.1 jsr CFG.Read.GetS
bcs .8
lda (ZPTmpPtr1)
beq .1 empty line...
cmp #'#
beq .1 comment...
jsr CFG.Read.HOSTS.Scan
bcs .1
cmp #5
bcc .1 less than 5 parameters, ignore
beq .2 no alias
>LDYA ZPTmpPtr3
jsr CFG.DNS.Add
.2 >LDYA ZPTmpPtr2
2019-10-03 06:25:27 +00:00
jsr CFG.DNS.Add
2018-12-06 16:39:53 +00:00
bra .1
.8 clc
.HS B0 BCS
.9 sec
php
pha
lda CFG.hBuf3
beq .90
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2018-12-06 16:39:53 +00:00
.90 lda CFG.hBuf2
beq .91
2020-02-28 07:21:46 +00:00
>SYSCALL FreeMem
2018-12-06 16:39:53 +00:00
.91 jmp CFG.Read.Close2
*--------------------------------------
CFG.Read.HOSTS.Scan
2020-02-14 16:32:52 +00:00
>PUSHW L.CFG.HOST.SScanF
>LDYA ZPTmpPtr1
ldx #0
2018-12-06 16:39:53 +00:00
.2 txa
clc
adc L.CFG.IP
tay
lda L.CFG.IP+1
adc #0
2020-02-14 16:32:52 +00:00
>PUSHYA @IP[].....
2018-12-06 16:39:53 +00:00
2020-02-14 16:32:52 +00:00
inx
cpx #4
bne .2
>PUSHW ZPTmpPtr2
>PUSHW ZPTmpPtr3
2018-12-06 16:39:53 +00:00
>PUSHBI 12 6 PTRs on stack
2020-02-14 16:32:52 +00:00
2018-12-06 16:39:53 +00:00
>SYSCALL SScanF
rts
*--------------------------------------
CFG.DNS.ADD >STYA ZPTmpPtr1
>LDYA L.CFG.IP
>PUSHYA
>PUSHW ZPTmpPtr1
2019-01-05 20:33:08 +00:00
>LIBCALL hLIBTCPIP,LIBTCPIP.DNS.Add
2018-12-06 16:39:53 +00:00
*--------------------------------------
CFG.Read.Result bcc .1
2020-02-14 07:21:56 +00:00
pha
>PUSHW L.MSG.CFG.KO
pla
2018-12-06 16:39:53 +00:00
>PUSHA
>PUSHBI 1
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2018-12-06 16:39:53 +00:00
sec
rts
2020-02-14 07:21:56 +00:00
2018-12-06 16:39:53 +00:00
.1 >LDYA L.MSG.CFG.OK
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2018-12-06 16:39:53 +00:00
rts
*--------------------------------------
CFG.Read.Open stz CFG.hCfgFile
2020-02-14 07:21:56 +00:00
>PUSHYA
2018-12-06 16:39:53 +00:00
>PUSHBI O.RDONLY
2020-02-14 07:21:56 +00:00
>PUSHBI S.FI.T.TXT
>PUSHWZ
2020-03-09 16:24:08 +00:00
>SYSCALL FOpen
2018-12-06 16:39:53 +00:00
bcs .9
sta CFG.hCfgFile
2019-10-03 06:25:27 +00:00
* clc
2020-02-14 07:21:56 +00:00
.9 rts
*--------------------------------------
2018-12-06 16:39:53 +00:00
CFG.Read.Close php
pha
2019-10-03 06:25:27 +00:00
CFG.Read.Close2 lda CFG.hCfgFile
2018-12-06 16:39:53 +00:00
beq .8
2020-02-28 07:21:46 +00:00
>SYSCALL FClose
2018-12-06 16:39:53 +00:00
.8 pla
plp
rts
*--------------------------------------
CFG.Read.GetS >PUSHWI 255
>PUSHW ZPTmpPtr1
lda CFG.hCfgFile
>SYSCALL fgets
2019-01-15 16:37:32 +00:00
rts
2018-12-06 16:39:53 +00:00
*--------------------------------------
MAN
SAVE USR/SRC/SBIN/IPCONFIG.S.ETC
LOAD USR/SRC/SBIN/IPCONFIG.S
ASM