2015-03-14 21:47:37 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:47:37 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST ON
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2015-09-13 20:35:07 +00:00
|
|
|
|
.TF /A2OSX.BOOT/BIN/DNS
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2015-09-13 20:35:07 +00:00
|
|
|
|
.INB INC/A2OSX.API.I
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.INB INC/KERNEL.I
|
|
|
|
|
.INB INC/LIBSTR.I
|
|
|
|
|
.INB INC/LIBTCPIP.I
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPPTR1 .EQ ZPBIN
|
|
|
|
|
*--------------------------------------
|
2015-09-13 20:35:07 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 21:47:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-09-13 20:35:07 +00:00
|
|
|
|
.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 No Data Segment to Allocate
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.EVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.LIBSTR .DA LIBSTR
|
|
|
|
|
L.LIBTCPIP .DA LIBTCPIP
|
|
|
|
|
L.SSCANF.IP .DA SSCANF.IP
|
|
|
|
|
L.IP .DA IP
|
|
|
|
|
L.MSG0 .DA MSG0
|
|
|
|
|
L.MSG1 .DA MSG1
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT stz hHostName
|
|
|
|
|
stz hIP
|
|
|
|
|
|
2015-09-13 20:35:07 +00:00
|
|
|
|
>LDYA L.LIBSTR
|
|
|
|
|
>LOADLIBYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
sta hLIBSTR
|
|
|
|
|
|
2015-09-13 20:35:07 +00:00
|
|
|
|
>LDYA L.LIBTCPIP
|
|
|
|
|
>LOADLIBYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
sta hLIBTCPIP
|
2015-09-13 20:35:07 +00:00
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
ldy #S.PS.hARGS
|
2015-09-13 20:35:07 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
bne CS.INIT.ADD
|
|
|
|
|
jmp CS.INIT.DUMP
|
|
|
|
|
|
|
|
|
|
CS.INIT.ADD >PUSHA
|
|
|
|
|
>PUSHBI $20 Push SEP=' '
|
|
|
|
|
>PUSHBI 1 Push 1 for getting hostname
|
|
|
|
|
>SYSCALL SYS.PStrGetTkn
|
|
|
|
|
bcs .91
|
|
|
|
|
sta hHostName
|
|
|
|
|
|
|
|
|
|
ldy #S.PS.hARGS
|
2015-09-13 20:35:07 +00:00
|
|
|
|
lda (pPs),y
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI $20 Push SEP=' '
|
|
|
|
|
>PUSHBI 2 Push 2 for getting IP
|
|
|
|
|
>SYSCALL SYS.PStrGetTkn
|
|
|
|
|
.91 bcs .9
|
|
|
|
|
|
|
|
|
|
sta hIP
|
|
|
|
|
>PUSHW L.IP
|
|
|
|
|
>PUSHW L.SSCANF.IP
|
|
|
|
|
lda hIP
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.SSCANF
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>PUSHWI 1800 default TTL
|
|
|
|
|
>PUSHW L.IP
|
2015-09-13 20:35:07 +00:00
|
|
|
|
lda hHostName
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>PUSHYA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
>LIBCALL hLIBTCPIP,LIBTCPIP.DNS.ADD
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #0 tell TSKMGR that all done ok, but
|
|
|
|
|
sec we do not want to stay in memory
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #SYSMGR.ERRSYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
CS.INIT.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GETCACHE
|
|
|
|
|
>STYA ZPPTR1
|
|
|
|
|
>PUSHW L.MSG0
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|
|
|
|
|
2015-09-13 20:35:07 +00:00
|
|
|
|
ldx #K.DNSCACHE.SIZE
|
|
|
|
|
|
2015-03-14 21:47:37 +00:00
|
|
|
|
.1 phx
|
|
|
|
|
lda (ZPPTR1)
|
|
|
|
|
beq .2
|
|
|
|
|
|
2015-09-13 20:35:07 +00:00
|
|
|
|
ldy #S.DNSCACHE.RDATA+3
|
2015-03-14 21:47:37 +00:00
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
|
|
|
|
|
2015-09-13 20:35:07 +00:00
|
|
|
|
ldy #S.DNSCACHE.TTL+3
|
|
|
|
|
>PUSHA
|
|
|
|
|
dey
|
2015-03-14 21:47:37 +00:00
|
|
|
|
lda (ZPPTR1),y
|
2015-09-13 20:35:07 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
dey
|
2015-03-14 21:47:37 +00:00
|
|
|
|
lda (ZPPTR1),y
|
2015-09-13 20:35:07 +00:00
|
|
|
|
>PUSHA
|
|
|
|
|
dey
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>PUSHA
|
2015-03-14 21:47:37 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.DNSCACHE.hNAME
|
|
|
|
|
lda (ZPPTR1),y
|
|
|
|
|
>SYSCALL SYS.GetMemPtrA
|
|
|
|
|
>PUSHYA
|
|
|
|
|
|
|
|
|
|
>PUSHB (ZPPTR1)
|
|
|
|
|
|
|
|
|
|
>PUSHW L.MSG1
|
|
|
|
|
>LIBCALL hLIBSTR,LIBSTR.PRINTF
|
|
|
|
|
|
|
|
|
|
.2 lda ZPPTR1
|
|
|
|
|
clc
|
|
|
|
|
adc #S.DNSCACHE
|
|
|
|
|
sta ZPPTR1
|
|
|
|
|
bcc .3
|
|
|
|
|
inc ZPPTR1+1
|
|
|
|
|
.3 plx
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #0 tell TSKMGR that all done ok, but
|
|
|
|
|
sec we do not want to stay in memory
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN
|
|
|
|
|
CS.EVENT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT lda hHostName
|
|
|
|
|
beq .1
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
.1 lda hIP
|
|
|
|
|
beq .2
|
|
|
|
|
>SYSCALL SYS.FreeMemA
|
|
|
|
|
.2 lda hLIBTCPIP
|
|
|
|
|
>SYSCALL SYS.UnloadLibA
|
|
|
|
|
lda hLIBSTR
|
|
|
|
|
>SYSCALL SYS.UnloadLibA
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
LIBSTR >PSTRING "libstr.o"
|
|
|
|
|
LIBTCPIP >PSTRING "libtcpip.o"
|
|
|
|
|
SSCANF.IP >PSTRING "%d.%d.%d.%d"
|
|
|
|
|
MSG0 >CSTRING "STS Hostname TTL IP Address\n"
|
2015-09-13 20:35:07 +00:00
|
|
|
|
MSG1 >CSTRING "$%h %32S %09L %d.%d.%d.%d\n"
|
2015-03-14 21:47:37 +00:00
|
|
|
|
hLIBSTR .BS 1
|
|
|
|
|
hLIBTCPIP .BS 1
|
|
|
|
|
hHostName .BS 1
|
|
|
|
|
hIP .BS 1
|
|
|
|
|
IP .BS 4
|
|
|
|
|
MAN
|
|
|
|
|
SAVE BIN/DNS.S
|
|
|
|
|
ASM
|