From 313c930a09e39a041a3dccd2d98dadf5ae900169 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Tue, 11 Aug 2009 11:32:06 +0000 Subject: [PATCH] git-svn-id: http://svn.code.sf.net/p/netboot65/code@174 93682198-c243-4bdb-bd91-e943c89aac3b --- client/inc/common.i | 6 +- client/inc/nb65_constants.i | 1 + client/ip65/Makefile | 2 + client/ip65/dns.s | 6 +- client/ip65/function_dispatcher.s | 38 +---- client/ip65/output_buffer.s | 2 +- client/ip65/parser.s | 80 ++++++++++ client/ip65/string_utils.s | 57 +++++++ client/ip65/url.s | 190 +++++++++++++++++++++++ client/kipper/a2_gopher.s | 67 +++++++++ client/nb65/nb65_c64.s | 2 +- client/test/Makefile | 1 + client/test/atom_test.xml | 242 ++++++++++++++++++++++++++++++ client/test/test_disk_io.s | 2 +- client/test/test_parser.s | 198 ++++++++++++++++++++++++ 15 files changed, 855 insertions(+), 39 deletions(-) create mode 100644 client/ip65/parser.s create mode 100644 client/ip65/string_utils.s create mode 100644 client/ip65/url.s create mode 100644 client/kipper/a2_gopher.s create mode 100644 client/test/atom_test.xml create mode 100644 client/test/test_parser.s diff --git a/client/inc/common.i b/client/inc/common.i index 277887a..4eea9ad 100644 --- a/client/inc/common.i +++ b/client/inc/common.i @@ -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 \ No newline at end of file +.endmacro + +.endif \ No newline at end of file diff --git a/client/inc/nb65_constants.i b/client/inc/nb65_constants.i index d03fb35..fda1542 100644 --- a/client/inc/nb65_constants.i +++ b/client/inc/nb65_constants.i @@ -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 diff --git a/client/ip65/Makefile b/client/ip65/Makefile index d52715e..dacb68f 100644 --- a/client/ip65/Makefile +++ b/client/ip65/Makefile @@ -26,6 +26,8 @@ ETHOBJS= \ dottedquad.o \ output_buffer.o\ tftp.o \ + parser.o \ + string_utils.o \ telnet.o \ arithmetic.o\ diff --git a/client/ip65/dns.s b/client/ip65/dns.s index 7d22a74..eff2a44 100644 --- a/client/ip65/dns.s +++ b/client/ip65/dns.s @@ -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 : diff --git a/client/ip65/function_dispatcher.s b/client/ip65/function_dispatcher.s index d87aef3..6b33f56 100644 --- a/client/ip65/function_dispatcher.s +++ b/client/ip65/function_dispatcher.s @@ -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 : diff --git a/client/ip65/output_buffer.s b/client/ip65/output_buffer.s index 0925542..e0ddb87 100644 --- a/client/ip65/output_buffer.s +++ b/client/ip65/output_buffer.s @@ -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 \ No newline at end of file diff --git a/client/ip65/parser.s b/client/ip65/parser.s new file mode 100644 index 0000000..9d600eb --- /dev/null +++ b/client/ip65/parser.s @@ -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 diff --git a/client/ip65/string_utils.s b/client/ip65/string_utils.s new file mode 100644 index 0000000..9a3f2a6 --- /dev/null +++ b/client/ip65/string_utils.s @@ -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 diff --git a/client/ip65/url.s b/client/ip65/url.s new file mode 100644 index 0000000..3b3f863 --- /dev/null +++ b/client/ip65/url.s @@ -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 \ No newline at end of file diff --git a/client/kipper/a2_gopher.s b/client/kipper/a2_gopher.s new file mode 100644 index 0000000..48f6047 --- /dev/null +++ b/client/kipper/a2_gopher.s @@ -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 + diff --git a/client/nb65/nb65_c64.s b/client/nb65/nb65_c64.s index eeb0083..895bb96 100644 --- a/client/nb65/nb65_c64.s +++ b/client/nb65/nb65_c64.s @@ -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: diff --git a/client/test/Makefile b/client/test/Makefile index ccd4d52..6ee55ea 100644 --- a/client/test/Makefile +++ b/client/test/Makefile @@ -30,6 +30,7 @@ all: \ testdottedquad.pg2\ testdottedquad.prg\ test_tcp.prg \ + test_parser.prg \ %.o: %.c $(CC) -c $(CFLAGS) $< diff --git a/client/test/atom_test.xml b/client/test/atom_test.xml new file mode 100644 index 0000000..85a62a4 --- /dev/null +++ b/client/test/atom_test.xml @@ -0,0 +1,242 @@ + + + tag:search.twitter.com,2005:search/#c64 + + + #c64 - Twitter Search + + + since_id removed for pagination. + 2009-08-10T10:03:59Z + 15 + + + tag:search.twitter.com,2005:3222849162 + 2009-08-10T10:03:59Z + + Lately I edited a Firebird music compilation. You can play it by using this player here. Please listen. http://bit.ly/DF8zQ #c64 #chiptune + Lately I edited a Firebird music compilation. You can play it by using this player here. Please listen. <a href="http://bit.ly/DF8zQ">http://bit.ly/DF8zQ</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23chiptune">#chiptune</a> + 2009-08-10T10:03:59Z + + <a href="http://twitter.com/">web</a> + en + + aka_obi (akaobi) + http://twitter.com/aka_obi + + + + tag:search.twitter.com,2005:3222793961 + 2009-08-10T09:57:28Z + + Lately I edited a Firebird music compilation. You can play it by using this player here. Have fun. http://bit.ly/DF8zQ #c64 #chiptune + Lately I edited a Firebird music compilation. You can play it by using this player here. Have fun. <a href="http://bit.ly/DF8zQ">http://bit.ly/DF8zQ</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23chiptune">#chiptune</a> + 2009-08-10T09:57:28Z + + <a href="http://twitter.com/">web</a> + en + + aka_obi (akaobi) + http://twitter.com/aka_obi + + + + tag:search.twitter.com,2005:3221757110 + 2009-08-10T07:30:45Z + + is listening SID music on the iPhone! http://iphone.vanille.de/sidplayer/ #c64 #sid #iphone #chipmusic #8bit + is listening SID music on the iPhone! <a href="http://iphone.vanille.de/sidplayer/">http://iphone.vanille.de/sidplayer/</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23sid">#sid</a> <a href="http://search.twitter.com/search?q=%23iphone">#iphone</a> <a href="http://search.twitter.com/search?q=%23chipmusic">#chipmusic</a> <a href="http://search.twitter.com/search?q=%238bit">#8bit</a> + 2009-08-10T07:30:45Z + + <a href="http://twitter.com/">web</a> + en + + chiptune (rez) + http://twitter.com/chiptune + + + + tag:search.twitter.com,2005:3205731747 + 2009-08-09T10:16:06Z + + Wenn man früher auf dem C64 nur mit S-Mon geproggt hat, dann ist das ScienceFiction! http://bit.ly/RuhAh + #c64 + Wenn man früher auf dem C64 nur mit S-Mon geproggt hat, dann ist das ScienceFiction! <a href="http://bit.ly/RuhAh">http://bit.ly/RuhAh</a> + <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> + 2009-08-09T10:16:06Z + + <a href="http://thecosmicmachine.com/eventbox/">EventBox</a> + de + + wurstgranate (Wurstgranate) + http://twitter.com/wurstgranate + + + + tag:search.twitter.com,2005:3205709954 + 2009-08-09T10:13:18Z + + http://bit.ly/RuhAh + #c64 + <a href="http://bit.ly/RuhAh">http://bit.ly/RuhAh</a> + <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> + 2009-08-09T10:13:18Z + + <a href="http://thecosmicmachine.com/eventbox/">EventBox</a> + + + wurstgranate (Wurstgranate) + http://twitter.com/wurstgranate + + + + tag:search.twitter.com,2005:3205118149 + 2009-08-09T08:59:41Z + + http://www.remix64.com/amigacharts.html remix64 #c64 #amiga #charts ! check hybris 2009 :) + <a href="http://www.remix64.com/amigacharts.html">http://www.remix64.com/amigacharts.html</a> remix64 <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23amiga">#amiga</a> <a href="http://search.twitter.com/search?q=%23charts">#charts</a> ! check hybris 2009 :) + 2009-08-09T08:59:41Z + + <a href="http://twitter.com/">web</a> + fr + + grabule (grabule) + http://twitter.com/grabule + + + + tag:search.twitter.com,2005:3194733775 + 2009-08-08T16:35:20Z + + http://www.x-formz.com/music/ ultra great remixes of #c64 #amiga musics + <a href="http://www.x-formz.com/music/">http://www.x-formz.com/music/</a> ultra great remixes of <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23amiga">#amiga</a> musics + 2009-08-08T16:35:20Z + + <a href="http://twitter.com/">web</a> + eo + + grabule (grabule) + http://twitter.com/grabule + + + + tag:search.twitter.com,2005:3191289093 + 2009-08-08T09:16:19Z + + 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 + 8bit-Prodigy really rocks! Praise the SID chip! ;) e.g. <a href="http://bit.ly/29WsHg">http://bit.ly/29WsHg</a> (more at <a href="http://bit.ly/jPkYc">http://bit.ly/jPkYc</a>) via <a href="http://twitter.com/sv">@sv</a> <a href="http://search.twitter.com/search?q=%23wakeup_music">#wakeup_music</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23fb">#fb</a> + 2009-08-08T09:16:19Z + + <a href="http://twitter.com/">web</a> + en + + gesus (gesus) + http://twitter.com/gesus + + + + tag:search.twitter.com,2005:3183233498 + 2009-08-07T20:50:04Z + + #StreetFighter II running on a #C64. Holy crap does that look bad! http://bit.ly/YgIdZ + <a href="http://search.twitter.com/search?q=%23StreetFighter">#StreetFighter</a> II running on a <a href="http://search.twitter.com/search?q=%23C64"><b>#C64</b></a>. Holy crap does that look bad! <a href="http://bit.ly/YgIdZ">http://bit.ly/YgIdZ</a> + 2009-08-07T20:50:04Z + + <a href="http://www.tweetdeck.com/">TweetDeck</a> + en + + sidshuman (Sid Shuman) + http://twitter.com/sidshuman + + + + tag:search.twitter.com,2005:3183089623 + 2009-08-07T20:39:47Z + + @IdleSi Armalyte rocks! My school mate held the high score in CVG magazine way back. Great loading music too. #retro #c64 #sid + <a href="http://twitter.com/IdleSi">@IdleSi</a> Armalyte rocks! My school mate held the high score in CVG magazine way back. Great loading music too. <a href="http://search.twitter.com/search?q=%23retro">#retro</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23sid">#sid</a> + 2009-08-07T20:39:47Z + + <a href="http://www.tweetdeck.com/">TweetDeck</a> + en + + sevik (Sean Parker) + http://twitter.com/sevik + + + + tag:search.twitter.com,2005:3164495376 + 2009-08-06T10:29:54Z + + RT: @3typen der #iPhone #App #c64 #sid player für unterwegs http://twitpic.com/cypku wann kommt eigentlich ifrodo? + RT: <a href="http://twitter.com/3typen">@3typen</a> der <a href="http://search.twitter.com/search?q=%23iPhone">#iPhone</a> <a href="http://search.twitter.com/search?q=%23App">#App</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23sid">#sid</a> player für unterwegs <a href="http://twitpic.com/cypku">http://twitpic.com/cypku</a> wann kommt eigentlich ifrodo? + 2009-08-06T10:29:54Z + + <a href="http://apiwiki.twitter.com/">API</a> + de + + uberguineapig (Guinea Pigz) + http://twitter.com/uberguineapig + + + + tag:search.twitter.com,2005:3164476839 + 2009-08-06T10:27:39Z + + der #iPhone #App #c64 #sid player für unterwegs http://twitpic.com/cypku wann kommt eigentlich ifrodo? + der <a href="http://search.twitter.com/search?q=%23iPhone">#iPhone</a> <a href="http://search.twitter.com/search?q=%23App">#App</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23sid">#sid</a> player für unterwegs <a href="http://twitpic.com/cypku">http://twitpic.com/cypku</a> wann kommt eigentlich ifrodo? + 2009-08-06T10:27:39Z + + <a href="http://www.tweetdeck.com/">TweetDeck</a> + de + + 3typen (3typen) + http://twitter.com/3typen + + + + tag:search.twitter.com,2005:3152292799 + 2009-08-05T20:30:00Z + + Shredz64!!! Guitar Hero for Commodore 64.. wait what? people are still making stuff for Commodore? http://bit.ly/WpM41 #commodore #c64 + Shredz64!!! Guitar Hero for Commodore 64.. wait what? people are still making stuff for Commodore? <a href="http://bit.ly/WpM41">http://bit.ly/WpM41</a> <a href="http://search.twitter.com/search?q=%23commodore">#commodore</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> + 2009-08-05T20:30:00Z + + <a href="http://www.tweetdeck.com/">TweetDeck</a> + en + + kevireilly (Kevin Reilly) + http://twitter.com/kevireilly + + + + tag:search.twitter.com,2005:3152230931 + 2009-08-05T20:26:26Z + + ... Disk2 http://tinyurl.com/kwbxth #smashdesigns #ourdarkness #c64 #demoscene + ... Disk2 <a href="http://tinyurl.com/kwbxth">http://tinyurl.com/kwbxth</a> <a href="http://search.twitter.com/search?q=%23smashdesigns">#smashdesigns</a> <a href="http://search.twitter.com/search?q=%23ourdarkness">#ourdarkness</a> <a href="http://search.twitter.com/search?q=%23c64"><b>#c64</b></a> <a href="http://search.twitter.com/search?q=%23demoscene">#demoscene</a> + 2009-08-05T20:26:26Z + + <a href="http://twitter.com/">web</a> + en + + falingo (Michael) + http://twitter.com/falingo + + + + tag:search.twitter.com,2005:3151332602 + 2009-08-05T19:35:28Z + + RT @SilwerSurfer: Bauernfeind @3Sat ! #Politik #zensursula #piraten #schäuble #C64 + RT <a href="http://twitter.com/SilwerSurfer">@SilwerSurfer</a>: Bauernfeind <a href="http://twitter.com/3Sat">@3Sat</a> ! <a href="http://search.twitter.com/search?q=%23Politik">#Politik</a> <a href="http://search.twitter.com/search?q=%23zensursula">#zensursula</a> <a href="http://search.twitter.com/search?q=%23piraten">#piraten</a> <a href="http://search.twitter.com/search?q=%23sch%C3%A4uble">#schäuble</a> <a href="http://search.twitter.com/search?q=%23C64"><b>#C64</b></a> + 2009-08-05T19:35:28Z + + <a href="http://twitter.com/">web</a> + de + + emju (EMJU) + http://twitter.com/emju + + + diff --git a/client/test/test_disk_io.s b/client/test/test_disk_io.s index 15e9acb..9bc3974 100644 --- a/client/test/test_disk_io.s +++ b/client/test/test_disk_io.s @@ -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 diff --git a/client/test/test_parser.s b/client/test/test_parser.s new file mode 100644 index 0000000..6feb48e --- /dev/null +++ b/client/test/test_parser.s @@ -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 "",0 +title: +.byte "",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 \ No newline at end of file