git-svn-id: http://svn.code.sf.net/p/netboot65/code@174 93682198-c243-4bdb-bd91-e943c89aac3b

This commit is contained in:
jonnosan 2009-08-11 11:32:06 +00:00
parent cef3c75c59
commit 313c930a09
15 changed files with 855 additions and 39 deletions

View File

@ -1,3 +1,5 @@
.ifndef COMMON__I__
COMMON__I__ = 1
; load A/X macro
.macro ldax arg
.if (.match (.left (1, arg), #)) ; immediate mode
@ -26,4 +28,6 @@
pla
tax
pla
.endmacro
.endmacro
.endif

View File

@ -123,5 +123,6 @@ NB65_ERROR_NO_SUCH_LISTENER EQU $88
NB65_ERROR_CONNECTION_RESET_BY_PEER EQU $89
NB65_ERROR_CONNECTION_CLOSED EQU $8A
NB65_ERROR_FILE_ACCESS_FAILURE EQU $90
NB65_MALFORMED_URL EQU $A0
NB65_ERROR_OPTION_NOT_SUPPORTED EQU $FE
NB65_ERROR_FUNCTION_NOT_SUPPORTED EQU $FF

View File

@ -26,6 +26,8 @@ ETHOBJS= \
dottedquad.o \
output_buffer.o\
tftp.o \
parser.o \
string_utils.o \
telnet.o \
arithmetic.o\

View File

@ -126,8 +126,12 @@ dns_set_hostname:
@next_hostname_byte:
lda (dns_hostname),y ;get next char in hostname
cmp #0 ;are we at the end of the string?
beq @end_of_hostname
cmp #'/' ; allow hostnames to be terminated by "/" or ":" to help with URL parsing
beq @end_of_hostname
cmp #':'
bne :+
@end_of_hostname:
inc hostname_copied
bne @set_length_of_last_label
:

View File

@ -523,45 +523,15 @@ ip_configured:
cpy #NB65_INPUT_PORT_NUMBER
bne :+
.import mul_8_16
.importzp acc16
ldy #5 ;max chars
ldax #filter_number
jsr get_filtered_input
bcs @no_port_entered
;AX now points a string containing port number
stax buffer_ptr
lda #0
sta port_number
sta port_number+1
tay
@parse_port:
lda (buffer_ptr),y
cmp #$1F
bcc @end_of_port ;any control char should be treated as end of port field
ldax port_number
stax acc16
lda #10
jsr mul_8_16
ldax acc16
stax port_number
lda (buffer_ptr),y
sec
sbc #'0'
clc
adc port_number
sta port_number
bcc @no_rollover
inc port_number+1
@no_rollover:
iny
bne @parse_port
@end_of_port:
ldax port_number
clc
;AX now points a string containing port number
.import parse_integer
jmp parse_integer
@no_port_entered:
rts
:

View File

@ -2,6 +2,6 @@
;global scratch buffer that DHCP/DNS/TFTP and others can use while building outbound packets.
;you need to be careful if using this that you don't call a function that also uses it.
;if this is reversed for higher level protocols, the likelyhood of collision is low.
;if this is reserved for higher level protocols, the likelyhood of collision is low.
.export output_buffer
output_buffer: .res 520

80
client/ip65/parser.s Normal file
View File

@ -0,0 +1,80 @@
;text file parsing routines
; first call parser_init
; then call parser_skip_next
.export parser_init
.export parser_skip_next
.importzp copy_src
.importzp copy_dest
target_string=copy_src
search_string=copy_dest
.include "../inc/common.i"
.ifndef NB65_API_VERSION_NUMBER
.define EQU =
.include "../inc/nb65_constants.i"
.endif
.bss
int_value: .res 2
.data
get_next_byte:
current_string_ptr=get_next_byte+1
lda $ffff
inc current_string_ptr
bne :+
inc current_string_ptr+1
:
pha
pla ;reload A so flags are set correctly
rts
.code
;set up a string for parsing
;inputs: AX = pointer to (null terminated) string to be parsed
;outputs: none
parser_init:
stax current_string_ptr
clc
rts
;advance pointer along till just past the next occurance of specified string
;inputs: AX= pointer to (null terminated) string to search for
;outputs: sec if search string not found
; if clc, AX = pointer to first byte after string specified
parser_skip_next:
stax search_string
@check_string:
ldy #0
ldax current_string_ptr
stax target_string
@check_next_char:
lda (search_string),y
beq @matched
cmp (target_string),y
bne @not_matched
iny
bne @check_next_char
@matched:
;now skip 'y' bytes
@skip_byte:
jsr get_next_byte
dey
bne @skip_byte
ldax current_string_ptr
clc
rts
@not_matched:
jsr get_next_byte
bne @check_string
ldax search_string
sec
rts

View File

@ -0,0 +1,57 @@
;text file parsing routines
; first call parser_init
; then call parser_skip_next
.export parse_integer
.importzp copy_dest
.import mul_8_16
.importzp acc16
target_string=copy_dest
.include "../inc/common.i"
.bss
int_value: .res 2
.code
;parses a string, returns integer (up to 16 bits)
;inputs: AX points to a string containing an integer
;outputs: AX contains integer
parse_integer:
stax target_string
lda #0
sta int_value
sta int_value+1
tay
@parse_int:
lda (target_string),y
cmp #$30
bcc @end_of_int ;any non-decimal char should be treated as end of integer
cmp #$39
bcs @end_of_int ;any non-decimal char should be treated as end of integer
ldax int_value
stax acc16
lda #10
jsr mul_8_16
ldax acc16
stax int_value
lda (target_string),y
sec
sbc #'0'
clc
adc int_value
sta int_value
bcc @no_rollover
inc int_value+1
@no_rollover:
iny
bne @parse_int
@end_of_int:
ldax int_value
clc
rts

190
client/ip65/url.s Normal file
View File

@ -0,0 +1,190 @@
;routine for parsing a URL
.include "../inc/common.i"
.ifndef NB65_API_VERSION_NUMBER
.define EQU =
.include "../inc/nb65_constants.i"
.endif
.import output_buffer
.importzp copy_src
.importzp copy_dest
.import parser_init
.import parser_skip_next
.import dns_set_hostname
.import dns_resolve
.import parse_integer
.import dns_ip
.export url_ip
.export url_port
.export url_selector
target_string=copy_src
search_string=copy_dest
selector_buffer=output_buffer
.bss
url_string: .res 2
url_ip: .res 4 ;will be set with ip address of host in url
url_port: .res 2 ;will be set with port number of url
url_selector: .res 2 ;will be set with address of selector part of URL
url_type: .res 1
url_type_unknown=0
url_type_gopher=1
url_type_http=2
src_ptr: .res 1
dest_ptr: .res 1
.code
;parses a URL into a form that makes it easy to retrieve the specified resource
;inputs:
;AX = address of URL string
;outputs:
; sec if a malformed url, otherwise:
; url_ip = ip address of host in url
; url_port = port number of url
; url_selector= address of selector part of URL
url_parse:
stax url_string
ldy #0
sty url_type
sty url_port
sty url_port+1
jsr skip_to_hostname
bcc :+
ldax url_string
jmp @no_protocol_specifier
:
ldax url_string
stax search_string
lda (search_string),y
cmp #'g'
beq @gopher
cmp #'G'
beq @gopher
cmp #'h'
beq @http
cmp #'H'
beq @http
@exit_with_error:
lda #NB65_MALFORMED_URL
sta ip65_error
@exit_with_sec:
sec
rts
@http:
lda #url_type_http
sta url_type
lda #80
sta url_port
jmp @protocol_set
@gopher:
lda #url_type_gopher
sta url_type
lda #70
sta url_port
@protocol_set:
jsr skip_to_hostname
;now pointing at hostname
bcs @exit_with_error
@no_protocol_specifier:
jsr dns_set_hostname
bcs @exit_with_sec
jsr dns_resolve
bcs @exit_with_sec
;copy IP address
ldx #3
:
lda dns_ip,x
sta url_ip,x
dex
bpl :-
jsr skip_to_hostname
bcc :+
ldax url_string
jsr parser_init
:
;skip over next colon
ldax #colon
jsr parser_skip_next
bcs @no_port_in_url
;AX now point at first thing past a colon - should be a number:
jsr parse_integer
stax url_port
@no_port_in_url:
;skip over next slash
ldax #slash
jsr parser_skip_next
;AX now pointing at selector
stax copy_src
ldax #selector_buffer
stax copy_dest
lda #0
sta src_ptr
sta dest_ptr
lda url_type
cmp #url_type_unknown
beq @done
cmp #url_type_http
bne @no_get_at_start_of_selector
ldy #3
sty dest_ptr
:
lda get,y
sta (copy_dest),y
dey
bpl :-
@no_get_at_start_of_selector:
inc dest_ptr
lda #'/'
jmp @save_first_byte_of_selector
@copy_one_byte:
ldy src_ptr
lda (copy_src),y
beq @end_of_selector
inc src_ptr
@save_first_byte_of_selector:
ldy dest_ptr
sta (copy_dest),y
inc dest_ptr
bne @copy_one_byte
@end_of_selector:
ldy dest_ptr
lda #$0d
sta (copy_dest),y
iny
lda #$0a
sta (copy_dest),y
iny
@done:
lda #$00
sta (copy_dest),y
ldax #selector_buffer
clc
rts
skip_to_hostname:
ldax url_string
jsr parser_init
ldax #colon_slash_slash
jmp parser_skip_next
get: .byte "GET "
colon_slash_slash: .byte ":/"
slash: .byte "/",0
colon: .byte ":",0

67
client/kipper/a2_gopher.s Normal file
View File

@ -0,0 +1,67 @@
;Apple 2 gopher browser
;july 2009 - jonno @ jamtronix.com
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../inc/net.i"
.include "../inc/a2keycodes.i"
; .include "../inc/c64keycodes.i"
KEY_NEXT_PAGE=$8E ; ^N
KEY_PREV_PAGE=$90; ^P
KEY_SHOW_HISTORY=$93; ^S
KEY_BACK_IN_HISTORY=$82 ; ^B
KEY_NEW_SERVER=$89 ;TAB key
.include "../inc/gopher.i"
.import __CODE_LOAD__
.import __CODE_SIZE__
.import __RODATA_SIZE__
.import __DATA_SIZE__
.import get_key
.segment "EXEHDR" ;this is what gets put an the start of the file on the Apple 2
.addr __CODE_LOAD__-3 ; Start address
.word __CODE_SIZE__+__RODATA_SIZE__+__DATA_SIZE__+4 ; Size
jmp init
.code
init:
jsr cls
jsr $c300 ; go to 80 column mode
ldax #title
jsr print
jsr print_cr
init_ip_via_dhcp
jsr print_ip_config
ldax #initial_location
sta resource_pointer_lo
stx resource_pointer_hi
ldx #0
jsr select_resource_from_current_directory
exit_gopher:
jmp $e000
; rts
.rodata
title:
.byte " GOPHER ][",13," jonno@jamtronix.com",13,0
resolving:
.byte "RESOLVING ",0
initial_location:
.byte "1gopher.floodgap.com",$09,"/",$09,"gopher.floodgap.com",$09,"70",$0D,$0A,0

View File

@ -665,7 +665,7 @@ exit_gopher:
.rodata
netboot65_msg:
.byte 13," NETBOOT65 FOR C64 - VERSION "
.byte 13,"NB65 - VERSION "
.include "nb65_version.i"
.byte 13,0
main_menu_msg:

View File

@ -30,6 +30,7 @@ all: \
testdottedquad.pg2\
testdottedquad.prg\
test_tcp.prg \
test_parser.prg \
%.o: %.c
$(CC) -c $(CFLAGS) $<

242
client/test/atom_test.xml Normal file
View File

@ -0,0 +1,242 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:google="http://base.google.com/ns/1.0" xml:lang="en-US" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom" xmlns:twitter="http://api.twitter.com/">
<id>tag:search.twitter.com,2005:search/#c64</id>
<link type="text/html" rel="alternate" href="http://search.twitter.com/search?q=%23c64"/>
<link type="application/atom+xml" rel="self" href="http://search.twitter.com/search.atom?q=%23c64"/>
<title>#c64 - Twitter Search</title>
<link type="application/opensearchdescription+xml" rel="search" href="http://search.twitter.com/opensearch.xml"/>
<link type="application/atom+xml" rel="refresh" href="http://search.twitter.com/search.atom?q=%23c64&amp;since_id=3222849162"/>
<twitter:warning>since_id removed for pagination.</twitter:warning>
<updated>2009-08-10T10:03:59Z</updated>
<openSearch:itemsPerPage>15</openSearch:itemsPerPage>
<link type="application/atom+xml" rel="next" href="http://search.twitter.com/search.atom?max_id=3222849162&amp;page=2&amp;q=%23c64"/>
<entry>
<id>tag:search.twitter.com,2005:3222849162</id>
<published>2009-08-10T10:03:59Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/aka_obi/statuses/3222849162"/>
<title>Lately I edited a Firebird music compilation. You can play it by using this player here. Please listen. http://bit.ly/DF8zQ #c64 #chiptune</title>
<content type="html">Lately I edited a Firebird music compilation. You can play it by using this player here. Please listen. &lt;a href="http://bit.ly/DF8zQ"&gt;http://bit.ly/DF8zQ&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23chiptune"&gt;#chiptune&lt;/a&gt;</content>
<updated>2009-08-10T10:03:59Z</updated>
<link type="image/png" rel="image" href="http://static.twitter.com/images/default_profile_normal.png"/>
<twitter:source>&lt;a href="http://twitter.com/"&gt;web&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>aka_obi (akaobi)</name>
<uri>http://twitter.com/aka_obi</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3222793961</id>
<published>2009-08-10T09:57:28Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/aka_obi/statuses/3222793961"/>
<title>Lately I edited a Firebird music compilation. You can play it by using this player here. Have fun. http://bit.ly/DF8zQ #c64 #chiptune</title>
<content type="html">Lately I edited a Firebird music compilation. You can play it by using this player here. Have fun. &lt;a href="http://bit.ly/DF8zQ"&gt;http://bit.ly/DF8zQ&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23chiptune"&gt;#chiptune&lt;/a&gt;</content>
<updated>2009-08-10T09:57:28Z</updated>
<link type="image/png" rel="image" href="http://static.twitter.com/images/default_profile_normal.png"/>
<twitter:source>&lt;a href="http://twitter.com/"&gt;web&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>aka_obi (akaobi)</name>
<uri>http://twitter.com/aka_obi</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3221757110</id>
<published>2009-08-10T07:30:45Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/chiptune/statuses/3221757110"/>
<title>is listening SID music on the iPhone! http://iphone.vanille.de/sidplayer/ #c64 #sid #iphone #chipmusic #8bit</title>
<content type="html">is listening SID music on the iPhone! &lt;a href="http://iphone.vanille.de/sidplayer/"&gt;http://iphone.vanille.de/sidplayer/&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23sid"&gt;#sid&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23iphone"&gt;#iphone&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23chipmusic"&gt;#chipmusic&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%238bit"&gt;#8bit&lt;/a&gt;</content>
<updated>2009-08-10T07:30:45Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/86599886/gameboy_normal.jpg"/>
<twitter:source>&lt;a href="http://twitter.com/"&gt;web&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>chiptune (rez)</name>
<uri>http://twitter.com/chiptune</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3205731747</id>
<published>2009-08-09T10:16:06Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/wurstgranate/statuses/3205731747"/>
<title>Wenn man fr&#252;her auf dem C64 nur mit S-Mon geproggt hat, dann ist das ScienceFiction! http://bit.ly/RuhAh
#c64</title>
<content type="html">Wenn man fr&#252;her auf dem C64 nur mit S-Mon geproggt hat, dann ist das ScienceFiction! &lt;a href="http://bit.ly/RuhAh"&gt;http://bit.ly/RuhAh&lt;/a&gt;
&lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt;</content>
<updated>2009-08-09T10:16:06Z</updated>
<link type="image/png" rel="image" href="http://static.twitter.com/images/default_profile_normal.png"/>
<twitter:source>&lt;a href="http://thecosmicmachine.com/eventbox/"&gt;EventBox&lt;/a&gt;</twitter:source>
<twitter:lang>de</twitter:lang>
<author>
<name>wurstgranate (Wurstgranate)</name>
<uri>http://twitter.com/wurstgranate</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3205709954</id>
<published>2009-08-09T10:13:18Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/wurstgranate/statuses/3205709954"/>
<title>http://bit.ly/RuhAh
#c64</title>
<content type="html">&lt;a href="http://bit.ly/RuhAh"&gt;http://bit.ly/RuhAh&lt;/a&gt;
&lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt;</content>
<updated>2009-08-09T10:13:18Z</updated>
<link type="image/png" rel="image" href="http://static.twitter.com/images/default_profile_normal.png"/>
<twitter:source>&lt;a href="http://thecosmicmachine.com/eventbox/"&gt;EventBox&lt;/a&gt;</twitter:source>
<twitter:lang></twitter:lang>
<author>
<name>wurstgranate (Wurstgranate)</name>
<uri>http://twitter.com/wurstgranate</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3205118149</id>
<published>2009-08-09T08:59:41Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/grabule/statuses/3205118149"/>
<title>http://www.remix64.com/amigacharts.html remix64 #c64 #amiga #charts ! check hybris 2009 :)</title>
<content type="html">&lt;a href="http://www.remix64.com/amigacharts.html"&gt;http://www.remix64.com/amigacharts.html&lt;/a&gt; remix64 &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23amiga"&gt;#amiga&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23charts"&gt;#charts&lt;/a&gt; ! check hybris 2009 :)</content>
<updated>2009-08-09T08:59:41Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/290545289/mr2_normal.gif"/>
<twitter:source>&lt;a href="http://twitter.com/"&gt;web&lt;/a&gt;</twitter:source>
<twitter:lang>fr</twitter:lang>
<author>
<name>grabule (grabule)</name>
<uri>http://twitter.com/grabule</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3194733775</id>
<published>2009-08-08T16:35:20Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/grabule/statuses/3194733775"/>
<title>http://www.x-formz.com/music/ ultra great remixes of #c64 #amiga musics</title>
<content type="html">&lt;a href="http://www.x-formz.com/music/"&gt;http://www.x-formz.com/music/&lt;/a&gt; ultra great remixes of &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23amiga"&gt;#amiga&lt;/a&gt; musics</content>
<updated>2009-08-08T16:35:20Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/290545289/mr2_normal.gif"/>
<twitter:source>&lt;a href="http://twitter.com/"&gt;web&lt;/a&gt;</twitter:source>
<twitter:lang>eo</twitter:lang>
<author>
<name>grabule (grabule)</name>
<uri>http://twitter.com/grabule</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3191289093</id>
<published>2009-08-08T09:16:19Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/gesus/statuses/3191289093"/>
<title>8bit-Prodigy really rocks! Praise the SID chip! ;) e.g. http://bit.ly/29WsHg (more at http://bit.ly/jPkYc) via @sv #wakeup_music #c64 #fb</title>
<content type="html">8bit-Prodigy really rocks! Praise the SID chip! ;) e.g. &lt;a href="http://bit.ly/29WsHg"&gt;http://bit.ly/29WsHg&lt;/a&gt; (more at &lt;a href="http://bit.ly/jPkYc"&gt;http://bit.ly/jPkYc&lt;/a&gt;) via &lt;a href="http://twitter.com/sv"&gt;@sv&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23wakeup_music"&gt;#wakeup_music&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23fb"&gt;#fb&lt;/a&gt;</content>
<updated>2009-08-08T09:16:19Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/271664616/green_7541_starw_normal.jpg"/>
<twitter:source>&lt;a href="http://twitter.com/"&gt;web&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>gesus (gesus)</name>
<uri>http://twitter.com/gesus</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3183233498</id>
<published>2009-08-07T20:50:04Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/sidshuman/statuses/3183233498"/>
<title>#StreetFighter II running on a #C64. Holy crap does that look bad! http://bit.ly/YgIdZ</title>
<content type="html">&lt;a href="http://search.twitter.com/search?q=%23StreetFighter"&gt;#StreetFighter&lt;/a&gt; II running on a &lt;a href="http://search.twitter.com/search?q=%23C64"&gt;&lt;b&gt;#C64&lt;/b&gt;&lt;/a&gt;. Holy crap does that look bad! &lt;a href="http://bit.ly/YgIdZ"&gt;http://bit.ly/YgIdZ&lt;/a&gt;</content>
<updated>2009-08-07T20:50:04Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/131519015/tiny-blue3_normal.jpg"/>
<twitter:source>&lt;a href="http://www.tweetdeck.com/"&gt;TweetDeck&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>sidshuman (Sid Shuman)</name>
<uri>http://twitter.com/sidshuman</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3183089623</id>
<published>2009-08-07T20:39:47Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/sevik/statuses/3183089623"/>
<title>@IdleSi Armalyte rocks! My school mate held the high score in CVG magazine way back. Great loading music too. #retro #c64 #sid</title>
<content type="html">&lt;a href="http://twitter.com/IdleSi"&gt;@IdleSi&lt;/a&gt; Armalyte rocks! My school mate held the high score in CVG magazine way back. Great loading music too. &lt;a href="http://search.twitter.com/search?q=%23retro"&gt;#retro&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23sid"&gt;#sid&lt;/a&gt;</content>
<updated>2009-08-07T20:39:47Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/351019145/face_normal.jpg"/>
<twitter:source>&lt;a href="http://www.tweetdeck.com/"&gt;TweetDeck&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>sevik (Sean Parker)</name>
<uri>http://twitter.com/sevik</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3164495376</id>
<published>2009-08-06T10:29:54Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/uberguineapig/statuses/3164495376"/>
<title>RT: @3typen der #iPhone #App #c64 #sid player f&#252;r unterwegs http://twitpic.com/cypku wann kommt eigentlich ifrodo?</title>
<content type="html">RT: &lt;a href="http://twitter.com/3typen"&gt;@3typen&lt;/a&gt; der &lt;a href="http://search.twitter.com/search?q=%23iPhone"&gt;#iPhone&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23App"&gt;#App&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23sid"&gt;#sid&lt;/a&gt; player f&#252;r unterwegs &lt;a href="http://twitpic.com/cypku"&gt;http://twitpic.com/cypku&lt;/a&gt; wann kommt eigentlich ifrodo?</content>
<updated>2009-08-06T10:29:54Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/323940395/guineapig_normal.jpg"/>
<twitter:source>&lt;a href="http://apiwiki.twitter.com/"&gt;API&lt;/a&gt;</twitter:source>
<twitter:lang>de</twitter:lang>
<author>
<name>uberguineapig (Guinea Pigz)</name>
<uri>http://twitter.com/uberguineapig</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3164476839</id>
<published>2009-08-06T10:27:39Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/3typen/statuses/3164476839"/>
<title>der #iPhone #App #c64 #sid player f&#252;r unterwegs http://twitpic.com/cypku wann kommt eigentlich ifrodo?</title>
<content type="html">der &lt;a href="http://search.twitter.com/search?q=%23iPhone"&gt;#iPhone&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23App"&gt;#App&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23sid"&gt;#sid&lt;/a&gt; player f&#252;r unterwegs &lt;a href="http://twitpic.com/cypku"&gt;http://twitpic.com/cypku&lt;/a&gt; wann kommt eigentlich ifrodo?</content>
<updated>2009-08-06T10:27:39Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/17351832/twitter_logo_normal.gif"/>
<twitter:source>&lt;a href="http://www.tweetdeck.com/"&gt;TweetDeck&lt;/a&gt;</twitter:source>
<twitter:lang>de</twitter:lang>
<author>
<name>3typen (3typen)</name>
<uri>http://twitter.com/3typen</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3152292799</id>
<published>2009-08-05T20:30:00Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/kevireilly/statuses/3152292799"/>
<title>Shredz64!!! Guitar Hero for Commodore 64.. wait what? people are still making stuff for Commodore? http://bit.ly/WpM41 #commodore #c64</title>
<content type="html">Shredz64!!! Guitar Hero for Commodore 64.. wait what? people are still making stuff for Commodore? &lt;a href="http://bit.ly/WpM41"&gt;http://bit.ly/WpM41&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23commodore"&gt;#commodore&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt;</content>
<updated>2009-08-05T20:30:00Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/82408033/icon_normal.jpg"/>
<twitter:source>&lt;a href="http://www.tweetdeck.com/"&gt;TweetDeck&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>kevireilly (Kevin Reilly)</name>
<uri>http://twitter.com/kevireilly</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3152230931</id>
<published>2009-08-05T20:26:26Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/falingo/statuses/3152230931"/>
<title>... Disk2 http://tinyurl.com/kwbxth #smashdesigns #ourdarkness #c64 #demoscene</title>
<content type="html">... Disk2 &lt;a href="http://tinyurl.com/kwbxth"&gt;http://tinyurl.com/kwbxth&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23smashdesigns"&gt;#smashdesigns&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23ourdarkness"&gt;#ourdarkness&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23c64"&gt;&lt;b&gt;#c64&lt;/b&gt;&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23demoscene"&gt;#demoscene&lt;/a&gt;</content>
<updated>2009-08-05T20:26:26Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/340897397/logo_unten_transparent_80_normal.png"/>
<twitter:source>&lt;a href="http://twitter.com/"&gt;web&lt;/a&gt;</twitter:source>
<twitter:lang>en</twitter:lang>
<author>
<name>falingo (Michael)</name>
<uri>http://twitter.com/falingo</uri>
</author>
</entry>
<entry>
<id>tag:search.twitter.com,2005:3151332602</id>
<published>2009-08-05T19:35:28Z</published>
<link type="text/html" rel="alternate" href="http://twitter.com/emju/statuses/3151332602"/>
<title>RT @SilwerSurfer: Bauernfeind @3Sat ! #Politik #zensursula #piraten #sch&#228;uble #C64</title>
<content type="html">RT &lt;a href="http://twitter.com/SilwerSurfer"&gt;@SilwerSurfer&lt;/a&gt;: Bauernfeind &lt;a href="http://twitter.com/3Sat"&gt;@3Sat&lt;/a&gt; ! &lt;a href="http://search.twitter.com/search?q=%23Politik"&gt;#Politik&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23zensursula"&gt;#zensursula&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23piraten"&gt;#piraten&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23sch%C3%A4uble"&gt;#sch&#228;uble&lt;/a&gt; &lt;a href="http://search.twitter.com/search?q=%23C64"&gt;&lt;b&gt;#C64&lt;/b&gt;&lt;/a&gt;</content>
<updated>2009-08-05T19:35:28Z</updated>
<link type="image/png" rel="image" href="http://s3.amazonaws.com/twitter_production/profile_images/324556380/twitterProfilePhoto_normal.jpg"/>
<twitter:source>&lt;a href="http://twitter.com/"&gt;web&lt;/a&gt;</twitter:source>
<twitter:lang>de</twitter:lang>
<author>
<name>emju (EMJU)</name>
<uri>http://twitter.com/emju</uri>
</author>
</entry>
</feed>

