A2osX/BIN/IPCONFIG.S.txt
2018-08-31 08:23:50 +02:00

326 lines
6.4 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
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/IPCONFIG
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/NIC.I
.INB INC/ETH.I
.INB INC/LIBTCPIP.I
*--------------------------------------
pIPCFG .EQ ZPBIN
pFD .EQ ZPBIN+2
pDEV .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.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
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBTCPIP
>SYSCALL LoadLib
bcs .9
sta hLIBTCPIP
clc
.9 rts
*--------------------------------------
CS.RUN >PUSHBI 0
>LDYA L.MSG0
>SYSCALL printf
>LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG
>STYA pIPCFG
ldy #S.IPCFG.hFD
lda (pIPCFG),y
bne .1
>LDYA L.MSG0.NL
>SYSCALL puts
jmp CS.RUN.DONE
.1 >STA.G FD.ETH
>SYSCALL GetMemPtr
>STYA pFD
>PUSHEA.G DIB
>LDA.G FD.ETH
>SYSCALL GetDevStatus
>LEA.G DCB.NIC
>STYA.G IOCTL+S.IOCTL.BUFPTR
lda #S.IOCTL.STATCODE.GETDCB
>STA.G IOCTL+S.IOCTL.STATCODE
>PUSHEA.G IOCTL
>PUSHBI IOCTL.STATUS
>LDA.G FD.ETH
>SYSCALL IOCTL
CS.RUN.DUMP >LDYA L.MSG0.L
>SYSCALL puts
ldy #DCB.NIC+S.DCB.NIC.MAC+5
ldx #6
.1 lda (pData),y
>PUSHA
dey
dex
bne .1
>PUSHEA.G DIB+S.DIB.IDS
lda #S.FD.DEV.NAME
clc
adc pFD
tay
lda /S.FD.DEV.NAME
adc pFD+1
>PUSHYA
>PUSHB.G FD.ETH
>PUSHBI 11
>LDYA L.MSG1.DEV
>SYSCALL printf
lda DCB.NIC+S.DCB.NIC.FLAGS
and #S.DCB.NIC.FLAGS.ARPOFFLOAD
beq .2
lda #1
.2 >PUSHA
>PUSHBI 1
>LDYA L.MSG1.DEV.ARP
>SYSCALL printf
lda DCB.NIC+S.DCB.NIC.FLAGS
and #S.DCB.NIC.FLAGS.IPOFFLOAD
beq .3
lda #1
.3
>PUSHA
>PUSHBI 1
>LDYA L.MSG1.DEV.IP
>SYSCALL printf
lda DCB.NIC+S.DCB.NIC.LINK
and #S.DCB.NIC.LINK.OK
bne CS.RUN.LINK
>LDYA L.MSG1.LINK.KO
>SYSCALL puts
bra CS.RUN.DUMPIP
CS.RUN.LINK >LDYA L.MSG1.LINK.OK
>SYSCALL puts
>PUSHBI 0
>LDYA L.MSG1.LINKSPEED
>SYSCALL printf
lda DCB.NIC+S.DCB.NIC.SPEED
and #$0F
tax
.4 phx
lda #'0'
>SYSCALL PutChar
plx
dex
bne .4
lda DCB.NIC+S.DCB.NIC.LINK
and #S.DCB.NIC.LINK.FD
bne .5
>LDYA L.MSG1.DPLX.HD
bra .6
.5 >LDYA L.MSG1.DPLX.FD
.6 >SYSCALL puts
CS.RUN.DUMPIP >PUSHBI 0
>LDYA L.MSG2
>SYSCALL printf
lda (pIPCFG)
and #S.IPCFG.STATUS.OK
beq .11
>LDYA L.MSG2.C
bra .10
.11 >LDYA L.MSG2.U
.10 >SYSCALL puts
ldy #S.IPCFG.DHCPSRVR+3
ldx #4
.2 >PUSHB (pIPCFG),y
dey
dex
bne .2
>PUSHBI 4
>LDYA L.MSG2.DHCPSRVR
>SYSCALL printf
ldy #S.IPCFG.IP+7 IP/MASK
ldx #8
.3 >PUSHB (pIPCFG),y
dey
dex
bne .3
>PUSHBI 8
>LDYA L.MSG2.IP
>SYSCALL printf
ldy #S.IPCFG.GW+3
ldx #4
.4 >PUSHB (pIPCFG),y
dey
dex
bne .4
>PUSHBI 4
>LDYA L.MSG2.GW
>SYSCALL printf
ldy #S.IPCFG.DNS1+7
ldx #8
.5 >PUSHB (pIPCFG),y
dey
dex
bne .5
>PUSHBI 8
>LDYA L.MSG2.DNS
>SYSCALL printf
lda pIPCFG
clc
adc #S.IPCFG.DOMAIN
tay
lda pIPCFG+1
adc #0
>PUSHYA
lda pIPCFG
clc
adc #S.IPCFG.HOSTNAME
tay
lda pIPCFG+1
adc #0
>PUSHYA
>PUSHBI 4
>LDYA L.MSG2.HOSTNAME
>SYSCALL printf
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
.8 clc
rts
*--------------------------------------
CS.END
LIBTCPIP .AZ "libtcpip.o"
*--------------------------------------
MSG0 .AZ "TCP/IP Status : "
MSG0.L .AZ "Loaded"
MSG0.NL .AZ "Not Loaded"
*--------------------------------------
MSG1.DEV .AS "Device Configuration :\r\n"
.AS " FD.ETH : $%h\r\n"
.AS " Device Name : %s\r\n"
.AS " Device Type : %S\r\n"
.AZ " HW Address : %02h:%02h:%02h:%02h:%02h:%02h\r\n"
MSG1.DEV.ARP .AZ " ARP Offload : %d\r\n"
MSG1.DEV.IP .AS " IP Offload : %d\r\n"
.AZ " Link Status : "
MSG1.LINK.OK .AZ "OK"
MSG1.LINK.KO .AZ "Media Disconnected"
MSG1.LINKSPEED .AZ " Link Speed : 1"
MSG1.DPLX.FD .AZ " Mbit/s,Full Duplex"
MSG1.DPLX.HD .AZ " Mbit/s,Half Duplex"
*--------------------------------------
MSG2 .AZ "IP Configuration : "
MSG2.C .AZ "Configured"
MSG2.U .AZ "Not Configured"
MSG2.DHCPSRVR .AZ " DHCP Server : %d.%d.%d.%d\r\n"
MSG2.IP .AZ " IP/Mask : %d.%d.%d.%d/%d.%d.%d.%d\r\n"
MSG2.GW .AZ " Gateway : %d.%d.%d.%d\r\n"
MSG2.DNS .AZ " DNS : %d.%d.%d.%d,%d.%d.%d.%d\r\n"
MSG2.HOSTNAME .AZ " Hostname : %s.%s\r\n"
hLIBTCPIP .BS 1
*--------------------------------------
.DUMMY
.OR 0
DS.START
FD.ETH .BS 1
IOCTL .BS S.IOCTL
DIB .BS S.DIB
DCB.NIC .BS S.DCB.NIC
DS.END .ED
*--------------------------------------
MAN
SAVE /A2OSX.SRC/BIN/IPCONFIG.S
ASM