2013-12-13 21:24:03 +00:00
|
|
|
.include "../inc/common.i"
|
|
|
|
.include "../inc/commonprint.i"
|
|
|
|
.include "../inc/net.i"
|
|
|
|
|
|
|
|
.import print_a
|
|
|
|
.import get_key
|
|
|
|
.import cfg_get_configuration_ptr
|
|
|
|
.import ascii_to_native
|
|
|
|
.import parser_init
|
|
|
|
.import parser_skip_next
|
|
|
|
.importzp copy_src
|
|
|
|
.importzp copy_dest
|
2013-12-19 21:04:19 +00:00
|
|
|
.import url_ip
|
|
|
|
.import url_port
|
|
|
|
.import url_selector
|
2013-12-13 21:24:03 +00:00
|
|
|
.import url_resource_type
|
|
|
|
.import url_parse
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
temp_buff = copy_dest
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
2014-04-28 16:41:54 +00:00
|
|
|
; keep LD65 happy
|
|
|
|
.segment "ZPSAVE"
|
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.segment "STARTUP"
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
; switch to lower case charset
|
2013-12-29 22:39:35 +00:00
|
|
|
lda #14
|
|
|
|
jsr print_a
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
init_ip_via_dhcp
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_ip_config
|
|
|
|
|
|
|
|
ldax #url_1
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr wait_key
|
|
|
|
|
|
|
|
ldax #url_2
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_3
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_4
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr wait_key
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_5
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_6
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_7
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
|
|
|
ldax #url_8
|
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr wait_key
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_9
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_a
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_b
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #url_c
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr test_url_parse
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr wait_key
|
|
|
|
|
|
|
|
ldax #atom_file
|
|
|
|
jsr parser_init
|
2013-12-27 13:57:56 +00:00
|
|
|
|
|
|
|
; ldax #entry
|
|
|
|
; jsr parser_skip_next
|
|
|
|
; bcs @done
|
|
|
|
|
2013-12-19 21:04:19 +00:00
|
|
|
@next_title:
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #title
|
|
|
|
jsr parser_skip_next
|
|
|
|
bcs @done
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_tag_contents
|
|
|
|
jsr print_cr
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
jmp @next_title
|
|
|
|
@done:
|
|
|
|
rts
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
test_url_parse:
|
|
|
|
stax temp_url_ptr
|
|
|
|
ldax #parsing
|
|
|
|
jsr print
|
|
|
|
ldax temp_url_ptr
|
|
|
|
jsr print
|
|
|
|
jsr print_cr
|
|
|
|
ldax temp_url_ptr
|
|
|
|
jsr url_parse
|
|
|
|
bcc :+
|
|
|
|
jmp print_errorcode
|
2013-12-27 13:57:56 +00:00
|
|
|
: stax selector_ptr
|
2013-12-13 21:24:03 +00:00
|
|
|
jmp print_parsed_url
|
|
|
|
|
|
|
|
print_tag_contents:
|
|
|
|
stax temp_buff
|
|
|
|
lda #0
|
|
|
|
sta string_offset
|
2013-12-27 13:57:56 +00:00
|
|
|
@next_byte:
|
2013-12-13 21:24:03 +00:00
|
|
|
ldy string_offset
|
|
|
|
lda (temp_buff),y
|
|
|
|
beq @done
|
|
|
|
cmp #'<'
|
|
|
|
beq @done
|
|
|
|
jsr ascii_to_native
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr print_a
|
2013-12-13 21:24:03 +00:00
|
|
|
inc string_offset
|
2013-12-27 13:57:56 +00:00
|
|
|
beq @done
|
2013-12-13 21:24:03 +00:00
|
|
|
jmp @next_byte
|
|
|
|
@done:
|
|
|
|
rts
|
|
|
|
|
|
|
|
print_parsed_url:
|
|
|
|
ldax #ip
|
|
|
|
jsr print
|
|
|
|
ldax #url_ip
|
|
|
|
jsr print_dotted_quad
|
|
|
|
ldax #port
|
|
|
|
jsr print
|
|
|
|
ldax url_port
|
|
|
|
jsr print_integer
|
|
|
|
ldax #type
|
|
|
|
jsr print
|
|
|
|
lda url_resource_type
|
|
|
|
jsr print_a
|
|
|
|
jsr print_cr
|
|
|
|
ldax #selector
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr print
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax selector_ptr
|
|
|
|
jsr print
|
|
|
|
jmp print_cr
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
wait_key:
|
|
|
|
ldax #press_a_key
|
|
|
|
jsr print
|
|
|
|
jmp get_key
|
2013-12-19 21:04:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
.bss
|
|
|
|
|
|
|
|
string_offset: .res 1
|
2013-12-27 13:57:56 +00:00
|
|
|
selector_ptr: .res 2
|
|
|
|
temp_url_ptr: .res 2
|
2013-12-19 21:04:19 +00:00
|
|
|
|
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
.data
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
entry:
|
|
|
|
.byte "<entry>",0
|
|
|
|
title:
|
|
|
|
.byte "<title>",0
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_1:
|
|
|
|
.byte "http://www.jamtronix.com/",13,"not part of URL!",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_2:
|
|
|
|
.byte "http://www.jamtronix.com/goober",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_3:
|
|
|
|
.byte "http://www.jamtronix.com:8080/foo",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_4:
|
|
|
|
.byte "gopher://gopher.floodgap.com/",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_5:
|
|
|
|
.byte "gopher://10.5.1.164/0goober",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_6:
|
|
|
|
.byte "gopher://gopher.floodgap.com:7070/7/goober",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_7:
|
|
|
|
.byte "www.jamtronix.com",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_8:
|
|
|
|
.byte "jamtronix.com:70",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_9:
|
|
|
|
.byte "gopher.floodgap.com",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_a:
|
|
|
|
.byte "10.5.1.123:70",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_b:
|
|
|
|
.byte "gopher.floodgap.com:80",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_c:
|
|
|
|
.byte "gopher.floodgap.com:70",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
parsing:
|
|
|
|
.asciiz "PARSING "
|
|
|
|
ip:
|
|
|
|
.asciiz "IP: "
|
|
|
|
port:
|
|
|
|
.asciiz " PORT: "
|
|
|
|
type:
|
|
|
|
.asciiz " TYPE:"
|
|
|
|
selector:
|
|
|
|
.asciiz "SELECTOR: "
|
|
|
|
press_a_key:
|
|
|
|
.byte "PRESS ANY KEY TO CONTINUE",13,0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
atom_file:
|
2013-12-27 13:57:56 +00:00
|
|
|
; .incbin "atom_test.xml"
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
.byte 0
|
|
|
|
|
|
|
|
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2014-04-13 16:36:04 +00:00
|
|
|
; -- LICENSE FOR parser.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 --
|