mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-09 10:31:45 +00:00
188 lines
4.1 KiB
Plaintext
188 lines
4.1 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BOOT/BIN/NETINFO
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/LIBSTR.I
|
||
.INB INC/LIBTCPIP.I
|
||
*--------------------------------------
|
||
ZPIPCfgPtr .EQ ZPBIN
|
||
ZPDevInfoPtr .EQ ZPBIN+2
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.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 Data Segment to Allocate
|
||
.DA 0
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Relocation Table
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.LIBSTR .DA LIBSTR
|
||
L.LIBTCPIP .DA LIBTCPIP
|
||
L.MSG0 .DA MSG0
|
||
L.MSG0.C .DA MSG0.C
|
||
L.MSG0.U .DA MSG0.U
|
||
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
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.LIBSTR
|
||
>SYSCALL SYS.LoadLibYA
|
||
sta hLIBSTR
|
||
|
||
>LDYA L.LIBTCPIP
|
||
>SYSCALL SYS.LoadLibYA
|
||
sta hLIBTCPIP
|
||
|
||
>PUSHW L.MSG0
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
>LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG
|
||
>STYA ZPIPCfgPtr
|
||
|
||
lda (ZPIPCfgPtr)
|
||
and #S.IPCFG.STATUS.OK
|
||
beq .11
|
||
>LDYA L.MSG0.C
|
||
bra .10
|
||
.11 >LDYA L.MSG0.U
|
||
|
||
.10 >PUSHYA
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
CS.INIT.PRINT ldy #S.IPCFG.MAC+6
|
||
.1 dey
|
||
>PUSHB (ZPIPCfgPtr),y
|
||
cpy #S.IPCFG.MAC
|
||
bne .1
|
||
|
||
ldy #S.IPCFG.hDEV
|
||
lda (ZPIPCfgPtr),y
|
||
>SYSCALL SYS.GetDevInfoA
|
||
>STYA ZPDevInfoPtr
|
||
ldy #S.DEVINFO.NET.STATUS
|
||
>PUSHB (ZPDevInfoPtr),y
|
||
|
||
ldy #S.IPCFG.hDEV
|
||
>PUSHB (ZPIPCfgPtr),y
|
||
|
||
>PUSHW L.MSG1.DEV
|
||
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
ldy #S.IPCFG.DHCPSRVR+3
|
||
ldx #4
|
||
.2 >PUSHB (ZPIPCfgPtr),y
|
||
dey
|
||
dex
|
||
bne .2
|
||
>PUSHW L.MSG1.DHCPSRVR
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
ldy #S.IPCFG.IP+7 IP/MASK
|
||
ldx #8
|
||
.3 >PUSHB (ZPIPCfgPtr),y
|
||
dey
|
||
dex
|
||
bne .3
|
||
>PUSHW L.MSG1.IP
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
ldy #S.IPCFG.GW+3
|
||
ldx #4
|
||
.4 >PUSHB (ZPIPCfgPtr),y
|
||
dey
|
||
dex
|
||
bne .4
|
||
>PUSHW L.MSG1.GW
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
ldy #S.IPCFG.DNS1+7
|
||
ldx #8
|
||
.5 >PUSHB (ZPIPCfgPtr),y
|
||
dey
|
||
dex
|
||
bne .5
|
||
>PUSHW L.MSG1.DNS
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
lda ZPIPCfgPtr
|
||
clc
|
||
adc #S.IPCFG.HOSTNAME
|
||
tay
|
||
lda ZPIPCfgPtr+1
|
||
adc #0
|
||
>PUSHYA
|
||
>PUSHW L.MSG1.HOSTNAME
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
ldy #S.IPCFG.DOMAIN
|
||
lda (ZPIPCfgPtr),y
|
||
beq CS.INIT.DONE
|
||
|
||
lda ZPIPCfgPtr
|
||
clc
|
||
adc #S.IPCFG.DOMAIN
|
||
tay
|
||
lda ZPIPCfgPtr+1
|
||
adc #0
|
||
>PUSHYA
|
||
>PUSHW L.MSG1.DOMAIN
|
||
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
||
|
||
CS.INIT.DONE lda #0 tell TSKMGR that all done ok, but
|
||
sec we do not want to stay in memory
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN
|
||
CS.DOEVENT clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hLIBTCPIP
|
||
>SYSCALL SYS.FreeMemA
|
||
lda hLIBSTR
|
||
>SYSCALL SYS.FreeMemA
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
LIBSTR >PSTRING "libstr.o"
|
||
LIBTCPIP >PSTRING "libtcpip.o"
|
||
MSG0 >CSTRING "TCP/IP Status: "
|
||
MSG0.C >CSTRING "Configured.\n"
|
||
MSG0.U >CSTRING "Not Configured.\n"
|
||
MSG1.DEV >CSTRING " DeviceID : %h,%b,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\n"
|
||
hLIBSTR .BS 1
|
||
hLIBTCPIP .BS 1
|
||
MAN
|
||
SAVE BIN/NETINFO.S
|
||
ASM
|