2016-03-13 21:51:50 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF /A2OSX.BOOT/BIN/IPCONFIG
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
.INB INC/LIBTCPIP.I
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPIPCfgPtr .EQ ZPBIN
|
|
|
|
|
ZPDevPtr .EQ ZPBIN+2
|
|
|
|
|
ZPDevInfoPtr .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 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.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
|
2016-03-13 21:51:50 +00:00
|
|
|
|
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
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-10-17 06:21:04 +00:00
|
|
|
|
CS.INIT >LDYA L.LIBTCPIP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL LoadLibYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
sta hLIBTCPIP
|
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG0
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG
|
|
|
|
|
>STYA ZPIPCfgPtr
|
|
|
|
|
|
|
|
|
|
ldy #S.IPCFG.HDEV
|
|
|
|
|
lda (ZPIPCfgPtr),y
|
|
|
|
|
bne CS.INIT.DUMPDEV
|
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG0.NL
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
jmp CS.INIT.DONE
|
|
|
|
|
|
|
|
|
|
CS.INIT.DUMPDEV sta DevID
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetDevByIDA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
>STYA ZPDevPtr
|
|
|
|
|
|
|
|
|
|
lda DevID
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetDevInfoA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
>STYA ZPDevInfoPtr
|
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG0.L
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.DEVINFO.NET.MAC+6
|
|
|
|
|
.1 dey
|
|
|
|
|
>PUSHB (ZPDevInfoPtr),y
|
|
|
|
|
cpy #S.DEVINFO.NET.MAC
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda ZPDevPtr
|
|
|
|
|
clc
|
|
|
|
|
adc #S.DEV.NAME
|
|
|
|
|
tay
|
|
|
|
|
lda ZPDevPtr+1
|
|
|
|
|
adc #0
|
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
>PUSHB DevID
|
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG1.DEV
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.DEVINFO.FLAGS
|
|
|
|
|
lda (ZPDevInfoPtr),y
|
|
|
|
|
and #S.DEVINFO.NET.FLAGS.ARPOFFLOAD
|
|
|
|
|
beq .2
|
|
|
|
|
lda #1
|
|
|
|
|
.2 >PUSHA
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG1.DEV.ARP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
2016-04-18 20:17:28 +00:00
|
|
|
|
ldy #S.DEVINFO.FLAGS
|
|
|
|
|
lda (ZPDevInfoPtr),y
|
|
|
|
|
and #S.DEVINFO.NET.FLAGS.IPOFFLOAD
|
|
|
|
|
beq .3
|
|
|
|
|
lda #1
|
|
|
|
|
.3 >PUSHA
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG1.DEV.IP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-04-18 20:17:28 +00:00
|
|
|
|
|
2016-03-13 21:51:50 +00:00
|
|
|
|
ldy #S.DEVINFO.NET.STATUS
|
|
|
|
|
lda (ZPDevInfoPtr),y
|
|
|
|
|
and #S.DEVINFO.NET.STATUS.OK
|
|
|
|
|
bne CS.INIT.LINK
|
|
|
|
|
>PUSHW L.MSG1.LINK.KO
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG1.LINK
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
bra CS.INIT.DUMPIP
|
|
|
|
|
|
|
|
|
|
CS.INIT.LINK >PUSHW L.MSG1.LINK.OK
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG1.LINK
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG1.LINKSPEED
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.DEVINFO.NET.STATUS
|
|
|
|
|
lda (ZPDevInfoPtr),y
|
|
|
|
|
and #$0F
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
.4 phx
|
|
|
|
|
lda #'0'
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL COutA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
plx
|
|
|
|
|
dex
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldy #S.DEVINFO.NET.STATUS
|
|
|
|
|
lda (ZPDevInfoPtr),y
|
|
|
|
|
and #S.DEVINFO.NET.STATUS.FD
|
|
|
|
|
bne .5
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG1.DPLX.HD
|
2016-03-13 21:51:50 +00:00
|
|
|
|
bra .6
|
2016-10-17 06:21:04 +00:00
|
|
|
|
.5 >LDYA L.MSG1.DPLX.FD
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.6 >SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
CS.INIT.DUMPIP >LDYA L.MSG2
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
lda (ZPIPCfgPtr)
|
|
|
|
|
and #S.IPCFG.STATUS.OK
|
|
|
|
|
beq .11
|
|
|
|
|
>LDYA L.MSG2.C
|
|
|
|
|
bra .10
|
|
|
|
|
.11 >LDYA L.MSG2.U
|
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.10 >SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IPCFG.DHCPSRVR+3
|
|
|
|
|
ldx #4
|
|
|
|
|
.2 >PUSHB (ZPIPCfgPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG2.DHCPSRVR
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IPCFG.IP+7 IP/MASK
|
|
|
|
|
ldx #8
|
|
|
|
|
.3 >PUSHB (ZPIPCfgPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG2.IP
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IPCFG.GW+3
|
|
|
|
|
ldx #4
|
|
|
|
|
.4 >PUSHB (ZPIPCfgPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .4
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG2.GW
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.IPCFG.DNS1+7
|
|
|
|
|
ldx #8
|
|
|
|
|
.5 >PUSHB (ZPIPCfgPtr),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .5
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG2.DNS
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2016-10-17 06:21:04 +00:00
|
|
|
|
>LDYA L.MSG2.HOSTNAME
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
|
|
|
|
|
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
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL FreeMemA
|
2016-03-13 21:51:50 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
2016-10-24 15:54:43 +00:00
|
|
|
|
LIBTCPIP >PSTR "libtcpip.o"
|
2016-03-13 21:51:50 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
MSG0 >CSTR "TCP/IP Status : "
|
|
|
|
|
MSG0.L >CSTR "Loaded\n"
|
|
|
|
|
MSG0.NL >CSTR "Not Loaded\n"
|
2016-03-13 21:51:50 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
MSG1.DEV >CSTR "\nDevice Configuration :\n DevID : $%h\n Device Name : %s\n HW Address : %02h:%02h:%02h:%02h:%02h:%02h\n"
|
|
|
|
|
MSG1.DEV.ARP >CSTR " ARP Offload : %d\n"
|
|
|
|
|
MSG1.DEV.IP >CSTR " IP Offload : %d\n"
|
|
|
|
|
MSG1.LINK >CSTR " Link Status : %s\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\n"
|
|
|
|
|
MSG1.DPLX.HD >CSTR " Mbit/s,Half Duplex\n"
|
2016-03-13 21:51:50 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
MSG2 >CSTR "\nIP Configuration : "
|
|
|
|
|
MSG2.C >CSTR "Configured\n"
|
|
|
|
|
MSG2.U >CSTR "Not Configured\n"
|
|
|
|
|
MSG2.DHCPSRVR >CSTR " DHCP Server : %d.%d.%d.%d\n"
|
|
|
|
|
MSG2.IP >CSTR " IP/Mask : %d.%d.%d.%d/%d.%d.%d.%d\n"
|
|
|
|
|
MSG2.GW >CSTR " Gateway : %d.%d.%d.%d\n"
|
|
|
|
|
MSG2.DNS >CSTR " DNS : %d.%d.%d.%d,%d.%d.%d.%d\n"
|
|
|
|
|
MSG2.HOSTNAME >CSTR " Hostname : %s.%s\n"
|
2016-03-13 21:51:50 +00:00
|
|
|
|
hLIBTCPIP .BS 1
|
|
|
|
|
DevID .BS 1
|
|
|
|
|
MAN
|
|
|
|
|
SAVE BIN/IPCONFIG.S
|
|
|
|
|
ASM
|