A2osX/LIB/LIBTCPIP.S.HST.txt
2017-03-30 08:31:12 +02:00

125 lines
1.8 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.BUILD
LOMEM $A00
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
HST.GetByName >PULLW ZPPtrDNS
>PULLW ZPPtrIP
jsr HST.ScanIP
bcc .9
jmp DNS.QUERY.I
.9 rts
*--------------------------------------
HST.GetByAddr >PULLW ZPPtrIP
>PULLW ZPPtrDNS
sec
rts
*--------------------------------------
HST.ScanIP stz HST.IP
lda (ZPPtrDNS)
beq .9
ldy #0
.1 ldx #0
stx HST.DecStr
.2 tya
cmp (ZPPtrDNS)
beq .4
iny
lda (ZPPtrDNS),y
cmp #'.'
beq .3
cmp #'0'
bcc .9
cmp #'9'+1
bcs .9
cpx #3
beq .9
inx
sta HST.DecStr,x
bra .2
.3 stx HST.DecStr
phy
jsr HST.Dec2Hex
ply
bcc .1
rts
.4 txa
beq .5
stx HST.DecStr
jsr HST.Dec2Hex
bcs .9
.5 ldx HST.IP
cpx #4
bne .9
ldy #3
.6 lda HST.IP,x
sta (ZPPtrIP),y
dex
dey
bpl .6
clc
rts
.9 sec
rts
*--------------------------------------
HST.Dec2Hex ldy HST.DecStr
beq .9
ldx HST.IP
cpx #4
beq .9
inx
lda HST.DecStr+1
and #$0f
sta HST.IP,x
ldy #1
.1 cpy HST.DecStr
beq .8
iny
lda HST.IP,x
asl HST.IP,x
bcs .9
asl HST.IP,x
bcs .9
adc HST.IP,x
bcs .9
asl
bcs .9
sta HST.IP,x
lda HST.DecStr,y
and #$0f
adc HST.IP,x
sta HST.IP,x
bcc .1
.9 sec
rts
.8 stx HST.IP
clc
rts
*--------------------------------------
MAN
SAVE /A2OSX.SRC/LIB/LIBTCPIP.S.HST
LOAD /A2OSX.SRC/LIB/LIBTCPIP.S
ASM