mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-23 07:35:19 +00:00
297 lines
6.5 KiB
Plaintext
297 lines
6.5 KiB
Plaintext
NEW
|
||
PREFIX /A2OSX.BUILD
|
||
AUTO 4,1
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BUILD/BIN/IPCONFIG
|
||
*--------------------------------------
|
||
.INB /A2OSX.BUILD/INC/MACROS.I
|
||
.INB /A2OSX.BUILD/INC/A2OSX.I
|
||
.INB /A2OSX.BUILD/INC/NIC.I
|
||
.INB /A2OSX.BUILD/INC/LIBTCPIP.I
|
||
*--------------------------------------
|
||
ZPIPCfgPtr .EQ ZPBIN
|
||
ZPDevPtr .EQ ZPBIN+2
|
||
ZPDevStatPtr .EQ ZPBIN+4
|
||
*--------------------------------------
|
||
* 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 CS
|
||
.DA DS.END-DS.START DS
|
||
.DA #16 SS
|
||
.DA #6 ZP
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Relocation Table
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.LIBTCPIP .DA LIBTCPIP
|
||
L.MSG0 .DA MSG0
|
||
L.MSG0.NL .DA MSG0.NL
|
||
L.MSG0.L .DA MSG0.L
|
||
L.MSG1.DEV .DA MSG1.DEV
|
||
L.MSG1.DEV.ARP .DA MSG1.DEV.ARP
|
||
L.MSG1.DEV.IP .DA MSG1.DEV.IP
|
||
L.MSG1.LINK .DA MSG1.LINK
|
||
L.MSG1.LINK.OK .DA MSG1.LINK.OK
|
||
L.MSG1.LINK.KO .DA MSG1.LINK.KO
|
||
L.MSG1.LINKSPEED .DA MSG1.LINKSPEED
|
||
L.MSG1.DPLX.FD .DA MSG1.DPLX.FD
|
||
L.MSG1.DPLX.HD .DA MSG1.DPLX.HD
|
||
L.MSG2 .DA MSG2
|
||
L.MSG2.C .DA MSG2.C
|
||
L.MSG2.U .DA MSG2.U
|
||
L.MSG2.DHCPSRVR .DA MSG2.DHCPSRVR
|
||
L.MSG2.IP .DA MSG2.IP
|
||
L.MSG2.GW .DA MSG2.GW
|
||
L.MSG2.DNS .DA MSG2.DNS
|
||
L.MSG2.HOSTNAME .DA MSG2.HOSTNAME
|
||
L.DevName .DA DevName
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.LIBTCPIP
|
||
>SYSCALL LoadLib.YA
|
||
bcs .9
|
||
sta hLIBTCPIP
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
CS.RUN >LDYA L.MSG0
|
||
>SYSCALL PrintF.YA
|
||
|
||
>LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG
|
||
>STYA ZPIPCfgPtr
|
||
|
||
ldy #S.IPCFG.HDEV
|
||
lda (ZPIPCfgPtr),y
|
||
bne CS.RUN.DUMPDEV
|
||
|
||
>LDYA L.MSG0.NL
|
||
>SYSCALL PrintF.YA
|
||
jmp CS.RUN.DONE
|
||
|
||
CS.RUN.DUMPDEV sta DevID
|
||
>SYSCALL GetDevByID.A
|
||
>STYA ZPDevPtr
|
||
>STYA NetDevJmp+1
|
||
|
||
ldx #DEVMGR.STATUS
|
||
jsr NetDevJmp
|
||
>STYA ZPDevStatPtr
|
||
|
||
>LDYA L.MSG0.L
|
||
>SYSCALL PrintF.YA
|
||
|
||
ldy #S.DSTAT.NIC.MAC+5
|
||
|
||
.1 >PUSHB (ZPDevStatPtr),y
|
||
dey
|
||
cpy #S.DSTAT.NIC.MAC-1
|
||
bne .1
|
||
|
||
lda #S.DEV.NAME
|
||
clc
|
||
adc ZPDevPtr
|
||
tay
|
||
lda /S.DEV.NAME
|
||
adc ZPDevPtr+1
|
||
|
||
>PUSHYA
|
||
|
||
lda ZPDevStatPtr
|
||
clc
|
||
adc #S.DSTAT.IDS
|
||
tay
|
||
lda ZPDevStatPtr+1
|
||
adc /S.DSTAT.IDS
|
||
>PUSHYA
|
||
|
||
>PUSHB DevID
|
||
|
||
>LDYA L.MSG1.DEV
|
||
>SYSCALL PrintF.YA
|
||
|
||
ldy #S.DSTAT.NIC.FLAGS
|
||
lda (ZPDevStatPtr),y
|
||
and #S.DSTAT.NIC.FLAGS.ARPOFFLOAD
|
||
beq .2
|
||
lda #1
|
||
.2 >PUSHA
|
||
>LDYA L.MSG1.DEV.ARP
|
||
>SYSCALL PrintF.YA
|
||
|
||
ldy #S.DSTAT.NIC.FLAGS
|
||
lda (ZPDevStatPtr),y
|
||
and #S.DSTAT.NIC.FLAGS.IPOFFLOAD
|
||
beq .3
|
||
lda #1
|
||
.3 >PUSHA
|
||
>LDYA L.MSG1.DEV.IP
|
||
>SYSCALL PrintF.YA
|
||
|
||
ldy #S.DSTAT.NIC.STATUS
|
||
lda (ZPDevStatPtr),y
|
||
and #S.DSTAT.NIC.STATUS.OK
|
||
bne CS.RUN.LINK
|
||
>PUSHW L.MSG1.LINK.KO
|
||
>LDYA L.MSG1.LINK
|
||
>SYSCALL PrintF.YA
|
||
bra CS.RUN.DUMPIP
|
||
|
||
CS.RUN.LINK >PUSHW L.MSG1.LINK.OK
|
||
>LDYA L.MSG1.LINK
|
||
>SYSCALL PrintF.YA
|
||
|
||
>LDYA L.MSG1.LINKSPEED
|
||
>SYSCALL PrintF.YA
|
||
|
||
ldy #S.DSTAT.NIC.STATUS
|
||
lda (ZPDevStatPtr),y
|
||
and #$0F
|
||
tax
|
||
|
||
.4 phx
|
||
lda #'0'
|
||
>SYSCALL PutChar.A
|
||
plx
|
||
dex
|
||
bne .4
|
||
|
||
ldy #S.DSTAT.NIC.STATUS
|
||
lda (ZPDevStatPtr),y
|
||
and #S.DSTAT.NIC.STATUS.FD
|
||
bne .5
|
||
>LDYA L.MSG1.DPLX.HD
|
||
bra .6
|
||
.5 >LDYA L.MSG1.DPLX.FD
|
||
.6 >SYSCALL PrintF.YA
|
||
|
||
CS.RUN.DUMPIP >LDYA L.MSG2
|
||
>SYSCALL PrintF.YA
|
||
lda (ZPIPCfgPtr)
|
||
and #S.IPCFG.STATUS.OK
|
||
beq .11
|
||
>LDYA L.MSG2.C
|
||
bra .10
|
||
.11 >LDYA L.MSG2.U
|
||
|
||
.10 >SYSCALL PrintF.YA
|
||
|
||
ldy #S.IPCFG.DHCPSRVR+3
|
||
ldx #4
|
||
.2 >PUSHB (ZPIPCfgPtr),y
|
||
dey
|
||
dex
|
||
bne .2
|
||
>LDYA L.MSG2.DHCPSRVR
|
||
>SYSCALL PrintF.YA
|
||
|
||
ldy #S.IPCFG.IP+7 IP/MASK
|
||
ldx #8
|
||
.3 >PUSHB (ZPIPCfgPtr),y
|
||
dey
|
||
dex
|
||
bne .3
|
||
>LDYA L.MSG2.IP
|
||
>SYSCALL PrintF.YA
|
||
|
||
ldy #S.IPCFG.GW+3
|
||
ldx #4
|
||
.4 >PUSHB (ZPIPCfgPtr),y
|
||
dey
|
||
dex
|
||
bne .4
|
||
>LDYA L.MSG2.GW
|
||
>SYSCALL PrintF.YA
|
||
|
||
ldy #S.IPCFG.DNS1+7
|
||
ldx #8
|
||
.5 >PUSHB (ZPIPCfgPtr),y
|
||
dey
|
||
dex
|
||
bne .5
|
||
>LDYA L.MSG2.DNS
|
||
>SYSCALL PrintF.YA
|
||
|
||
lda ZPIPCfgPtr
|
||
clc
|
||
adc #S.IPCFG.DOMAIN
|
||
tay
|
||
lda ZPIPCfgPtr+1
|
||
adc #0
|
||
>PUSHYA
|
||
|
||
lda ZPIPCfgPtr
|
||
clc
|
||
adc #S.IPCFG.HOSTNAME
|
||
tay
|
||
lda ZPIPCfgPtr+1
|
||
adc #0
|
||
>PUSHYA
|
||
|
||
>LDYA L.MSG2.HOSTNAME
|
||
>SYSCALL PrintF.YA
|
||
|
||
CS.RUN.DONE lda #0 tell TSKMGR that all done ok, but
|
||
sec we do not want to stay in memory
|
||
rts
|
||
*--------------------------------------
|
||
CS.DOEVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hLIBTCPIP
|
||
beq .8
|
||
>SYSCALL UnloadLib.A
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
NetDevJmp jmp *
|
||
*--------------------------------------
|
||
CS.END
|
||
LIBTCPIP >CSTR "libtcpip.o"
|
||
*--------------------------------------
|
||
MSG0 >CSTR "TCP/IP Status : "
|
||
MSG0.L >CSTR "Loaded\r\n"
|
||
MSG0.NL >CSTR "Not Loaded\r\n"
|
||
*--------------------------------------
|
||
MSG1.DEV >CSTR "\r\nDevice Configuration :\r\n DevID : $%h\r\n Device Type : %S\r\n Device Name : %s\r\n HW Address : %02h:%02h:%02h:%02h:%02h:%02h\r\n"
|
||
MSG1.DEV.ARP >CSTR " ARP Offload : %d\r\n"
|
||
MSG1.DEV.IP >CSTR " IP Offload : %d\r\n"
|
||
MSG1.LINK >CSTR " Link Status : %s\r\n"
|
||
MSG1.LINK.OK >CSTR "OK"
|
||
MSG1.LINK.KO >CSTR "Media Disconnected"
|
||
MSG1.LINKSPEED >CSTR " Link Speed : 1"
|
||
MSG1.DPLX.FD >CSTR " Mbit/s,Full Duplex\r\n"
|
||
MSG1.DPLX.HD >CSTR " Mbit/s,Half Duplex\r\n"
|
||
*--------------------------------------
|
||
MSG2 >CSTR "\r\nIP Configuration : "
|
||
MSG2.C >CSTR "Configured\r\n"
|
||
MSG2.U >CSTR "Not Configured\r\n"
|
||
MSG2.DHCPSRVR >CSTR " DHCP Server : %d.%d.%d.%d\r\n"
|
||
MSG2.IP >CSTR " IP/Mask : %d.%d.%d.%d/%d.%d.%d.%d\r\n"
|
||
MSG2.GW >CSTR " Gateway : %d.%d.%d.%d\r\n"
|
||
MSG2.DNS >CSTR " DNS : %d.%d.%d.%d,%d.%d.%d.%d\r\n"
|
||
MSG2.HOSTNAME >CSTR " Hostname : %S.%S\r\n"
|
||
hLIBTCPIP .BS 1
|
||
DevID .BS 1
|
||
DevName .BS 5
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
DS.END .ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE /A2OSX.SRC/BIN/IPCONFIG.S
|
||
ASM
|