View File

@ -183,7 +183,7 @@ tmp_buffer_ptr=read_byte_from_buffer+1
lda $ffff
inc tmp_buffer_ptr
bne :+
inc tmp_buffer_ptr
inc tmp_buffer_ptr+1
:
pha
pla ;reload A so flags are set correctly

198
client/test/test_parser.s Normal file
View File

@ -0,0 +1,198 @@
.include "../inc/common.i"
.include "../inc/commonprint.i"
.include "../ip65/url.s"
.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
temp_buff=copy_dest
.bss
string_offset: .res 1
selector_ptr: .res 2
temp_url_ptr: .res 2
.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
init:
;switch to lower case charset
lda #23
sta $d018
init_ip_via_dhcp
jsr print_ip_config
ldax #url_1
jsr test_url_parse
ldax #url_2
jsr test_url_parse
ldax #url_3
jsr test_url_parse
ldax #url_4
jsr test_url_parse
ldax #url_5
jsr test_url_parse
ldax #url_6
jsr test_url_parse
ldax #url_7
jsr test_url_parse
ldax #url_8
jsr test_url_parse
ldax #url_9
jsr test_url_parse
ldax #url_a
jsr test_url_parse
ldax #url_b
jsr test_url_parse
ldax #url_c
jsr test_url_parse
rts
ldax #atom_file
jsr parser_init
ldax #entry
jsr parser_skip_next
bcs @done
@next_title:
ldax #title
jsr parser_skip_next
bcs @done
jsr print_tag_contents
jsr print_cr
; jmp @next_title
@done:
rts
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
:
stax selector_ptr
jmp print_parsed_url
print_tag_contents:
stax temp_buff
lda #0
sta string_offset
@next_byte:
ldy string_offset
lda (temp_buff),y
beq @done
cmp #'<'
beq @done
jsr ascii_to_native
jsr print_a
inc string_offset
beq @done
jmp @next_byte
@done:
rts
print_parsed_url:
ldax #ip
jsr print
ldax #url_ip
jsr print_dotted_quad
ldax #port
jsr print
lda url_port+1
jsr print_hex
lda url_port
jsr print_hex
jsr print_cr
ldax #selector
jsr print
ldax selector_ptr
jsr print
jmp print_cr
.data
entry:
.byte "<entry>",0
title:
.byte "<title>",0
url_1:
.byte "http://www.jamtronix.com/",0
url_2:
.byte "http://www.jamtronix.com/goober",0
url_3:
.byte "http://www.jamtronix.com:8080/foo",0
url_4:
.byte "gopher://gopher.floodgap.com/",0
url_5:
.byte "gopher://gopher.floodgap.com/goober",0
url_6:
.byte "gopher://gopher.floodgap.com:7070/goober",0
url_7:
.byte "www.jamtronix.com",0
url_8:
.byte "jamtronix.com:70",0
url_9:
.byte "gopher.floodgap.com",0
url_a:
.byte "gopher.floodgap.com:70",0
url_b:
.byte "gopher.floodgap.com:80",0
url_c:
.byte "gopher.floodgap.com:70",0
parsing: .asciiz "PARSING "
ip: .asciiz "IP: "
port: .asciiz " PORT: $"
selector: .asciiz "SELECTOR: "
atom_file:
;.incbin "atom_test.xml"
.byte 0