emailler/test/dottedquad.s

112 lines
2.1 KiB
ArmAsm
Raw Normal View History

.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
2013-12-13 21:24:03 +00:00
.import exit_to_basic
2013-12-13 21:24:03 +00:00
.import parse_dotted_quad
.import dotted_quad_value
2013-12-13 21:24:03 +00:00
.segment "STARTUP"
2013-12-13 21:24:03 +00:00
; switch to lower case charset
lda #23
sta $d018
2013-12-13 21:24:03 +00:00
jsr print_cr
2013-12-13 21:24:03 +00:00
ldax #dotted_quad_1
jsr test_dotted_quad_string
2013-12-13 21:24:03 +00:00
ldax #dotted_quad_2
jsr test_dotted_quad_string
2013-12-13 21:24:03 +00:00
ldax #dotted_quad_3
jsr test_dotted_quad_string
2013-12-13 21:24:03 +00:00
ldax #dotted_quad_4
jsr test_dotted_quad_string
2013-12-13 21:24:03 +00:00
ldax #dotted_quad_5
jsr test_dotted_quad_string
2013-12-13 21:24:03 +00:00
ldax #dotted_quad_6
jsr test_dotted_quad_string
2013-12-13 21:24:03 +00:00
ldax #dotted_quad_7
jsr test_dotted_quad_string
2013-12-13 21:24:03 +00:00
jmp exit_to_basic
test_dotted_quad_string:
stax temp_ax
2013-12-13 21:24:03 +00:00
jsr print
lda #':'
jsr print_a
lda #' '
jsr print_a
ldax temp_ax
jsr parse_dotted_quad
2013-12-13 21:24:03 +00:00
bcs @error
ldax #dotted_quad_value
jsr print_dotted_quad
jsr print_cr
rts
@error:
ldax #failed_msg
2013-12-13 21:24:03 +00:00
jsr print
jsr print_cr
rts
.bss
2013-12-13 21:24:03 +00:00
temp_ax: .res 2
.rodata
2013-12-13 21:24:03 +00:00
dotted_quad_1:
.byte "1.1.1.1",0 ; should work
2013-12-13 21:24:03 +00:00
dotted_quad_2:
.byte "GOOBER",0 ; should fail
2013-12-13 21:24:03 +00:00
dotted_quad_3:
.byte "255.255.255.0",0 ; should work
2013-12-13 21:24:03 +00:00
dotted_quad_4:
.byte "111.222.333.444",0 ; should fail
dotted_quad_5:
.byte "111.22.3",0 ; should fail
2013-12-13 21:24:03 +00:00
dotted_quad_6:
.byte "111.22.3.4",0 ; should work
2013-12-13 21:24:03 +00:00
dotted_quad_7:
.byte "3.4.5.6X",0 ; should fail
2013-12-13 21:24:03 +00:00
; -- LICENSE FOR testdottedquad.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 --