A2osX/BIN/NETCFG.S.txt
2015-03-15 23:00:40 +01:00

207 lines
4.5 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.

PR#3
PREFIX /A2OSX.BUILD
NEW
INC 1
AUTO 6
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/NETCFG
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/KERNEL.I
.INB INC/LIBSTR.I
.INB INC/LIBTCPIP.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
ZPPTR2 .EQ ZPBIN+2
*--------------------------------------
* Main entry point
*--------------------------------------
* Code signature and INIT table
*--------------------------------------
* CLD $D8
* JMP (*,x) $7C
* #JMPTABLE
* /JMPTABLE
*--------------------------------------
CS.START cld
jmp (.1,x)
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.LIBSTR .DA LIBSTR
L.MSG0 .DA MSG0
L.MSG0.0 .DA MSG0.0
L.MSG0.1 .DA MSG0.1
L.MSG0.2 .DA MSG0.2
L.MSG0.N .DA MSG0.N
L.MSG0.U .DA MSG0.U
L.MSG0.C .DA MSG0.C
L.MSG1.DEV .DA MSG1.DEV
L.MSG1.DHCPSRVR .DA MSG1.DHCPSRVR
L.MSG1.IP .DA MSG1.IP
L.MSG1.GW .DA MSG1.GW
L.MSG1.DNS .DA MSG1.DNS
L.MSG1.HOSTNAME .DA MSG1.HOSTNAME
L.MSG1.DOMAIN .DA MSG1.DOMAIN
L.MSG1.END .DA MSG1.END
.DA 0
.DA CS.END-CS.START Code Length To Relocate
.DA DS.END-DS.START Data Segemnt to Allocate
*--------------------------------------
CS.INIT >LIBLOADP L.LIBSTR
sta hLIBSTR
lda #K.PROTOID.IP
>SYSCALL SYS.GetNetCfgA
bcc CS.INIT.LOADED
>PUSHW L.MSG0.N
>PUSHW L.MSG0.2
>PUSHW L.MSG0
>LIBCALL hLIBSTR,LIBSTR.PRINTF
jmp CS.INIT.END
CS.INIT.LOADED >STYA ZPPTR1
ldy #S.IPCFG.STATUS
lda (ZPPTR1),y
bmi CS.INIT.CONFOK
>PUSHW L.MSG0.U
>PUSHW L.MSG0.2
>PUSHW L.MSG0
>LIBCALL hLIBSTR,LIBSTR.PRINTF
jsr CS.INIT.DEV.MAC
jmp CS.INIT.END
CS.INIT.CONFOK >PUSHW L.MSG0.C
>PUSHW L.MSG0.2
>PUSHW L.MSG0
>LIBCALL hLIBSTR,LIBSTR.PRINTF
jsr CS.INIT.DEV.MAC
ldy #S.IPCFG.DHCPSRVR+3
ldx #4
L1 >PUSHB (ZPPTR1),y
dey
dex
bne L1
>PUSHW L.MSG1.DHCPSRVR
>LIBCALL hLIBSTR,LIBSTR.PRINTF
ldy #S.IPCFG.IP+7 IP/MASK
ldx #8
L2 >PUSHB (ZPPTR1),y
dey
dex
bne L2
>PUSHW L.MSG1.IP
>LIBCALL hLIBSTR,LIBSTR.PRINTF
ldy #S.IPCFG.GW+3
ldx #4
L4 >PUSHB (ZPPTR1),y
dey
dex
bne L4
>PUSHW L.MSG1.GW
>LIBCALL hLIBSTR,LIBSTR.PRINTF
ldy #S.IPCFG.DNS+7
ldx #8
L5 >PUSHB (ZPPTR1),y
dey
dex
bne L5
>PUSHW L.MSG1.DNS
>LIBCALL hLIBSTR,LIBSTR.PRINTF
lda ZPPTR1
clc
adc #S.IPCFG.HOSTNAME
tay
lda ZPPTR1+1
adc #0
>PUSHYA
>PUSHW L.MSG1.HOSTNAME
>LIBCALL hLIBSTR,LIBSTR.PRINTF
ldy #S.IPCFG.DOMAIN
lda (ZPPTR1),y
beq L6
lda ZPPTR1
clc
adc #S.IPCFG.DOMAIN
tay
lda ZPPTR1+1
adc #0
>PUSHYA
>PUSHW L.MSG1.DOMAIN
>LIBCALL hLIBSTR,LIBSTR.PRINTF
L6 >PUSHW L.MSG1.END
>LIBCALL hLIBSTR,LIBSTR.PRINTF
CS.INIT.END lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
rts
*--------------------------------------
CS.INIT.DEV.MAC ldy #S.IPCFG.MAC+6
.1 dey
>PUSHB (ZPPTR1),y
cpy #S.IPCFG.MAC
bne .1
ldy #S.IPCFG.hDEV
>PUSHB (ZPPTR1),y
>PUSHW L.MSG1.DEV
>LIBCALL hLIBSTR,LIBSTR.PRINTF
rts
*--------------------------------------
CS.RUN clc
rts
*--------------------------------------
CS.DOEVENT clc
rts
*--------------------------------------
CS.QUIT lda hLIBSTR
>SYSCALL SYS.FreeMemA
clc
rts
*--------------------------------------
CS.END
LIBSTR >PSTRING "libstr.o"
MSG0 >CSTRING "Protocol:%s (%s)\n"
MSG0.0 >CSTRING "AppleTalk"
MSG0.1 >CSTRING "EtherTalk"
MSG0.2 >CSTRING "TCP/IP"
MSG0.N >CSTRING "Not Loaded"
MSG0.U >CSTRING "Unconfigured"
MSG0.C >CSTRING "Configured"
MSG1.DEV >CSTRING " DeviceID : %h,MAC=%02h:%02h:%02h:%02h:%02h:%02h\n"
MSG1.DHCPSRVR >CSTRING " DHCP Server : %d.%d.%d.%d\n"
MSG1.IP >CSTRING " IP/Mask : %d.%d.%d.%d/%d.%d.%d.%d\n"
MSG1.GW >CSTRING " Gateway : %d.%d.%d.%d\n"
MSG1.DNS >CSTRING " DNS : %d.%d.%d.%d,%d.%d.%d.%d\n"
MSG1.HOSTNAME >CSTRING " Hostname : %s"
MSG1.DOMAIN >CSTRING ".%s"
MSG1.END >CSTRING "\nEnd of network configuration.\n"
*--------------------------------------
DS.START
*--------------------------------------
hLIBSTR .BS 1
*--------------------------------------
DS.END
MAN
SAVE BIN/NETCFG.S
ASM