A2osX/BIN/DNSINFO.S.txt

210 lines
4.0 KiB
Plaintext
Raw Normal View History

NEW
2019-07-26 14:23:07 +00:00
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
2019-12-05 15:57:56 +00:00
.TF bin/dnsinfo
*--------------------------------------
2020-08-17 20:47:31 +00:00
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/eth.i
.INB inc/libtcpip.i
*--------------------------------------
2018-12-06 11:40:30 +00:00
.DUMMY
.OR ZPBIN
ZS.START
2019-10-06 12:50:43 +00:00
ZPPTR1 .BS 2
EntryCount .BS 1
2019-10-25 15:09:13 +00:00
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
2018-12-06 11:40:30 +00:00
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
2019-10-06 12:50:43 +00:00
.DA DS.END-DS.START Data Segment Size
2018-12-06 11:40:30 +00:00
.DA #32 Stack Size
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
2019-10-03 06:25:27 +00:00
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
2021-06-19 17:46:36 +00:00
.DA CS.EVENT
.DA CS.QUIT
L.LIBTCPIP .DA LIBTCPIP
2018-11-21 13:08:11 +00:00
L.MSG.IPKO .DA MSG.IPKO
L.SSCANF.IP .DA SSCANF.IP
L.MSG0 .DA MSG0
L.MSG1 .DA MSG1
2018-12-06 11:40:30 +00:00
L.MSG1.Status .DA MSG1.S
.DA MSG1.P
.DA MSG1.D
2018-11-01 08:53:47 +00:00
L.MSG.USAGE .DA MSG.USAGE
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBTCPIP
2018-07-19 15:33:55 +00:00
>SYSCALL LoadLib
2018-11-12 09:22:06 +00:00
bcs .9
sta hLIBTCPIP
2018-11-12 09:22:06 +00:00
.9 rts
*--------------------------------------
2019-01-16 21:51:57 +00:00
CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ?
2018-11-21 13:08:11 +00:00
>STYA ZPPTR1
lda (ZPPTR1) Configured ?
bmi CS.RUN.IPOK
2019-10-25 15:09:13 +00:00
2018-11-21 13:08:11 +00:00
>LDYA L.MSG.IPKO
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2018-11-21 13:08:11 +00:00
lda #E.SYN
2021-06-19 17:46:36 +00:00
sec
2018-11-21 13:08:11 +00:00
rts
2019-10-25 15:09:13 +00:00
2018-11-21 13:08:11 +00:00
CS.RUN.IPOK ldy #S.PS.ARGC
2020-02-28 07:21:46 +00:00
lda (pPS),y
2018-11-01 08:53:47 +00:00
bne .1
2019-10-25 15:09:13 +00:00
jmp CS.RUN.DUMP
2019-10-25 15:09:13 +00:00
2018-11-27 14:03:26 +00:00
.1 cmp #2
2018-11-01 08:53:47 +00:00
beq CS.RUN.ADD
2020-01-29 21:20:43 +00:00
>PUSHW L.MSG.USAGE
2018-11-01 08:53:47 +00:00
>PUSHBI 0
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2018-11-01 08:53:47 +00:00
lda #E.SYN
2019-10-03 06:25:27 +00:00
sec
2018-11-01 08:53:47 +00:00
rts
*--------------------------------------
2020-02-14 16:32:52 +00:00
CS.RUN.ADD lda #2
>SYSCALL ArgV
>PUSHYA
>PUSHW L.SSCANF.IP
2021-06-19 17:46:36 +00:00
>PUSHEA.G DST.IP
2020-02-14 16:32:52 +00:00
>PUSHEA.G DST.IP+1
>PUSHEA.G DST.IP+2
>PUSHEA.G DST.IP+3
2019-10-25 15:09:13 +00:00
2018-08-08 15:13:37 +00:00
>PUSHBI 8 4 PTRs
2020-08-17 20:47:31 +00:00
>SYSCALL SScanF
bcs .9
2019-10-25 15:09:13 +00:00
>PUSHEA.G DST.IP
2018-11-15 15:04:14 +00:00
lda #1
2018-10-16 15:48:03 +00:00
>SYSCALL ArgV
>PUSHYA
2020-08-17 20:47:31 +00:00
>LIBCALL hLIBTCPIP,LIBTCPIP.DNS.Add
bcs .99
2019-10-25 15:09:13 +00:00
2021-06-19 17:46:36 +00:00
lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
rts
2018-10-21 20:54:07 +00:00
.9 lda #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
2020-02-28 07:21:46 +00:00
>SYSCALL PutS
2016-03-17 07:31:11 +00:00
lda #K.DNSCACHE.SIZE
2019-10-06 12:50:43 +00:00
sta EntryCount
2016-03-17 07:31:11 +00:00
.1 lda (ZPPTR1)
2018-12-06 11:40:30 +00:00
beq .6
2020-01-29 21:20:43 +00:00
>PUSHW L.MSG1
ldx #0
lda (ZPPTR1) Entry Status
bmi .5
asl
tax
2021-06-19 17:46:36 +00:00
2020-01-29 21:20:43 +00:00
.5 >PUSHW L.MSG1.Status,x
ldy #S.DNSCACHE.ID
>PUSHB (ZPPTR1),y
iny
>PUSHB (ZPPTR1),y
2021-06-19 17:46:36 +00:00
2020-01-29 21:20:43 +00:00
ldy #S.DNSCACHE.hNAME
lda (ZPPTR1),y
2020-01-29 21:20:43 +00:00
>SYSCALL GetMemPtr
>PUSHYA
2020-05-05 20:54:25 +00:00
ldy #S.DNSCACHE.IP
2020-01-29 21:20:43 +00:00
2020-05-05 20:54:25 +00:00
.3 lda (ZPPTR1),y
2016-03-17 07:31:11 +00:00
>PUSHA
2020-05-05 20:54:25 +00:00
iny
cpy #S.DNSCACHE.IP+4
2018-12-06 11:40:30 +00:00
bne .3
2020-01-29 21:20:43 +00:00
ldy #S.DNSCACHE.TTL+4
2020-05-05 20:54:25 +00:00
2020-01-29 21:20:43 +00:00
.2 dey
lda (ZPPTR1),y
2020-01-29 21:20:43 +00:00
>PUSHA
cpy #S.DNSCACHE.TTL
bne .2
2015-10-19 20:35:00 +00:00
2018-12-06 11:40:30 +00:00
>PUSHBI 14
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2018-12-06 11:40:30 +00:00
.6 lda ZPPTR1
clc
adc #S.DNSCACHE
sta ZPPTR1
2018-12-06 11:40:30 +00:00
bcc .7
inc ZPPTR1+1
2021-06-19 17:46:36 +00:00
2019-10-06 12:50:43 +00:00
.7 dec EntryCount
bne .1
2020-08-17 20:47:31 +00:00
lda #0
2018-12-06 11:40:30 +00:00
sec
rts
*--------------------------------------
2017-01-29 21:47:19 +00:00
CS.EVENT sec
rts
*--------------------------------------
CS.QUIT lda hLIBTCPIP
2018-11-12 09:22:06 +00:00
beq .8
2018-07-20 14:10:10 +00:00
>SYSCALL UnloadLib
2018-11-12 09:22:06 +00:00
.8 clc
rts
*--------------------------------------
2021-06-19 17:46:36 +00:00
CS.END
2019-12-03 15:42:17 +00:00
LIBTCPIP .AZ "libtcpip"
2018-11-01 08:53:47 +00:00
hLIBTCPIP .BS 1
2018-11-21 13:08:11 +00:00
MSG.IPKO .AZ "TCP/IP Not Loaded/Configured."
SSCANF.IP .AZ "%d.%d.%d.%d"
2018-12-06 11:40:30 +00:00
MSG0 .AZ "Status TR.ID Hostname IP Address TTL"
MSG1 .AZ "%7s $%H %32s %03d.%03d.%03d.%03d %u\r\n"
MSG1.S .AZ "Static"
MSG1.P .AZ "Pending"
MSG1.D .AZ "Dynamic"
2018-11-01 08:53:47 +00:00
MSG.USAGE .AS "Usage : Add a static entry, DNSINFO <host> <IP>\r\n"
2018-11-15 15:04:14 +00:00
.AZ " Dump DNS Cache, DNSINFO\r\n"
*--------------------------------------
2021-06-17 17:38:34 +00:00
.DUMMY
.OR 0
DS.START
DST.IP .BS 4
2021-06-17 17:38:34 +00:00
DS.END .ED
*--------------------------------------
MAN
2020-08-17 20:47:31 +00:00
SAVE usr/src/bin/dnsinfo.s
ASM