A2osX/BIN/DNSINFO.S.txt

168 lines
3.4 KiB
Plaintext
Raw Normal View History

NEW
2017-12-22 21:24:30 +00:00
PREFIX /A2OSX.BUILD
AUTO 4,1
.LIST OFF
.OP 65C02
.OR $2000
2018-07-23 15:28:42 +00:00
.TF BIN/DNSINFO
*--------------------------------------
2018-07-23 15:28:42 +00:00
.INB INC/MACROS.I
.INB INC/A2OSX.I
2018-07-25 15:26:14 +00:00
.INB INC/ETH.I
2018-07-23 15:28:42 +00:00
.INB INC/LIBTCPIP.I
*--------------------------------------
ZPPTR1 .EQ ZPBIN
2015-10-19 20:35:00 +00:00
ZPPTR2 .EQ ZPBIN+2
*--------------------------------------
* 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 No Data Segment to Allocate
2017-12-22 21:24:30 +00:00
.DA #16 SS
.DA #4 ZP
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
L.LIBTCPIP .DA LIBTCPIP
L.SSCANF.IP .DA SSCANF.IP
L.MSG0 .DA MSG0
L.MSG1 .DA MSG1
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBTCPIP
2018-07-19 15:33:55 +00:00
>SYSCALL LoadLib
sta hLIBTCPIP
2018-08-08 15:13:37 +00:00
* lda (pPs)
* ora #S.PS.F.EVENT Now accept events
* sta (pPs)
2017-01-29 21:47:19 +00:00
clc
rts
*--------------------------------------
2017-12-22 21:24:30 +00:00
CS.RUN ldy #S.PS.ARGC
lda (pPs),y
bne CS.RUN.ADD
jmp CS.RUN.DUMP
*--------------------------------------
CS.RUN.ADD cmp #2
beq .1
jmp .9
.1 >PUSHEA.G DST.IP+3
>PUSHEA.G DST.IP+2
>PUSHEA.G DST.IP+1
>PUSHEA.G DST.IP
2018-08-08 15:13:37 +00:00
>PUSHBI 8 4 PTRs
>PUSHW L.SSCANF.IP
lda #1
2018-07-18 15:30:42 +00:00
>SYSCALL GetArg
2018-07-19 15:33:55 +00:00
>SYSCALL sscanf
bcs .9
>PUSHEA.G DST.IP
lda #2
2018-07-18 15:30:42 +00:00
>SYSCALL GetArg
>PUSHYA
>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 #K.E.SYN
sec
.99 rts
*--------------------------------------
2017-12-22 21:24:30 +00:00
CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GetCache
>STYA ZPPTR1
>LDYA L.MSG0
2018-08-23 15:16:20 +00:00
>SYSCALL puts
2016-03-17 07:31:11 +00:00
lda #K.DNSCACHE.SIZE
>STA.G EntryCount
2016-03-17 07:31:11 +00:00
.1 lda (ZPPTR1)
beq .2
2015-10-19 20:35:00 +00:00
ldy #S.DNSCACHE.TTL+4
2018-08-23 15:16:20 +00:00
2015-10-19 20:35:00 +00:00
.6 dey
lda (ZPPTR1),y
>PUSHA
2015-10-19 20:35:00 +00:00
cpy #S.DNSCACHE.TTL
bne .6
2016-03-17 07:31:11 +00:00
ldy #S.DNSCACHE.IP+4
2018-08-23 15:16:20 +00:00
2016-03-17 07:31:11 +00:00
.5 dey
lda (ZPPTR1),y
>PUSHA
cpy #S.DNSCACHE.IP
bne .5
ldy #S.DNSCACHE.hNAME
lda (ZPPTR1),y
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2016-03-17 07:31:11 +00:00
>PUSHYA
2015-10-19 20:35:00 +00:00
ldy #S.DNSCACHE.ID
>PUSHB (ZPPTR1),y
iny
>PUSHB (ZPPTR1),y
2015-10-19 20:35:00 +00:00
>PUSHB (ZPPTR1) Entry Status
2018-08-23 15:16:20 +00:00
>PUSHBI 13
>LDYA L.MSG1
2018-06-21 15:12:10 +00:00
>SYSCALL printf
.2 lda ZPPTR1
clc
adc #S.DNSCACHE
sta ZPPTR1
bcc .3
inc ZPPTR1+1
2015-10-19 20:35:00 +00:00
.3 >DEC.G EntryCount
2016-03-17 07:31:11 +00:00
bne .1
2015-10-19 20:35:00 +00:00
.8 lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
rts
*--------------------------------------
2017-01-29 21:47:19 +00:00
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT lda hLIBTCPIP
2018-07-20 14:10:10 +00:00
>SYSCALL UnloadLib
clc
rts
*--------------------------------------
CS.END
LIBTCPIP .AZ "libtcpip.o"
SSCANF.IP .AZ "%d.%d.%d.%d"
2018-08-23 15:16:20 +00:00
MSG0 .AZ "STS TR.ID Hostname IP Address TTL"
MSG1 .AZ "$%h $%H %32s %03d.%03d.%03d.%03d %u\r\n"
hLIBTCPIP .BS 1
*--------------------------------------
DS.START
DST.IP .BS 4
2016-03-17 07:31:11 +00:00
EntryCount .BS 1
DS.END
*--------------------------------------
MAN
SAVE /A2OSX.SRC/BIN/DNSINFO.S
ASM