mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 22:54:59 +00:00
203 lines
4.4 KiB
Plaintext
203 lines
4.4 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
|
||
*--------------------------------------
|
||
ZPPTR1 .EQ ZPBIN
|
||
ZPPTR2 .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.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
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.LIBSTR
|
||
>SYSCALL SYS.LoadLibYA
|
||
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"
|
||
hLIBSTR .BS 1
|
||
MAN
|
||
SAVE BIN/NETINFO.S
|
||
ASM
|