A2osX/LIB/LIBTCPIP.S.HST.txt

121 lines
1.7 KiB
Plaintext
Raw Normal View History

2017-12-22 21:24:30 +00:00
NEW
PREFIX /A2OSX.BUILD
2017-12-22 21:24:30 +00:00
AUTO 4,1
.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 #$ff
.1 ldx #0
stx HST.DecStr
.2 iny
lda (ZPPtrDNS),y
beq .4
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