mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
179 lines
2.5 KiB
Plaintext
179 lines
2.5 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
HST.GETBYNAME >PULLW ZPPtrDNS
|
||
>PULLW ZPPtrIP
|
||
jsr HST.ScanIP
|
||
bcc .1
|
||
jsr DNS.QUERY.I
|
||
bcs .9
|
||
>LDYA TmpBuffer256
|
||
>STYA ZPPtrMAC
|
||
.1 jmp ARP.QUERY.I
|
||
.9 rts
|
||
*--------------------------------------
|
||
HST.GETBYADDR >PULLW ZPPtrIP
|
||
>PULLW ZPPtrDNS
|
||
|
||
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
HST.DNS2PSTR >PULLW ZPPtrDNS
|
||
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
HST.PSTR2DNS >PULLW ZPPtrDNS
|
||
|
||
HST.PSTR2DNS.I lda (ZPPtrDNS)
|
||
beq .9
|
||
|
||
cmp #K.DNS.MAXLEN-1
|
||
bcs .9
|
||
|
||
tay
|
||
|
||
inc
|
||
sta DNS.HostNameLen
|
||
|
||
lda #0 Ending 0
|
||
sta DNS.HostName+1,y
|
||
|
||
ldx #0
|
||
|
||
.1 lda (ZPPtrDNS),y
|
||
and #$7f
|
||
cmp #'.'
|
||
beq .2
|
||
|
||
cmp #'A'
|
||
bcc .10
|
||
cmp #'Z'+1
|
||
bcs .10
|
||
adc #$20
|
||
|
||
.10 inx
|
||
bra .3
|
||
|
||
.2 txa
|
||
ldx #0
|
||
|
||
.3 sta DNS.HostName,y
|
||
dey
|
||
bne .1
|
||
stx DNS.HostName
|
||
|
||
clc
|
||
rts
|
||
|
||
.9 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 LIB/LIBTCPIP.S.HST
|
||
LOAD LIB/LIBTCPIP.S
|
||
ASM
|