2018-02-23 15:36:05 +00:00
|
|
|
.include "../inc/common.inc"
|
|
|
|
.include "../inc/commonprint.inc"
|
|
|
|
.include "../inc/net.inc"
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
.export start
|
|
|
|
|
|
|
|
.import exit_to_basic
|
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
.import print_a
|
|
|
|
.import get_key
|
|
|
|
.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
|
|
|
|
.import url_download
|
|
|
|
.import url_download_buffer
|
|
|
|
.import url_download_buffer_length
|
|
|
|
|
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
|
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"
|
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
|
|
|
|
2015-08-28 13:19:52 +00:00
|
|
|
start:
|
|
|
|
jsr print_cr
|
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
|
|
|
|
jsr test_url_download
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax #url_2
|
|
|
|
; jsr test_url_download
|
2015-08-28 13:19:52 +00:00
|
|
|
|
|
|
|
jmp exit_to_basic
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
test_url_download:
|
|
|
|
stax temp_url_ptr
|
|
|
|
ldax #downloading
|
|
|
|
jsr print
|
|
|
|
ldax temp_url_ptr
|
|
|
|
jsr print
|
|
|
|
jsr print_cr
|
|
|
|
ldax #dl_buffer
|
|
|
|
stax url_download_buffer
|
|
|
|
ldax #dl_buffer_length
|
|
|
|
stax url_download_buffer_length
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax temp_url_ptr
|
|
|
|
jsr url_download
|
|
|
|
bcc :+
|
|
|
|
jmp print_errorcode
|
2013-12-27 13:57:56 +00:00
|
|
|
: ldax #dl_buffer
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr parser_init
|
2013-12-27 13:57:56 +00:00
|
|
|
@next_title:
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #title
|
|
|
|
jsr parser_skip_next
|
|
|
|
bcs @done
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_tag_contents
|
|
|
|
jsr print_cr
|
2013-12-27 13:57:56 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
jmp @next_title
|
|
|
|
@done:
|
|
|
|
rts
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
wait_key:
|
|
|
|
ldax #press_a_key
|
|
|
|
jsr print
|
|
|
|
jmp get_key
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.data
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
title:
|
|
|
|
.byte "<title>",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
url_1:
|
|
|
|
.byte "http://static.cricinfo.com/rss/livescores.xml",0
|
|
|
|
url_2:
|
|
|
|
.byte "http://search.twitter.com/search.atom?q=kipper",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
downloading:
|
|
|
|
.asciiz "DOWNLOADING "
|
|
|
|
press_a_key:
|
|
|
|
.byte "PRESS ANY KEY TO CONTINUE",13,0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.bss
|
2013-12-19 21:04:19 +00:00
|
|
|
|
|
|
|
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-27 13:57:56 +00:00
|
|
|
dl_buffer_length = 8092
|
2013-12-13 21:24:03 +00:00
|
|
|
dl_buffer: .res dl_buffer_length
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-13 16:36:04 +00:00
|
|
|
; -- LICENSE FOR geturl.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 --
|