2010-12-10 13:12:18 +00:00
|
|
|
.include "../inc/common.i"
|
|
|
|
.include "../inc/commonprint.i"
|
|
|
|
.include "../inc/net.i"
|
2010-12-28 03:59:36 +00:00
|
|
|
.include "../drivers/w5100.i"
|
|
|
|
|
2010-12-10 13:12:18 +00:00
|
|
|
.import exit_to_basic
|
|
|
|
|
|
|
|
.import cfg_get_configuration_ptr
|
2010-12-28 11:59:56 +00:00
|
|
|
.import copymem
|
|
|
|
.importzp copy_src
|
|
|
|
.importzp copy_dest
|
2010-12-10 13:12:18 +00:00
|
|
|
.import icmp_echo_ip
|
|
|
|
.import icmp_ping
|
|
|
|
.import get_key
|
2010-12-28 11:59:56 +00:00
|
|
|
.import w5100_ip65_init
|
2010-12-28 03:59:36 +00:00
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
.import dns_set_hostname
|
|
|
|
.import dns_resolve
|
|
|
|
.import dns_ip
|
|
|
|
.import dns_status
|
|
|
|
|
2010-12-10 13:12:18 +00:00
|
|
|
|
|
|
|
.segment "STARTUP" ;this is what gets put at the start of the file on the C64
|
|
|
|
|
|
|
|
.word basicstub ; load address
|
|
|
|
|
|
|
|
basicstub:
|
|
|
|
.word @nextline
|
|
|
|
.word 2003
|
|
|
|
.byte $9e
|
|
|
|
.byte <(((init / 1000) .mod 10) + $30)
|
|
|
|
.byte <(((init / 100 ) .mod 10) + $30)
|
|
|
|
.byte <(((init / 10 ) .mod 10) + $30)
|
|
|
|
.byte <(((init ) .mod 10) + $30)
|
|
|
|
.byte 0
|
|
|
|
@nextline:
|
|
|
|
.word 0
|
|
|
|
|
|
|
|
.code
|
|
|
|
|
|
|
|
init:
|
2010-12-28 11:59:56 +00:00
|
|
|
|
2010-12-28 03:59:36 +00:00
|
|
|
; jsr wait_for_keypress
|
2010-12-28 11:59:56 +00:00
|
|
|
ldax #$DE00
|
|
|
|
jsr probe_for_w5100
|
|
|
|
bcc @found
|
|
|
|
ldax #$DF00
|
|
|
|
jsr probe_for_w5100
|
|
|
|
bcc @found
|
|
|
|
ldax #$DF20
|
|
|
|
jsr probe_for_w5100
|
|
|
|
bcc @found
|
|
|
|
ldax #no_wiznet
|
|
|
|
jmp print
|
|
|
|
rts
|
|
|
|
|
|
|
|
@found:
|
|
|
|
jsr dhcp_init
|
|
|
|
|
|
|
|
@skip:
|
|
|
|
|
2010-12-28 03:59:36 +00:00
|
|
|
|
|
|
|
jsr print_ip_config
|
2010-12-28 11:59:56 +00:00
|
|
|
; jsr wait_for_keypress
|
|
|
|
;
|
|
|
|
; rts
|
2010-12-28 03:59:36 +00:00
|
|
|
;
|
|
|
|
; jsr wait_for_keypress
|
|
|
|
; jsr dhcp_init
|
2010-12-15 08:08:47 +00:00
|
|
|
; jsr print_ip_config
|
2010-12-28 11:59:56 +00:00
|
|
|
; print_driver_init
|
|
|
|
; jsr ip65_init
|
|
|
|
; jsr print_cr
|
2010-12-28 03:59:36 +00:00
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
jsr ping_test
|
|
|
|
jsr ping_test_2
|
2010-12-28 03:59:36 +00:00
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
ldax #hostname_1
|
|
|
|
jsr do_dns_query
|
|
|
|
bcs :+
|
|
|
|
jsr ping_test_3
|
2010-12-28 03:59:36 +00:00
|
|
|
:
|
2010-12-28 11:59:56 +00:00
|
|
|
rts
|
|
|
|
|
2010-12-28 03:59:36 +00:00
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
ping_test:
|
|
|
|
ldx #$3
|
2010-12-28 03:59:36 +00:00
|
|
|
:
|
2010-12-28 11:59:56 +00:00
|
|
|
lda dhcp_server,x
|
|
|
|
sta icmp_echo_ip,x
|
|
|
|
dex
|
|
|
|
bpl :-
|
|
|
|
jmp do_ping
|
2010-12-10 13:12:18 +00:00
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
ping_test_2:
|
2010-12-10 13:12:18 +00:00
|
|
|
ldx #$3
|
|
|
|
:
|
|
|
|
lda cfg_gateway,x
|
|
|
|
sta icmp_echo_ip,x
|
|
|
|
dex
|
|
|
|
bpl :-
|
2010-12-28 11:59:56 +00:00
|
|
|
jmp do_ping
|
|
|
|
|
|
|
|
ping_test_3:
|
|
|
|
ldx #$3
|
|
|
|
:
|
|
|
|
lda dns_ip,x
|
|
|
|
sta icmp_echo_ip,x
|
|
|
|
dex
|
|
|
|
bpl :-
|
|
|
|
jmp do_ping
|
|
|
|
|
|
|
|
|
|
|
|
do_ping:
|
2010-12-10 13:12:18 +00:00
|
|
|
ldax #pinging
|
|
|
|
jsr print
|
|
|
|
|
|
|
|
ldax #icmp_echo_ip
|
|
|
|
jsr print_dotted_quad
|
|
|
|
jsr print_cr
|
|
|
|
jsr icmp_ping
|
|
|
|
bcs @error
|
|
|
|
jsr print_integer
|
|
|
|
ldax #ms
|
|
|
|
jsr print
|
|
|
|
rts
|
|
|
|
@error:
|
|
|
|
jmp print_errorcode
|
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
rts
|
2010-12-28 03:59:36 +00:00
|
|
|
|
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
probe_for_w5100:
|
|
|
|
stax w5100_addr
|
|
|
|
ldax #probing
|
|
|
|
jsr print
|
|
|
|
lda w5100_addr+1
|
|
|
|
jsr print_hex
|
|
|
|
lda w5100_addr
|
|
|
|
jsr print_hex
|
2010-12-28 03:59:36 +00:00
|
|
|
jsr print_cr
|
2010-12-28 11:59:56 +00:00
|
|
|
ldax w5100_addr
|
|
|
|
jmp w5100_ip65_init
|
2010-12-28 03:59:36 +00:00
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
wait_for_keypress:
|
2010-12-28 03:59:36 +00:00
|
|
|
lda #0
|
2010-12-28 11:59:56 +00:00
|
|
|
sta $c6 ;set the keyboard buffer to be empty
|
|
|
|
ldax #press_a_key_to_continue
|
|
|
|
jsr print
|
|
|
|
jsr get_key
|
|
|
|
rts
|
2010-12-28 03:59:36 +00:00
|
|
|
|
|
|
|
|
2010-12-10 13:12:18 +00:00
|
|
|
|
2010-12-28 11:59:56 +00:00
|
|
|
do_dns_query:
|
|
|
|
pha
|
|
|
|
jsr print
|
2010-12-10 13:12:18 +00:00
|
|
|
lda #' '
|
|
|
|
jsr print_a
|
2010-12-28 11:59:56 +00:00
|
|
|
lda #':'
|
|
|
|
jsr print_a
|
2010-12-10 13:12:18 +00:00
|
|
|
lda #' '
|
|
|
|
jsr print_a
|
2010-12-28 11:59:56 +00:00
|
|
|
pla
|
|
|
|
jsr dns_set_hostname
|
|
|
|
jsr dns_resolve
|
|
|
|
bcc :+
|
|
|
|
ldax #dns_lookup_failed_msg
|
2010-12-10 13:12:18 +00:00
|
|
|
jsr print
|
2010-12-28 11:59:56 +00:00
|
|
|
sec
|
2010-12-10 13:12:18 +00:00
|
|
|
rts
|
2010-12-28 11:59:56 +00:00
|
|
|
:
|
|
|
|
ldax #dns_ip
|
|
|
|
jsr print_dotted_quad
|
|
|
|
jsr print_cr
|
|
|
|
clc
|
|
|
|
rts
|
|
|
|
|
2010-12-10 13:12:18 +00:00
|
|
|
|
|
|
|
.rodata
|
|
|
|
ms: .byte " MS",13,0
|
2010-12-28 11:59:56 +00:00
|
|
|
pinging: .byte "PINGING ",0
|
2010-12-10 13:12:18 +00:00
|
|
|
hello: .byte "HELLO WORLD!",13,10,0
|
2010-12-28 11:59:56 +00:00
|
|
|
no_wiznet: .byte "NO W5100 FOUND",13,10,0
|
|
|
|
probing: .byte "LOOKING FOR W5100 AT $",0
|
|
|
|
ping_ip: .byte 10,5,1,84
|
|
|
|
hostname_1: .byte "JAMTRONIX.COM",0
|
2010-12-10 13:12:18 +00:00
|
|
|
.bss
|
2010-12-28 11:59:56 +00:00
|
|
|
w5100_addr: .res 2
|
2010-12-28 03:59:36 +00:00
|
|
|
|
|
|
|
|
2010-12-10 13:12:18 +00:00
|
|
|
;-- LICENSE FOR test_ping.s --
|
|
|
|
; 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/
|
|
|
|
;
|
|
|
|
; 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.
|
|
|
|
;
|
|
|
|
; The Original Code is ip65.
|
|
|
|
;
|
|
|
|
; The Initial Developer of the Original Code is Jonno Downes,
|
|
|
|
; jonno@jamtronix.com.
|
|
|
|
; Portions created by the Initial Developer are Copyright (C) 2009
|
|
|
|
; Jonno Downes. All Rights Reserved.
|
|
|
|
; -- LICENSE END --
|