Removed address constants and HTTP_VARS segment.

This commit is contained in:
Oliver Schmidt 2014-04-27 18:15:10 +02:00
parent ca5c0d5998
commit 399aa47608
6 changed files with 11 additions and 21 deletions

View File

@ -19,7 +19,6 @@ SEGMENTS {
DATA: load = RAM, type = rw;
SELF_MODIFIED_CODE: load = RAM, type = rw, optional = yes;
IP65_DEFAULTS: load = RAM, type = rw;
HTTP_VARS: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss, define = yes;
APP_SCRATCH: load = RAM, type = bss, optional = yes;
TCP_VARS: load = RAM, type = bss, optional = yes;

View File

@ -20,7 +20,6 @@ SEGMENTS {
DATA: load = RAM, type = rw;
SELF_MODIFIED_CODE: load = RAM, type = rw, optional = yes;
IP65_DEFAULTS: load = RAM, type = rw, optional = yes;
HTTP_VARS: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss;
APP_SCRATCH: load = RAM, type = bss, optional = yes;
TCP_VARS: load = RAM, type = bss, optional = yes;

View File

@ -21,7 +21,6 @@ SEGMENTS {
DATA: load = RAM, type = rw;
SELF_MODIFIED_CODE: load = RAM, type = rw, optional = yes;
IP65_DEFAULTS: load = RAM, type = rw, optional = yes;
HTTP_VARS: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss;
APP_SCRATCH: load = RAM, type = bss, optional = yes;
TCP_VARS: load = RAM, type = bss, optional = yes;

View File

@ -12,7 +12,6 @@
.export http_parse_request
.export http_get_value
.export http_variables_buffer
.importzp copy_src
.importzp copy_dest
@ -26,15 +25,11 @@ table_ptr = copy_dest
.bss
var_buf: .res $300 ; work area for storing variables extracted from query string
var_name: .res 1
hex_digit: .res 1
.data
http_variables_buffer: .addr $4800 ; work area for storing variables extracted from query string
.code
; split a HTTP request into method (e.g. GET or POST), the path, and any querystring variables
@ -54,8 +49,7 @@ http_variables_buffer: .addr $4800 ; work area for storing variables extrac
http_parse_request:
stax string_ptr
ldax http_variables_buffer
ldax var_buf
stax table_ptr
lda #1 ; start of method
@ -192,7 +186,7 @@ put_byte:
; if variable did not exist, carry flag will be set.
http_get_value:
sta var_name
ldax http_variables_buffer
ldax var_buf
stax string_ptr
ldy #0

View File

@ -11,6 +11,7 @@
HTTPD_TIMEOUT_SECONDS = 5 ; what's the maximum time we let 1 connection be open for?
.export httpd_start
.export httpd_port_number
.import http_parse_request
.import http_get_value
@ -37,6 +38,7 @@ temp_ptr = copy_src
.bss
io_buf: .res $800
found_eol: .res 1
connection_closed: .res 1
output_buffer_length: .res 2
@ -48,10 +50,8 @@ skip_mode: .res 1
temp_x: .res 1
.segment "HTTP_VARS"
.data
httpd_io_buffer: .addr $4000 ; by default, use a 3k buffer at $4000 for storing inbound requests.
httpd_scratch_buffer: .addr $4B00 ; by default, use a 1k buffer at $4B00 as a scratchpad
httpd_port_number: .word 80
jump_to_callback:
@ -104,7 +104,7 @@ httpd_start:
@listen:
jsr tcp_close
ldax httpd_io_buffer
ldax io_buf
stax tcp_buffer_ptr
ldax #http_callback
stax tcp_callback
@ -151,7 +151,7 @@ httpd_start:
jmp @listen
@got_eol:
ldax httpd_io_buffer
ldax io_buf
jsr http_parse_request
jsr jump_to_callback ; call the handler to generate the response for this request.
; AX should now point at data to be sent
@ -197,7 +197,7 @@ http_callback:
; look for CR or LF in input
sta found_eol
ldax httpd_io_buffer
ldax io_buf
stax get_next_byte+1
@look_for_eol:
@ -215,7 +215,7 @@ http_callback:
rts
reset_output_buffer:
ldax httpd_io_buffer
ldax io_buf
sta emit_a_ptr+1
stx emit_a_ptr+2
lda #0
@ -310,7 +310,7 @@ send_response:
send_buffer:
ldax output_buffer_length
stax tcp_send_data_len
ldax httpd_io_buffer
ldax io_buf
jsr tcp_send
jmp reset_output_buffer

View File

@ -15,7 +15,6 @@ SEGMENTS {
IP65_DEFAULTS: load = RAM, type = rw,define = yes, optional=yes;
APP_SCRATCH: load = RAM, type = bss, optional=yes;
TCP_VARS: load = RAM, type = bss, optional=yes;
HTTP_VARS: load = RAM, type = bss, optional=yes;
BSS: load = RAM, type = bss, define = yes;
HEAP: load = RAM, type = bss, optional = yes; # must sit just below stack
ZPSAVE: load = RAM, type = bss;