A2osX/BIN/NETCONFIG.S.txt
2024-01-14 21:23:46 +00:00

911 lines
20 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF bin/netconfig
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
.INB inc/mli.e.i
.INB inc/libtui.i
*--------------------------------------
* Constants
*--------------------------------------
EV.SAVE .EQ $C0
EV.OK .EQ $CE
EV.CANCEL .EQ $CF
SCR.X1 .EQ 3
SCR.X2 .EQ 27
SCR.X3 .EQ 51
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
hFile .BS 1
hBuf1 .BS 1
hCTX .BS 1
hSCRN .BS 1
hItem1 .BS 1
hDLGS .BS 1
hDLGitem .BS 1
ZPPtr1 .BS 2
ZPTmpPtr1 .BS 2
ZPTmpPtr2 .BS 2
ZPTmpPtr3 .BS 2
ZPTmpPtr4 .BS 2
ZPBufPtr .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #0 S.PS.F
.DA #0
.DA CS.END-CS.START Code Length To Relocate
.DA DS.END-DS.START Data Segment to Allocate
.DA #16 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.LIBTUI .DA LIBTUI
*--------------------------------------
L.NETSTART .DA NETSTART
L.HOSTNAME .DA HOSTNAME
L.TCPIP.CONF .DA TCPIP.CONF
L.SCRN.Title .DA SCRN.Title
L.SCRN.Status .DA SCRN.Status
L.SCRN.StatusSv .DA SCRN.StatusSv
L.HOST.Label .DA HOST.Label
L.HOST.Text .DA HOST.Text
L.IFACE.Label .DA IFACE.Label
L.IFACE.List .DA IFACE.List
L.AUTOIP.Label .DA AUTOIP.Label
L.AUTOIP.List .DA AUTOIP.List
L.SERV.Label .DA SERV.Label
L.TELNET.Label .DA TELNET.Label
L.HTTPD.Label .DA HTTPD.Label
L.BBSD.Label .DA BBSD.Label
L.MANUAL.Label .DA MANUAL.Label
L.IPADDR.Label .DA IPADDR.Label
L.IPADDR.Text .DA IPADDR.Text
L.MASK.Label .DA MASK.Label
L.MASK.Text .DA MASK.Text
L.GATEWAY.Label .DA GATEWAY.Label
L.GATEWAY.Text .DA GATEWAY.Text
L.NS1.Label .DA NS1.Label
L.NS1.Text .DA NS1.Text
L.NS2.Label .DA NS2.Label
L.NS2.Text .DA NS2.Text
L.DOM.Label .DA DOM.Label
L.DOM.Text .DA DOM.Text
L.BUTQ.Label .DA BUTQ.Label
L.BUTS.Label .DA BUTS.Label
L.DLGS.Title .DA DLGS.Title
L.DLGS.Text .DA DLGS.Text
L.DLGS.Label .DA DLGS.Label
L.BUT.OK .DA BUT.OK
L.BUT.Cancel .DA BUT.Cancel
L.NS.Hdr .DA NS.Hdr
L.NS.Uth .DA NS.Uth
L.NS.Lanc .DA NS.Lanc
L.NS.U2 .DA NS.U2
L.NS.U2ai .DA NS.U2ai
L.NS.networkd .DA NS.networkd
L.NS.telnetd .DA NS.telnetd
L.NS.httpd .DA NS.httpd
L.NS.bbsd .DA NS.bbsd
L.IP.Hash .DA IP.Hash
L.Host.Hdr .DA Host.Hdr
L.CRLF .DA CRLF
L.IP.Keywords .DA IP.Keywords
J.IP.Keywords .DA CS.IPR.addr
.DA CS.IPR.mask
.DA CS.IPR.gway
.DA CS.IPR.ns1
.DA CS.IPR.dom
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBTUI
>SYSCALL LoadLib
bcs CS.INIT.RTS
sta hLIBTUI
* clc
CS.INIT.RTS rts
*--------------------------------------
CS.RUN >LDYA 80
>SYSCALL GetMem
* bcs CS.RUN.RTS
>STYA ZPTmpPtr1
stx hBuf1
jsr CS.HOSTR
jsr CS.IPR
jsr CS.File.Close CS.IPR doesn't close the file
* rts debug; stop before displaying TUI
>LIBCALL hLIBTUI,LIBTUI.Init
bcs CS.RUN.RTS
sta hCTX
jsr CS.SCRN.Init
bcs CS.RUN.RTS
jsr CS.HOSTR.Init
bcs CS.RUN.RTS
jsr CS.IFACE.Init
bcs CS.RUN.RTS
jsr CS.AUTOIP.Init
bcs CS.RUN.RTS
jsr CS.SERV.Init
bcs CS.RUN.RTS
jsr CS.IP.Init
bcs CS.RUN.RTS
jsr CS.BUT.Init
bcs CS.RUN.RTS
jsr CS.SCRN.Draw Will Call SCRN.Draw
lda hItem1
>LIBCALL hLIBTUI,LIBTUI.Activate
*--------------------------------------
CS.RUN.LOOP2 lda hSCRN
>LIBCALL hLIBTUI,LIBTUI.Exec
bcs CS.RUN.RTS
cmp #EV.RESIZE
bne .1
jsr CS.SCRN.Draw
bcs CS.RUN.RTS
bra CS.RUN.LOOP2
.1 cmp #EV.SAVE
bne .2
jsr CS.DLG.SAVE
bcc CS.RUN.LOOP2
.2 cmp #EV.QUIT
bne CS.RUN.LOOP2
CS.RUN.QUIT lda hSCRN
>LIBCALL hLIBTUI,LIBTUI.Destroy
lda hBuf1
>SYSCALL FreeMem
lda hLIBTUI
>SYSCALL UnloadLib
lda #0
sec
CS.RUN.RTS rts
*--------------------------------------
CS.HOSTR >LDYA L.HOSTNAME etc/hostname
JSR CS.File.OpenRD
bcc CS.HOSTR.Loop
rts
CS.HOSTR.Loop jsr CS.File.Read
bcs .1
lda (ZPTmpPtr1)
cmp #'#'
beq CS.HOSTR.Loop
.1 >LDYA L.HOST.Text
>STYA ZPTmpPtr4
ldy #0 Copy setting to var string
CS.HOSTR.Loop2 lda (ZPTmpPtr1),y
beq .2
sta (ZPTmpPtr4),y
iny
cpy #$10
bcc CS.HOSTR.Loop2
.2 lda #0
sta (ZPTmpPtr4),y
clc
jmp CS.File.Close
*--------------------------------------
CS.IPR >LDYA L.TCPIP.CONF etc/tcpip.conf
JSR CS.File.OpenRD
bcc CS.IPR.Loop
rts
CS.IPR.Loop jsr CS.File.Read *was READIP
bcs .8
.1 ldy #$ff
.2 iny
.21 lda (ZPTmpPtr1),y
cmp #C.SPACE
beq .3
cmp #'#'
bne .2
lda #1
>STA.G AUTOIP.Var Preselect Manual IP radio
inc ZPTmpPtr1
bcc .21
inc ZPTmpPtr2+1
bra .21
.3 lda L.IP.Keywords Whole word, check
sta ZPTmpPtr2
lda L.IP.Keywords+1
sta ZPTmpPtr2+1
ldx #0
.4 phy save keyword len
tya
cmp (ZPTmpPtr2)
bne .6 empty
.5 lda (ZPTmpPtr2),y check next char
dey
cmp (ZPTmpPtr1),y
bne .6 no match
tya
bne .5
ply discard keyword len
jsr CS.IPR.Keyword keyword matched - action it
bcc CS.IPR.Loop
rts
.6 lda (ZPTmpPtr2)
sec
adc ZPTmpPtr2
sta ZPTmpPtr2
bcc .7
inc ZPTmpPtr2+1
.7 inx
inx
ply reset keyword len
lda (ZPTmpPtr2)
bne .4
bra CS.IPR.Loop
.8 clc
jmp CS.File.Close
CS.IPR.Keyword lda ZPTmpPtr1+1 Move ptr to after keyword+space
sta ZPTmpPtr3+1
iny
clc
tya
adc ZPTmpPtr1
sta ZPTmpPtr3
bcc .81
inc ZPTmpPtr3+1
.81 jmp (J.IP.Keywords,x)
CS.IPR.addr >LDYA L.IPADDR.Text
>STYA ZPTmpPtr4
CS.IPR.Copy ldy #0 Copy setting to correct var
CS.IPR.Copy.L lda (ZPTmpPtr3),y
beq .9
sta (ZPTmpPtr4),y
iny
cpy #$10
bcc CS.IPR.Copy.L
.9 lda #0
sta (ZPTmpPtr4),y
clc
rts
CS.IPR.mask >LDYA L.MASK.Text
>STYA ZPTmpPtr4
jmp CS.IPR.Copy
CS.IPR.gway >LDYA L.GATEWAY.Text
>STYA ZPTmpPtr4
jmp CS.IPR.Copy
CS.IPR.ns1 >LDYA L.NS1.Text
>STYA ZPTmpPtr4
lda (ZPTmpPtr4)
bne CS.IPR.ns2 NS1 already populated
jmp CS.IPR.Copy
CS.IPR.ns2 >LDYA L.NS2.Text
>STYA ZPTmpPtr4
jmp CS.IPR.Copy
CS.IPR.dom >LDYA L.DOM.Text
>STYA ZPTmpPtr4
jsr CS.IPR.Copy
sec last one so sec
rts
*--------------------------------------
CS.File.OpenRD stz hFile
>PUSHYA
>PUSHBI O.RDONLY
>PUSHBI 0 Type
>PUSHWZ Aux type
>SYSCALL FOpen
bcs .9
sta hFile
.9 rts
*--------------------------------------
CS.File.Read >PUSHB hFile
>PUSHW ZPTmpPtr1
>PUSHWI 80
>SYSCALL FGetS
bcs .9
lda (ZPTmpPtr1)
beq CS.File.Read
clc
.9 rts
*--------------------------------------
CS.File.OpenWR >PUSHYA
>PUSHBI O.CREATE+O.WRONLY+O.TRUNC
>PUSHBI $04 Type Text
>PUSHWZ Aux type
>SYSCALL FOpen
bcs .9
sta hFile
.9 rts
*--------------------------------------
CS.File.Write >PUSHB hFile
>PUSHW ZPTmpPtr1
>SYSCALL FPutS
rts
*--------------------------------------
CS.File.Close php
pha
lda hFile
beq .8
>SYSCALL FClose
.8 pla
plp
rts
*--------------------------------------
CS.SCRN.Init >PUSHB hCTX hParent
>PUSHBI S.OBJ.F.bTitle+S.OBJ.F.bStatus
>LIBCALL hLIBTUI,LIBTUI.NewScrn
bcs .9
sta hSCRN
>PUSHA
>PUSHBI S.OBJ.pTITLE
>PUSHEA.G SCRN.TitleBuf
>LIBCALL hLIBTUI,LIBTUI.SetProp
>PUSHB hSCRN
>PUSHBI S.OBJ.pSTATUS
>PUSHW L.SCRN.Status
>LIBCALL hLIBTUI,LIBTUI.SetProp
.9 rts
*--------------------------------------
CS.HOSTR.Init >PUSHB hSCRN hParent
>PUSHBI SCR.X1
>PUSHBI 2 Y1
>PUSHW L.HOST.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
bcs .9
>PUSHB hSCRN hParent
>PUSHBI SCR.X1+9 X1
>PUSHBI 2 Y1
>PUSHBI 18 W
>PUSHW L.HOST.Text
>PUSHWI 15 Len
>LIBCALL hLIBTUI,LIBTUI.NewTLine
sta hItem1
.9 rts
*--------------------------------------
CS.IFACE.Init >PUSHB hSCRN hParent
>PUSHBI SCR.X1
>PUSHBI 4 Y1
>PUSHW L.IFACE.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
bcs .9
* lda #2
* >STA.G IFACE.Var
>PUSHB hSCRN hParent
>PUSHBI SCR.X1
>PUSHBI 5 Y1
>PUSHBI 0 HK
>PUSHBI 0 EV
>PUSHW L.IFACE.List
>PUSHEA.G IFACE.Var
>LIBCALL hLIBTUI,LIBTUI.NewRadio
.9 rts
*--------------------------------------
CS.AUTOIP.Init >PUSHB hSCRN hParent
>PUSHBI SCR.X2
>PUSHBI 4 Y1
>PUSHW L.AUTOIP.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
bcs .9
>PUSHB hSCRN hParent
>PUSHBI SCR.X2
>PUSHBI 5 Y1
>PUSHBI 0 HK
>PUSHBI 0 EV
>PUSHW L.AUTOIP.List
>PUSHEA.G AUTOIP.Var
>LIBCALL hLIBTUI,LIBTUI.NewRadio
.9 rts
CS.SERV.Init >PUSHB hSCRN hParent
>PUSHBI SCR.X3
>PUSHBI 4 Y1
>PUSHW L.SERV.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
bcc .1
rts
.1 >PUSHB hSCRN hParent
>PUSHBI SCR.X3
>PUSHBI 5 Y1
>PUSHBI 0
>PUSHBI 0
>PUSHW L.TELNET.Label
>PUSHEA.G TELNET.Var
>LIBCALL hLIBTUI,LIBTUI.NewCBox
bcc .2
rts
.2 >PUSHB hSCRN hParent
>PUSHBI SCR.X3
>PUSHBI 6 Y1
>PUSHBI 0
>PUSHBI 0
>PUSHW L.HTTPD.Label
>PUSHEA.G HTTPD.Var
>LIBCALL hLIBTUI,LIBTUI.NewCBox
bcc .3
rts
.3 >PUSHB hSCRN hParent
>PUSHBI SCR.X3
>PUSHBI 7 Y1
>PUSHBI 0
>PUSHBI 0
>PUSHW L.BBSD.Label
>PUSHEA.G BBSD.Var
>LIBCALL hLIBTUI,LIBTUI.NewCBox
rts
CS.IP.Init >PUSHB hSCRN hParent
>PUSHBI SCR.X1
>PUSHBI 11 Y1
>PUSHW L.MANUAL.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
>PUSHB hSCRN hParent
>PUSHBI SCR.X1
>PUSHBI 13 Y1
>PUSHW L.IPADDR.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
>PUSHB hSCRN hParent
>PUSHBI SCR.X1
>PUSHBI 14 Y1
>PUSHBI 18 W
>PUSHW L.IPADDR.Text
>PUSHWI 15 Len
>LIBCALL hLIBTUI,LIBTUI.NewTLine
>PUSHB hSCRN hParent
>PUSHBI SCR.X2
>PUSHBI 13 Y1
>PUSHW L.MASK.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
>PUSHB hSCRN hParent
>PUSHBI SCR.X2
>PUSHBI 14 Y1
>PUSHBI 18 W
>PUSHW L.MASK.Text
>PUSHWI 15 Len
>LIBCALL hLIBTUI,LIBTUI.NewTLine
>PUSHB hSCRN hParent
>PUSHBI SCR.X3
>PUSHBI 13 Y1
>PUSHW L.GATEWAY.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
>PUSHB hSCRN hParent
>PUSHBI SCR.X3
>PUSHBI 14 Y1
>PUSHBI 18 W
>PUSHW L.GATEWAY.Text
>PUSHWI 15 Len
>LIBCALL hLIBTUI,LIBTUI.NewTLine
>PUSHB hSCRN hParent
>PUSHBI SCR.X1
>PUSHBI 16 Y1
>PUSHW L.NS1.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
>PUSHB hSCRN hParent
>PUSHBI SCR.X1
>PUSHBI 17 Y1
>PUSHBI 18 W
>PUSHW L.NS1.Text
>PUSHWI 15 Len
>LIBCALL hLIBTUI,LIBTUI.NewTLine
>PUSHB hSCRN hParent
>PUSHBI SCR.X2
>PUSHBI 16 Y1
>PUSHW L.NS2.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
>PUSHB hSCRN hParent
>PUSHBI SCR.X2
>PUSHBI 17 Y1
>PUSHBI 18 W
>PUSHW L.NS2.Text
>PUSHWI 15 Len
>LIBCALL hLIBTUI,LIBTUI.NewTLine
>PUSHB hSCRN hParent
>PUSHBI SCR.X3
>PUSHBI 16 Y1
>PUSHW L.DOM.Label
>LIBCALL hLIBTUI,LIBTUI.NewLabel
>PUSHB hSCRN hParent
>PUSHBI SCR.X3
>PUSHBI 17 Y1
>PUSHBI 25 W
>PUSHW L.DOM.Text
>PUSHWI 65 Len
>LIBCALL hLIBTUI,LIBTUI.NewTLine
rts
*--------------------------------------
CS.BUT.Init >PUSHB hSCRN hParent
>PUSHBI 50 X1
>PUSHBI 20 Y1
>PUSHBI 19 Ctrl-S
>PUSHBI EV.SAVE
>PUSHW L.BUTS.Label
>LIBCALL hLIBTUI,LIBTUI.NewBut
bcs .9
>PUSHB hSCRN hParent
>PUSHBI 65 X1
>PUSHBI 20 Y1
>PUSHBI 17 Ctrl-Q
>PUSHBI EV.QUIT
>PUSHW L.BUTQ.Label
>LIBCALL hLIBTUI,LIBTUI.NewBut
.9 rts
*--------------------------------------
CS.DLG.SAVE >PUSHB hCTX hParent
>PUSHBI 70 W
>PUSHBI 11 H
>PUSHW L.DLGS.Title
>LIBCALL hLIBTUI,LIBTUI.NewDlg
bcs .9
sta hDLGS
>PUSHB hDLGS hParent
>PUSHBI 2 X1
>PUSHBI 2 Y1
>PUSHW L.DLGS.Text
>LIBCALL hLIBTUI,LIBTUI.NewLabel
bcs .9
>PUSHB hDLGS hParent
>PUSHBI 2
>PUSHBI 4 Y1
>PUSHBI 0
>PUSHBI 0
>PUSHW L.DLGS.Label
>PUSHEA.G DLGS.Var
>LIBCALL hLIBTUI,LIBTUI.NewCBox
bcc CS.DLG.SAVE2
.9 rts
CS.DLG.SAVE2 sta hDLGitem
>PUSHB hDLGS hParent
>PUSHBI 48 X1
>PUSHBI 7 Y1
>PUSHBI C.CR Hotkey ENTER
>PUSHBI EV.OK
>PUSHW L.BUT.OK
>LIBCALL hLIBTUI,LIBTUI.NewBut
bcs .8
>PUSHB hDLGS hParent
>PUSHBI 57 X1
>PUSHBI 7 Y1
>PUSHBI 3 Hotkey Ctrl-C
>PUSHBI EV.CANCEL
>PUSHW L.BUT.Cancel
>LIBCALL hLIBTUI,LIBTUI.NewBut
bcs .8
lda hDLGS
>LIBCALL hLIBTUI,LIBTUI.Draw
bcc .9
.8 rts
.9 lda hDLGitem
>LIBCALL hLIBTUI,LIBTUI.Activate
CS.DLG.Loop lda hDLGS
>LIBCALL hLIBTUI,LIBTUI.Exec
cmp #EV.OK
bne .1
>PUSHB hSCRN
>PUSHBI S.OBJ.pSTATUS
>PUSHW L.SCRN.StatusSv
>LIBCALL hLIBTUI,LIBTUI.SetProp
jsr CS.IPW
jsr CS.HOSTW
>LDA.G DLGS.Var
* cmp #0
beq .1
jsr CS.SHW
bra .2
.1 cmp #EV.CANCEL
bne CS.DLG.Loop
.2 php
pha
lda hDLGS
>LIBCALL hLIBTUI,LIBTUI.Destroy
lda hSCRN
>LIBCALL hLIBTUI,LIBTUI.Draw
pla
plp
.9 rts
*--------------------------------------
CS.HOSTW >LDYA L.HOSTNAME
jsr CS.File.OpenWR
bcc .1
rts
.1 >PUSHB hFile
>PUSHW L.HOST.Hdr
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.HOST.Text
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.CRLF
>SYSCALL FPutS
jmp CS.File.Close
*--------------------------------------
CS.IPW >LDYA L.TCPIP.CONF
jsr CS.File.OpenWR
bcc .1
rts
.1 >LDA.G AUTOIP.Var
bne CS.IPW.addr
>PUSHB hFile
>PUSHW L.IP.Hash
>SYSCALL FPutS
CS.IPW.addr >PUSHB hFile
>PUSHW L.IPADDR.Label
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.IPADDR.Text
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.CRLF
>SYSCALL FPutS
>LDA.G AUTOIP.Var
bne CS.IPW.mask
>PUSHB hFile
>PUSHW L.IP.Hash
>SYSCALL FPutS
CS.IPW.mask >PUSHB hFile
>PUSHW L.MASK.Label
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.MASK.Text
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.CRLF
>SYSCALL FPutS
>LDA.G AUTOIP.Var
bne CS.IPW.gway
>PUSHB hFile
>PUSHW L.IP.Hash
>SYSCALL FPutS
CS.IPW.gway >PUSHB hFile
>PUSHW L.GATEWAY.Label
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.GATEWAY.Text
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.CRLF
>SYSCALL FPutS
>LDA.G AUTOIP.Var
bne CS.IPW.ns1
>PUSHB hFile
>PUSHW L.IP.Hash
>SYSCALL FPutS
CS.IPW.ns1 >PUSHB hFile
>PUSHW L.NS1.Label
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.NS1.Text
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.CRLF
>SYSCALL FPutS
>LDA.G AUTOIP.Var
bne CS.IPW.ns2
>PUSHB hFile
>PUSHW L.IP.Hash
>SYSCALL FPutS
CS.IPW.ns2 >PUSHB hFile
>PUSHW L.NS1.Label Must use NS1 label again
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.NS2.Text
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.CRLF
>SYSCALL FPutS
>LDA.G AUTOIP.Var
bne CS.IPW.dom
>PUSHB hFile
>PUSHW L.IP.Hash
>SYSCALL FPutS
CS.IPW.dom >PUSHB hFile
>PUSHW L.DOM.Label
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.DOM.Text
>SYSCALL FPutS
>PUSHB hFile
>PUSHW L.CRLF
>SYSCALL FPutS
jmp CS.File.Close
*--------------------------------------
CS.SHW >LDYA L.Netstart Write network startup shell script
jsr CS.File.OpenWR
bcc .0
rts
.0 >PUSHB hFile
>PUSHW L.NS.Hdr
>SYSCALL FPutS
>LDA.G IFACE.var
cmp #0
bne .1
>PUSHB hFile
>PUSHW L.NS.Uth
>SYSCALL FPutS
bra .2
.1 cmp #1
bne .3
>PUSHB hFile
>PUSHW L.NS.Lanc
>SYSCALL FPutS
.2 bra CS.SHW.netd
.3 cmp #2
bne .4
>PUSHB hFile
>PUSHW L.NS.U2
>SYSCALL FPutS
bra CS.SHW.netd
.4 cmp #3
bne CS.SHW.netd
>PUSHB hFile
>PUSHW L.NS.U2ai
>SYSCALL FPutS
CS.SHW.netd >PUSHB hFile
>PUSHW L.NS.networkd
>SYSCALL FPutS
>LDA.G TELNET.Var
bpl CS.SHW.httpd
>PUSHB hFile
>PUSHW L.NS.telnetd
>SYSCALL FPutS
CS.SHW.httpd >LDA.G HTTPD.Var
bpl CS.SHW.bbsd
>PUSHB hFile
>PUSHW L.NS.httpd
>SYSCALL FPutS
CS.SHW.bbsd >LDA.G BBSD.Var
bpl CS.SHW.close
>PUSHB hFile
>PUSHW L.NS.bbsd
>SYSCALL FPutS
CS.SHW.close jmp CS.File.Close
.9 rts
*--------------------------------------
CS.DOEVENT sec do not discard TIMER event
rts
*--------------------------------------
CS.QUIT >LDA.G hBuf1
beq .1
>SYSCALL FreeMem
.1 lda hCTX
beq .2
>LIBCALL hLIBTUI,LIBTUI.Close
.2 lda hLIBTUI
beq .8
>SYSCALL UnloadLib
.8 clc
rts
*--------------------------------------
CS.SCRN.Draw lda hSCRN
>SYSCALL GetMemPtr
>STYA ZPPtr1
>PUSHEA.G SCRN.TitleBuf
>PUSHW L.SCRN.Title
ldy #S.OBJ.X1
.1 lda (ZPPtr1),y
>PUSHA
iny
cpy #S.OBJ.InnerH+1
bne .1
>PUSHBI 10
>SYSCALL sprintf
lda hSCRN
>LIBCALL hLIBTUI,LIBTUI.Draw
rts
*--------------------------------------
CS.END
*--------------------------------------
LIBTUI .AZ "libtui"
hLIBTUI .BS 1
*--------------------------------------
NETSTART .AZ "${HOME}netstart"
HOSTNAME .AZ "${ROOT}etc/hostname"
TCPIP.CONF .AZ "${ROOT}etc/tcpip.conf"
*--------------------------------------
IP.Keywords .PS "address"
.PS "netmask"
.PS "gateway"
.PS "nameserver"
.PS "dnsdomain"
.DA #0
*--------------------------------------
SCRN.Title .AZ " NetConfig"
SCRN.Status .AZ " "
SCRN.StatusSv .AZ " Settings saved successfully"
*--------------------------------------
HOST.Label .AZ "Hostname:"
Host.Text .BS 15
*--------------------------------------
IFACE.Label .AZ "Interface"
IFACE.List .AS "Uthernet"
.DA #C.CR
.AS "LanceGS"
.DA #C.CR
.AS "Uthernet2"
.DA #C.CR
.AS "Uther2.ai"
.DA #0
*--------------------------------------
AUTOIP.Label .AZ "Auto or Manual IP"
AUTOIP.List .AS "Auto/DHCP"
.DA #C.CR
.AZ "Manual/Static"
.DA #0
*--------------------------------------
SERV.Label .AZ "Services"
TELNET.Label .AZ "telnetd"
HTTPD.Label .AZ "httpd"
BBSD.Label .AZ "bbsd"
*--------------------------------------
MANUAL.Label .AZ "MANUAL SETTINGS (Ignored for Auto/DHCP)"
IPADDR.Label .AZ "address "
IPADDR.Text .BS 15
MASK.Label .AZ "netmask "
MASK.Text .BS 16
GATEWAY.Label .AZ "gateway "
GATEWAY.Text .BS 16
NS1.Label .AZ "nameserver "
NS1.Text .BS 16
NS2.Label .AZ "nameserver 2"
NS2.Text .BS 16
DOM.Label .AZ "dnsdomain "
DOM.Text .BS 65
*--------------------------------------
BUTS.Label .AZ "(^S)ave..."
BUTQ.Label .AZ "(^Q)uit"
DLGS.Title .AZ "Save Config"
DLGS.Text .AZ "Save the system config files?"
DLGS.Label .AZ "Create NETSTART script in user home directory"
BUT.OK .AZ " OK "
BUT.Cancel .AZ "Cancel"
*--------------------------------------
CRLF .CZ "\r\n"
NS.Hdr .CZ "#!/bin/sh\r\n"
NS.Uth .CZ "insdrv uthernet.drv 00:0E:3A:12:34:56\r\n"
NS.Lanc .CZ "insdrv lancegs.drv 00:0E:3A:12:34:56\r\n"
NS.U2 .CZ "insdrv uthernet2.drv 00:08:DC:12:34:56\r\n"
NS.U2ai .CZ "insdrv uther2.ai.drv 00:08:DC:12:34:56\r\n"
NS.networkd .CZ "NOHUP networkd libtcpip &\r\n"
NS.telnetd .CZ "NOHUP telnetd 6502 &\r\n"
NS.httpd .CZ "NOHUP httpd &\r\n"
NS.bbsd .CZ "NOHUP bbsd &\r\n"
*NS.debug .AZ "var=%d "
IP.Hash .AZ "#"
HOST.Hdr .CZ "# Put hostname here (max 15 characters)\r\n"
*--------------------------------------
.DUMMY
.OR 0
DS.START
SCRN.TitleBuf .BS 1
IFACE.Var .BS 1
AUTOIP.Var .BS 1
TELNET.Var .BS 1
HTTPD.Var .BS 1
BBSD.Var .BS 1
DLGS.VAR .BS 1
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/netconfig.s
ASM