A2osX/BIN/IPCONFIG.S.txt

326 lines
6.4 KiB
Plaintext
Raw Normal View History

NEW
2018-11-17 17:17:13 +00:00
PREFIX
2017-12-22 21:24:30 +00:00
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
2018-07-23 15:28:42 +00:00
.TF BIN/IPCONFIG
*--------------------------------------
2018-07-23 15:28:42 +00:00
.INB INC/MACROS.I
.INB INC/A2OSX.I
.INB INC/NIC.I
.INB INC/ETH.I
.INB INC/LIBTCPIP.I
*--------------------------------------
2018-08-08 15:13:37 +00:00
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
2016-04-18 20:17:28 +00:00
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
2018-07-19 15:33:55 +00:00
>SYSCALL LoadLib
bcs .9
sta hLIBTCPIP
2018-11-09 13:29:23 +00:00
.9 rts
*--------------------------------------
2018-08-23 15:16:20 +00:00
CS.RUN >PUSHBI 0
>LDYA L.MSG0
2018-06-21 15:12:10 +00:00
>SYSCALL printf
>LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG
2018-08-08 15:13:37 +00:00
>STYA pIPCFG
2018-08-08 15:13:37 +00:00
ldy #S.IPCFG.hFD
lda (pIPCFG),y
2018-07-23 15:28:42 +00:00
bne .1
>LDYA L.MSG0.NL
2018-08-23 15:16:20 +00:00
>SYSCALL puts
jmp CS.RUN.DONE
2018-08-08 15:13:37 +00:00
.1 >STA.G FD.ETH
>SYSCALL GetMemPtr
>STYA pFD
2018-07-23 15:28:42 +00:00
>PUSHEA.G DIB
2018-08-08 15:13:37 +00:00
>LDA.G FD.ETH
2018-07-18 15:30:42 +00:00
>SYSCALL GetDevStatus
2018-07-23 15:28:42 +00:00
>LEA.G DCB.NIC
2018-07-24 16:00:24 +00:00
>STYA.G IOCTL+S.IOCTL.BUFPTR
lda #S.IOCTL.STATCODE.GETDCB
>STA.G IOCTL+S.IOCTL.STATCODE
2018-07-23 15:28:42 +00:00
>PUSHEA.G IOCTL
>PUSHBI IOCTL.STATUS
2018-08-08 15:13:37 +00:00
>LDA.G FD.ETH
2018-07-23 15:28:42 +00:00
>SYSCALL IOCTL
CS.RUN.DUMP >LDYA L.MSG0.L
2018-08-23 15:16:20 +00:00
>SYSCALL puts
2018-07-24 16:00:24 +00:00
ldy #DCB.NIC+S.DCB.NIC.MAC+5
ldx #6
2018-07-24 16:00:24 +00:00
.1 lda (pData),y
>PUSHA
dey
2018-07-24 16:00:24 +00:00
dex
bne .1
2018-07-23 15:28:42 +00:00
>PUSHEA.G DIB+S.DIB.IDS
lda #S.FD.DEV.NAME
clc
2018-08-08 15:13:37 +00:00
adc pFD
tay
2018-07-23 15:28:42 +00:00
lda /S.FD.DEV.NAME
2018-08-08 15:13:37 +00:00
adc pFD+1
>PUSHYA
2018-08-08 15:13:37 +00:00
>PUSHB.G FD.ETH
2018-08-23 15:16:20 +00:00
>PUSHBI 11
>LDYA L.MSG1.DEV
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2018-10-29 08:41:10 +00:00
>LDA.G DCB.NIC+S.DCB.NIC.FLAGS
2018-07-23 15:28:42 +00:00
and #S.DCB.NIC.FLAGS.ARPOFFLOAD
beq .2
2018-07-23 15:28:42 +00:00
lda #1
2018-07-23 15:28:42 +00:00
2018-08-23 15:16:20 +00:00
.2 >PUSHA
>PUSHBI 1
>LDYA L.MSG1.DEV.ARP
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2018-10-29 08:41:10 +00:00
>LDA.G DCB.NIC+S.DCB.NIC.FLAGS
2018-07-23 15:28:42 +00:00
and #S.DCB.NIC.FLAGS.IPOFFLOAD
2016-04-18 20:17:28 +00:00
beq .3
2018-07-23 15:28:42 +00:00
2016-04-18 20:17:28 +00:00
lda #1
2018-07-23 15:28:42 +00:00
.3
>PUSHA
2018-08-23 15:16:20 +00:00
>PUSHBI 1
>LDYA L.MSG1.DEV.IP
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2018-07-24 16:00:24 +00:00
2018-10-29 08:41:10 +00:00
>LDA.G DCB.NIC+S.DCB.NIC.LINK
2018-07-23 15:28:42 +00:00
and #S.DCB.NIC.LINK.OK
bne CS.RUN.LINK
2018-07-23 15:28:42 +00:00
2018-07-24 16:00:24 +00:00
>LDYA L.MSG1.LINK.KO
>SYSCALL puts
bra CS.RUN.DUMPIP
2018-07-24 16:00:24 +00:00
CS.RUN.LINK >LDYA L.MSG1.LINK.OK
>SYSCALL puts
2018-08-23 15:16:20 +00:00
>PUSHBI 0
>LDYA L.MSG1.LINKSPEED
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2018-10-29 08:41:10 +00:00
>LDA.G DCB.NIC+S.DCB.NIC.SPEED
and #$0F
tax
.4 phx
lda #'0'
2018-07-18 15:30:42 +00:00
>SYSCALL PutChar
plx
dex
bne .4
2018-10-29 08:41:10 +00:00
>LDA.G DCB.NIC+S.DCB.NIC.LINK
2018-07-23 15:28:42 +00:00
and #S.DCB.NIC.LINK.FD
bne .5
2018-07-23 15:28:42 +00:00
>LDYA L.MSG1.DPLX.HD
bra .6
2018-07-23 15:28:42 +00:00
.5 >LDYA L.MSG1.DPLX.FD
2018-07-24 16:00:24 +00:00
.6 >SYSCALL puts
2018-08-23 15:16:20 +00:00
CS.RUN.DUMPIP >PUSHBI 0
>LDYA L.MSG2
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2018-08-08 15:13:37 +00:00
lda (pIPCFG)
and #S.IPCFG.STATUS.OK
beq .11
2018-07-23 15:28:42 +00:00
>LDYA L.MSG2.C
bra .10
2018-07-23 15:28:42 +00:00
.11 >LDYA L.MSG2.U
2018-07-24 16:00:24 +00:00
.10 >SYSCALL puts
ldy #S.IPCFG.DHCPSRVR+3
ldx #4
2018-08-23 15:16:20 +00:00
2018-08-08 15:13:37 +00:00
.2 >PUSHB (pIPCFG),y
dey
dex
bne .2
2018-08-23 15:16:20 +00:00
>PUSHBI 4
>LDYA L.MSG2.DHCPSRVR
2018-06-21 15:12:10 +00:00
>SYSCALL printf
ldy #S.IPCFG.IP+7 IP/MASK
ldx #8
2018-08-23 15:16:20 +00:00
2018-08-08 15:13:37 +00:00
.3 >PUSHB (pIPCFG),y
dey
dex
bne .3
2018-08-23 15:16:20 +00:00
>PUSHBI 8
>LDYA L.MSG2.IP
2018-06-21 15:12:10 +00:00
>SYSCALL printf
ldy #S.IPCFG.GW+3
ldx #4
2018-08-23 15:16:20 +00:00
2018-08-08 15:13:37 +00:00
.4 >PUSHB (pIPCFG),y
dey
dex
bne .4
2018-08-23 15:16:20 +00:00
>PUSHBI 4
>LDYA L.MSG2.GW
2018-06-21 15:12:10 +00:00
>SYSCALL printf
ldy #S.IPCFG.DNS1+7
ldx #8
2018-08-23 15:16:20 +00:00
2018-08-08 15:13:37 +00:00
.5 >PUSHB (pIPCFG),y
dey
dex
bne .5
2018-08-23 15:16:20 +00:00
>PUSHBI 8
>LDYA L.MSG2.DNS
2018-06-21 15:12:10 +00:00
>SYSCALL printf
2018-08-08 15:13:37 +00:00
lda pIPCFG
clc
adc #S.IPCFG.DOMAIN
tay
2018-08-08 15:13:37 +00:00
lda pIPCFG+1
adc #0
>PUSHYA
2018-08-08 15:13:37 +00:00
lda pIPCFG
clc
adc #S.IPCFG.HOSTNAME
tay
2018-08-08 15:13:37 +00:00
lda pIPCFG+1
adc #0
>PUSHYA
2018-08-23 15:16:20 +00:00
>PUSHBI 4
>LDYA L.MSG2.HOSTNAME
2018-06-21 15:12:10 +00:00
>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
2018-07-20 14:10:10 +00:00
>SYSCALL UnloadLib
.8 clc
rts
*--------------------------------------
CS.END
2018-10-09 15:47:06 +00:00
LIBTCPIP .AZ "libtcpip"
*--------------------------------------
MSG0 .AZ "TCP/IP Status : "
2018-08-31 06:23:50 +00:00
MSG0.L .AZ "Loaded"
MSG0.NL .AZ "Not Loaded"
*--------------------------------------
2018-08-23 15:16:20 +00:00
MSG1.DEV .AS "Device Configuration :\r\n"
2018-08-08 15:13:37 +00:00
.AS " FD.ETH : $%h\r\n"
2018-07-23 15:28:42 +00:00
.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"
2018-08-23 15:16:20 +00:00
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"
2018-07-24 16:00:24 +00:00
MSG1.DPLX.FD .AZ " Mbit/s,Full Duplex"
MSG1.DPLX.HD .AZ " Mbit/s,Half Duplex"
*--------------------------------------
2018-08-23 15:16:20 +00:00
MSG2 .AZ "IP Configuration : "
2018-07-24 16:00:24 +00:00
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"
2018-07-23 15:28:42 +00:00
MSG2.HOSTNAME .AZ " Hostname : %s.%s\r\n"
hLIBTCPIP .BS 1
*--------------------------------------
.DUMMY
.OR 0
DS.START
2018-08-08 15:13:37 +00:00
FD.ETH .BS 1
2018-07-23 15:28:42 +00:00
IOCTL .BS S.IOCTL
DIB .BS S.DIB
DCB.NIC .BS S.DCB.NIC
DS.END .ED
*--------------------------------------
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/BIN/BIN/IPCONFIG.S
ASM