mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-28 10:29:49 +00:00
157 lines
3.1 KiB
Plaintext
157 lines
3.1 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF /A2OSX.BOOT/BIN/DNSINFO
|
||
*--------------------------------------
|
||
.INB /A2OSX.DEV/INC/MACROS.I
|
||
.INB /A2OSX.DEV/INC/A2OSX.I
|
||
.INB /A2OSX.DEV/INC/LIBTCPIP.I
|
||
*--------------------------------------
|
||
ZPPTR1 .EQ ZPBIN
|
||
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
|
||
.DA 0
|
||
.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.IP .DA IP
|
||
L.MSG0 .DA MSG0
|
||
L.MSG1 .DA MSG1
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT >LDYA L.LIBTCPIP
|
||
>SYSCALL LoadLibYA
|
||
sta hLIBTCPIP
|
||
|
||
.8 lda (pPs)
|
||
ora #S.PS.F.EVENT Now accept events
|
||
sta (pPs)
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN >SYSCALL GetArgC
|
||
cmp #1
|
||
beq CS.RUN.DUMP
|
||
|
||
CS.RUN.ADD cmp #3
|
||
bne .9
|
||
|
||
>PUSHW L.IP
|
||
>PUSHW L.SSCANF.IP
|
||
lda #3
|
||
>SYSCALL GetArgA
|
||
>PUSHYA
|
||
>SYSCALL SSCANF
|
||
bcs .9
|
||
|
||
>PUSHW L.IP
|
||
lda #2
|
||
>SYSCALL GetArgA
|
||
>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 #SYSMGR.ERRSYN
|
||
sec
|
||
.99 rts
|
||
|
||
CS.RUN.DUMP >LIBCALL hLIBTCPIP,LIBTCPIP.DNS.GETCACHE
|
||
>STYA ZPPTR1
|
||
>LDYA L.MSG0
|
||
>SYSCALL CPrintFYA
|
||
|
||
lda #K.DNSCACHE.SIZE
|
||
sta EntryCount
|
||
|
||
.1 lda (ZPPTR1)
|
||
beq .2
|
||
|
||
ldy #S.DNSCACHE.TTL+4
|
||
.6 dey
|
||
lda (ZPPTR1),y
|
||
>PUSHA
|
||
cpy #S.DNSCACHE.TTL
|
||
bne .6
|
||
|
||
ldy #S.DNSCACHE.IP+4
|
||
.5 dey
|
||
lda (ZPPTR1),y
|
||
>PUSHA
|
||
cpy #S.DNSCACHE.IP
|
||
bne .5
|
||
|
||
ldy #S.DNSCACHE.hNAME
|
||
lda (ZPPTR1),y
|
||
>SYSCALL GetMemPtrA
|
||
>PUSHYA
|
||
|
||
ldy #S.DNSCACHE.ID
|
||
>PUSHB (ZPPTR1),y
|
||
iny
|
||
>PUSHB (ZPPTR1),y
|
||
|
||
>PUSHB (ZPPTR1) Entry Status
|
||
|
||
>LDYA L.MSG1
|
||
>SYSCALL CPrintFYA
|
||
|
||
.2 lda ZPPTR1
|
||
clc
|
||
adc #S.DNSCACHE
|
||
sta ZPPTR1
|
||
bcc .3
|
||
inc ZPPTR1+1
|
||
|
||
.3 dec EntryCount
|
||
bne .1
|
||
|
||
.8 lda #0 tell TSKMGR that all done ok, but
|
||
sec we do not want to stay in memory
|
||
rts
|
||
*--------------------------------------
|
||
CS.EVENT sec
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hLIBTCPIP
|
||
>SYSCALL UnloadLibA
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
LIBTCPIP >PSTR "libtcpip.o"
|
||
SSCANF.IP >PSTR "%d.%d.%d.%d"
|
||
MSG0 >CSTR "STS TR.ID Hostname IP Address TTL\n"
|
||
MSG1 >CSTR "$%h $%H %32S %03d.%03d.%03d.%03d %L\n"
|
||
hLIBTCPIP .BS 1
|
||
|
||
IP .BS 4
|
||
EntryCount .BS 1
|
||
MAN
|
||
SAVE BIN/DNSINFO.S
|
||
ASM
|