emailler/test/httpd.s

96 lines
1.9 KiB
ArmAsm
Raw Normal View History

.include "../inc/common.inc"
.include "../inc/commonprint.inc"
.include "../inc/net.inc"
.define HTML "<h1>Hello World</h1><form>Your Name: <input name=n type=text length=20><br>Your Message: <input name=m type=text lengh=60><br><input type=submit></form>"
.export start
.import exit_to_basic
2013-12-13 21:24:03 +00:00
.import httpd_start
.import httpd_response_buffer_length
.import http_get_value
2014-04-28 16:41:54 +00:00
; keep LD65 happy
.segment "INIT"
.segment "ONCE"
2014-04-28 16:41:54 +00:00
.segment "STARTUP"
2013-12-13 21:24:03 +00:00
lda #14
jsr print_a ; switch to lower case
2013-12-13 21:24:03 +00:00
start:
ldax #initializing
jsr print
init_ip_via_dhcp
bcs :+
jsr print_ip_config
2013-12-13 21:24:03 +00:00
ldax #listening
jsr print
ldax #httpd_callback
jsr httpd_start
: jmp exit_to_basic
2013-12-13 21:24:03 +00:00
print_vars:
lda #'n'
jsr http_get_value
2013-12-13 21:24:03 +00:00
bcs :+
jsr print
ldax #said
jsr print
2013-12-13 21:24:03 +00:00
lda #'m'
jsr http_get_value
2013-12-13 21:24:03 +00:00
bcs :+
jsr print
jsr print_cr
: rts
2013-12-13 21:24:03 +00:00
httpd_callback:
jsr print_vars
lda #<.strlen(HTML)
ldx #>.strlen(HTML)
stax httpd_response_buffer_length
2013-12-13 21:24:03 +00:00
ldax #html
ldy #2 ; text/html
2013-12-13 21:24:03 +00:00
clc
rts
.rodata
2013-12-13 21:24:03 +00:00
initializing:
.byte 13,"INITIALIZING",13,0
2013-12-13 21:24:03 +00:00
listening:
.byte "LISTENING",13,0
2013-12-13 21:24:03 +00:00
said:
.byte " said ",0
2013-12-13 21:24:03 +00:00
html:
.byte HTML
2013-12-13 21:24:03 +00:00
; -- LICENSE FOR httpd.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-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-13 21:24:03 +00:00
; The Original Code is ip65.
;
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
; Jonno Downes. All Rights Reserved.
2013-12-13 21:24:03 +00:00
; -- LICENSE END --