emailler/test/ping.s

90 lines
1.7 KiB
ArmAsm
Raw Normal View History

.include "../inc/common.inc"
.include "../inc/commonprint.inc"
.include "../inc/net.inc"
.export start
.import exit_to_basic
.import copymem
.importzp copy_src
.importzp copy_dest
.import icmp_echo_ip
.import icmp_ping
2014-04-28 16:41:54 +00:00
; keep LD65 happy
.segment "INIT"
.segment "ONCE"
2014-04-28 16:41:54 +00:00
.segment "STARTUP"
; switch to lower case charset
lda #14
jsr print_a
start:
2013-12-13 21:24:03 +00:00
jsr print_cr
init_ip_via_dhcp
2013-12-13 21:24:03 +00:00
jsr print_ip_config
jsr print_cr
; our default gateway is probably a safe thing to ping
2013-12-13 21:24:03 +00:00
ldx #$3
: lda cfg_gateway,x
2013-12-13 21:24:03 +00:00
sta icmp_echo_ip,x
dex
bpl :-
2013-12-13 21:24:03 +00:00
ldax #pinging
jsr print
2013-12-13 21:24:03 +00:00
ldax #icmp_echo_ip
jsr print_dotted_quad
jsr print_cr
jsr icmp_ping
bcs @error
jsr print_integer
ldax #ms
jsr print
jmp exit_to_basic
2013-12-13 21:24:03 +00:00
@error:
jsr print_errorcode
jmp exit_to_basic
.rodata
ms: .byte " MS",13,0
2013-12-13 21:24:03 +00:00
pinging: .byte "PINGING ",0
.bss
2013-12-13 21:24:03 +00:00
block_number: .res 1
block_length: .res 2
buffer1: .res 256
buffer2: .res 256
2013-12-13 21:24:03 +00:00
2014-04-13 16:36:04 +00:00
; -- LICENSE FOR ping.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-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-13 21:24:03 +00:00
; The Original Code is ip65.
;
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
; Jonno Downes. All Rights Reserved.
2013-12-13 21:24:03 +00:00
; -- LICENSE END --