2013-12-27 13:57:56 +00:00
|
|
|
.include "../inc/common.i"
|
|
|
|
.include "../inc/commonprint.i"
|
|
|
|
.include "../inc/net.i"
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
.export start
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import exit_to_basic
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.import dns_set_hostname
|
|
|
|
.import dns_resolve
|
|
|
|
.import dns_ip
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-15 21:50:01 +00:00
|
|
|
|
2014-04-28 16:41:54 +00:00
|
|
|
; keep LD65 happy
|
2016-03-30 14:06:45 +00:00
|
|
|
.segment "INIT"
|
|
|
|
.segment "ONCE"
|
2014-04-28 16:41:54 +00:00
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.segment "STARTUP"
|
|
|
|
|
|
|
|
; switch to lower case charset
|
2013-12-29 22:39:35 +00:00
|
|
|
lda #14
|
|
|
|
jsr print_a
|
2013-12-15 21:50:01 +00:00
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
start:
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_cr
|
2013-12-27 13:57:56 +00:00
|
|
|
init_ip_via_dhcp
|
|
|
|
; jsr overwrite_with_hardcoded_dns_server
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_ip_config
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #hostname_1
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr do_dns_query
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
ldax #hostname_2
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr do_dns_query
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
ldax #hostname_3
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr do_dns_query
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
ldax #hostname_4
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr do_dns_query
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
ldax #hostname_5
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr do_dns_query
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
ldax #hostname_6
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr do_dns_query
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
jmp exit_to_basic
|
|
|
|
|
|
|
|
do_dns_query:
|
|
|
|
pha
|
|
|
|
jsr print
|
|
|
|
lda #' '
|
|
|
|
jsr print_a
|
|
|
|
lda #':'
|
|
|
|
jsr print_a
|
|
|
|
lda #' '
|
|
|
|
jsr print_a
|
|
|
|
pla
|
|
|
|
jsr dns_set_hostname
|
|
|
|
jsr dns_resolve
|
|
|
|
bcc :+
|
|
|
|
ldax #dns_lookup_failed_msg
|
|
|
|
jsr print
|
2017-05-18 21:23:03 +00:00
|
|
|
jmp print_cr
|
2013-12-27 13:57:56 +00:00
|
|
|
: ldax #dns_ip
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_dotted_quad
|
2017-05-18 21:23:03 +00:00
|
|
|
jmp print_cr
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
overwrite_with_hardcoded_dns_server:
|
|
|
|
ldx #3
|
2013-12-27 13:57:56 +00:00
|
|
|
: lda hardcoded_dns_server,x
|
2013-12-13 21:24:03 +00:00
|
|
|
sta cfg_dns,x
|
|
|
|
dex
|
|
|
|
bpl :-
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.rodata
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
hostname_1:
|
2013-12-27 13:57:56 +00:00
|
|
|
.byte "SLASHDOT.ORG",0 ; this should be an A record
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
hostname_2:
|
2013-12-27 13:57:56 +00:00
|
|
|
.byte "VICTA.JAMTRONIX.COM",0 ; this should be a CNAME
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
hostname_3:
|
2013-12-27 13:57:56 +00:00
|
|
|
.byte "WWW.JAMTRONIX.COM",0 ; this should be another CNAME
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
hostname_4:
|
2013-12-27 13:57:56 +00:00
|
|
|
.byte "FOO.BAR.BOGUS",0 ; this should fail
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
hostname_5:
|
|
|
|
.byte "111.22.3.4",0 ; this should work (without hitting dns)
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
hostname_6:
|
|
|
|
.byte "3COM.COM",0 ; make sure doesn't get treated as a number
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
hardcoded_dns_server:
|
2013-12-27 13:57:56 +00:00
|
|
|
; .byte 61,9,195,193
|
|
|
|
; .byte 64,127,100,12
|
|
|
|
.byte 205,171,3,65
|
|
|
|
.byte 69,111,95,106
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-13 16:36:04 +00:00
|
|
|
; -- LICENSE FOR dns.s --
|
2013-12-13 21:24:03 +00:00
|
|
|
; The contents of this file are subject to the Mozilla Public License
|
|
|
|
; Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
; compliance with the License. You may obtain a copy of the License at
|
|
|
|
; http://www.mozilla.org/MPL/
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; Software distributed under the License is distributed on an "AS IS"
|
|
|
|
; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
; License for the specific language governing rights and limitations
|
|
|
|
; under the License.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Original Code is ip65.
|
2013-12-27 13:57:56 +00:00
|
|
|
;
|
2013-12-13 21:24:03 +00:00
|
|
|
; The Initial Developer of the Original Code is Jonno Downes,
|
|
|
|
; jonno@jamtronix.com.
|
|
|
|
; Portions created by the Initial Developer are Copyright (C) 2009
|
2013-12-27 13:57:56 +00:00
|
|
|
; Jonno Downes. All Rights Reserved.
|
2013-12-13 21:24:03 +00:00
|
|
|
; -- LICENSE END --
|