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 http_parse_request
|
|
|
|
.import http_get_value
|
|
|
|
|
|
|
|
|
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-13 21:24:03 +00:00
|
|
|
ldax #query_1
|
|
|
|
jsr test_querystring
|
|
|
|
ldax #query_2
|
2013-12-19 21:04:19 +00:00
|
|
|
jsr test_querystring
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #query_3
|
|
|
|
jsr test_querystring
|
|
|
|
jsr get_key
|
|
|
|
ldax #query_4
|
|
|
|
jsr test_querystring
|
|
|
|
ldax #query_5
|
2013-12-19 21:04:19 +00:00
|
|
|
jsr test_querystring
|
2013-12-13 21:24:03 +00:00
|
|
|
ldax #query_6
|
2013-12-19 21:04:19 +00:00
|
|
|
jsr test_querystring
|
2015-08-28 13:19:52 +00:00
|
|
|
jmp exit_to_basic
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
test_querystring:
|
2013-12-27 13:57:56 +00:00
|
|
|
stax temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_ascii_as_native
|
|
|
|
jsr print_cr
|
2013-12-27 13:57:56 +00:00
|
|
|
ldax temp_ax
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr http_parse_request
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
lda #1
|
|
|
|
jsr print_var
|
|
|
|
lda #2
|
|
|
|
jsr print_var
|
|
|
|
lda #'h'
|
|
|
|
jsr print_var
|
|
|
|
lda #'m'
|
|
|
|
jsr print_var
|
|
|
|
lda #'q'
|
2013-12-27 13:57:56 +00:00
|
|
|
jsr print_var
|
2013-12-13 21:24:03 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
print_var:
|
|
|
|
pha
|
|
|
|
cmp #1
|
|
|
|
beq @print_method
|
2013-12-27 13:57:56 +00:00
|
|
|
cmp #2
|
2013-12-13 21:24:03 +00:00
|
|
|
beq @print_path
|
|
|
|
jsr ascii_to_native
|
|
|
|
|
|
|
|
jsr print_a
|
|
|
|
@print_equals:
|
|
|
|
lda #'='
|
|
|
|
jsr print_a
|
|
|
|
pla
|
|
|
|
jsr http_get_value
|
|
|
|
bcc @found_var_value
|
|
|
|
lda #'?'
|
|
|
|
jsr print_a
|
|
|
|
jmp print_cr
|
2013-12-27 13:57:56 +00:00
|
|
|
@found_var_value:
|
2013-12-13 21:24:03 +00:00
|
|
|
jsr print_ascii_as_native
|
|
|
|
jmp print_cr
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-13 21:24:03 +00:00
|
|
|
@print_path:
|
|
|
|
ldax #path
|
|
|
|
jmp @print_caption
|
|
|
|
@print_method:
|
|
|
|
ldax #method
|
|
|
|
@print_caption:
|
|
|
|
jsr print_ascii_as_native
|
|
|
|
jmp @print_equals
|
|
|
|
|
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
|
|
|
|
|
|
|
temp_ax: .res 2
|
|
|
|
|
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
.rodata
|
2013-12-19 21:04:19 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
path:
|
|
|
|
.byte "path",0
|
|
|
|
method:
|
|
|
|
.byte "method",0
|
2013-12-13 21:24:03 +00:00
|
|
|
|
2013-12-27 13:57:56 +00:00
|
|
|
query_1:
|
|
|
|
.byte "GET /?h=slack&m=goober+woober+woo%21+%3B+i+am+text HTTP/1.1",0
|
|
|
|
query_2:
|
|
|
|
.byte "POST /?h=slack&m=goober+woober+woo!+%3b+i+am+text",0
|
|
|
|
query_3:
|
|
|
|
.byte "GET /?handle=slack&message=goober+woober+woo%21+%3B+i+am+text+%0d%0a%21%40%23%24%25%5E%26%25%5D%5B%7B%7D& HTTP/1.1",0
|
|
|
|
query_4:
|
|
|
|
.byte "GET /this/is/a/long/q/path.html?q=foo",0
|
|
|
|
query_5:
|
|
|
|
.byte "/this/is/a/gopher_selector",0
|
|
|
|
query_6:
|
|
|
|
.byte $0d,$0a,0 ; this should also be a gopher path
|
2013-12-13 21:24:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-04-13 16:36:04 +00:00
|
|
|
; -- LICENSE FOR parsequerystring.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 --
|