2018-02-23 15:36:05 +00:00
.include " . . / inc/ c o m m o n . i n c "
.include " . . / inc/ c o m m o n p r i n t . i n c "
.include " . . / inc/ n e t . i n c "
2013-12-27 13:57:56 +00:00
2017-12-07 21:57:40 +00:00
.define HTML " < h1 > H e l l o W o r l d < / h1 > < f o r m > Y o u r N a m e : < i n p u t n a m e =n t y p e =text l e n g t h =20 > < b r > Y o u r M e s s a g e : < i n p u t n a m e =m t y p e =text l e n g h =60 > < b r > < i n p u t t y p e =submit > < / f o r m > "
2015-08-28 13:19:52 +00:00
.export start
2014-04-27 15:47:07 +00:00
.import exit_to_basic
2013-12-13 21:24:03 +00:00
2014-04-27 15:47:07 +00:00
.import httpd_start
2017-12-07 21:57:40 +00:00
.import httpd_response_buffer_length
2014-04-27 15:47:07 +00:00
.import http_get_value
2013-12-19 21:04:19 +00:00
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
lda #14
2013-12-27 13:57:56 +00:00
jsr p r i n t _ a ; switch to lower case
2013-12-13 21:24:03 +00:00
2015-08-28 13:19:52 +00:00
start :
2014-04-27 15:47:07 +00:00
ldax #i n i t i a l i z i n g
jsr p r i n t
init_ i p _ v i a _ d h c p
2015-07-08 13:44:48 +00:00
bcs : +
2014-04-27 15:47:07 +00:00
jsr p r i n t _ i p _ c o n f i g
2013-12-13 21:24:03 +00:00
2014-04-27 15:47:07 +00:00
ldax #l i s t e n i n g
jsr p r i n t
ldax #h t t p d _ c a l l b a c k
jsr h t t p d _ s t a r t
2013-12-19 21:04:19 +00:00
2015-07-08 13:44:48 +00:00
: jmp e x i t _ t o _ b a s i c
2013-12-19 21:04:19 +00:00
2013-12-13 21:24:03 +00:00
print_vars :
2017-12-07 20:39:25 +00:00
lda #' n '
2014-04-27 15:47:07 +00:00
jsr h t t p _ g e t _ v a l u e
2013-12-13 21:24:03 +00:00
bcs : +
2014-04-27 15:47:07 +00:00
jsr p r i n t
ldax #s a i d
jsr p r i n t
2013-12-13 21:24:03 +00:00
lda #' m '
2014-04-27 15:47:07 +00:00
jsr h t t p _ g e t _ v a l u e
2013-12-13 21:24:03 +00:00
bcs : +
2014-04-27 15:47:07 +00:00
jsr p r i n t
jsr p r i n t _ c r
2013-12-27 13:57:56 +00:00
: rts
2013-12-13 21:24:03 +00:00
httpd_callback :
jsr p r i n t _ v a r s
2017-12-07 21:57:40 +00:00
lda #< . s t r l e n ( H T M L )
ldx #> . s t r l e n ( H T M L )
stax h t t p d _ r e s p o n s e _ b u f f e r _ l e n g t h
2013-12-13 21:24:03 +00:00
ldax #h t m l
2014-04-27 15:47:07 +00:00
ldy #2 ; text/html
2013-12-13 21:24:03 +00:00
clc
rts
2013-12-19 21:04:19 +00:00
2013-12-27 13:57:56 +00:00
.rodata
2013-12-13 21:24:03 +00:00
2013-12-27 13:57:56 +00:00
initializing :
2015-07-08 13:44:48 +00:00
.byte 1 3 , " INITIALIZING" ,1 3 ,0
2013-12-13 21:24:03 +00:00
listening :
2015-04-13 20:38:55 +00:00
.byte " LISTENING" ,1 3 ,0
2013-12-13 21:24:03 +00:00
said :
2017-12-07 20:39:25 +00:00
.byte " said " ,0
2013-12-13 21:24:03 +00:00
html :
2017-12-07 21:57:40 +00:00
.byte HTML
2013-12-13 21:24:03 +00:00
2013-12-19 21:04:19 +00:00
2014-04-27 15:47:07 +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-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 --