mirror of
https://github.com/bobbimanners/emailler.git
synced 2025-04-02 18:29:39 +00:00
Converted web server test from KIPPER Cart to "classic" IP65 program.
This commit is contained in:
parent
cab2b74ec4
commit
e85cd83c8b
@ -39,6 +39,7 @@ prg: \
|
||||
dns.prg \
|
||||
dottedquad.prg \
|
||||
geturl_tcp.prg \
|
||||
httpd_tcp.prg \
|
||||
parsequerystring.prg \
|
||||
parser_tcp.prg \
|
||||
ping_tcp.prg \
|
||||
@ -53,6 +54,7 @@ bin: \
|
||||
dns.bin \
|
||||
dottedquad.bin \
|
||||
geturl_tcp.bin \
|
||||
httpd_tcp.bin \
|
||||
parsequerystring.bin \
|
||||
parser_tcp.bin \
|
||||
ping_tcp.bin \
|
||||
@ -67,6 +69,7 @@ vicprg: \
|
||||
dns.vicprg \
|
||||
dottedquad.vicprg \
|
||||
geturl_tcp.vicprg \
|
||||
httpd_tcp.vicprg \
|
||||
parsequerystring.vicprg \
|
||||
parser_tcp.vicprg \
|
||||
ping_tcp.vicprg \
|
||||
@ -110,6 +113,7 @@ ip65.d64: prg
|
||||
$(C1541) -attach $@ -write dns.prg dns,p
|
||||
$(C1541) -attach $@ -write dottedquad.prg dottedquad,p
|
||||
$(C1541) -attach $@ -write geturl.prg geturl,p
|
||||
$(C1541) -attach $@ -write httpd.prg httpd,p
|
||||
$(C1541) -attach $@ -write parser.prg parser,p
|
||||
$(C1541) -attach $@ -write ping.prg ping,p
|
||||
$(C1541) -attach $@ -write sntp.prg sntp,p
|
||||
@ -121,6 +125,7 @@ ip65.dsk: bin
|
||||
java -jar $(AC) -cc65 $@ dns bin 0 < dns.bin
|
||||
java -jar $(AC) -cc65 $@ dottedquad bin 0 < dottedquad.bin
|
||||
java -jar $(AC) -cc65 $@ geturl bin 0 < geturl.bin
|
||||
java -jar $(AC) -cc65 $@ httpd bin 0 < httpd.bin
|
||||
java -jar $(AC) -cc65 $@ parser bin 0 < parser.bin
|
||||
java -jar $(AC) -cc65 $@ ping bin 0 < ping.bin
|
||||
java -jar $(AC) -cc65 $@ sntp bin 0 < sntp.bin
|
||||
|
176
test/httpd.s
176
test/httpd.s
@ -1,181 +1,55 @@
|
||||
; test the "Kipper Kartridge API"
|
||||
.include "../inc/common.i"
|
||||
.include "../inc/commonprint.i"
|
||||
.include "../inc/net.i"
|
||||
|
||||
.ifndef KPR_API_VERSION_NUMBER
|
||||
.define EQU =
|
||||
.include "../inc/kipper_constants.i"
|
||||
.endif
|
||||
.import exit_to_basic
|
||||
|
||||
.include "../ip65/copymem.s"
|
||||
|
||||
; load A/X macro
|
||||
.macro ldax arg
|
||||
.if (.match (.left (1, arg), #)) ; immediate mode
|
||||
lda #<(.right (.tcount (arg)-1, arg))
|
||||
ldx #>(.right (.tcount (arg)-1, arg))
|
||||
.else ; assume absolute or zero page
|
||||
lda arg
|
||||
ldx 1+(arg)
|
||||
.endif
|
||||
.endmacro
|
||||
|
||||
; store A/X macro
|
||||
.macro stax arg
|
||||
sta arg
|
||||
stx 1+(arg)
|
||||
.endmacro
|
||||
|
||||
print_a = $ffd2
|
||||
|
||||
.macro cout arg
|
||||
lda arg
|
||||
jsr print_a
|
||||
.endmacro
|
||||
|
||||
|
||||
.zeropage
|
||||
|
||||
temp_ptr: .res 2
|
||||
|
||||
|
||||
.bss
|
||||
|
||||
kipper_param_buffer: .res $20
|
||||
block_number: .res $0
|
||||
.import httpd_start
|
||||
.import http_get_value
|
||||
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
.macro print arg
|
||||
ldax arg
|
||||
ldy #KPR_PRINT_ASCIIZ
|
||||
jsr KPR_DISPATCH_VECTOR
|
||||
.endmacro
|
||||
|
||||
.macro print_cr
|
||||
lda #13
|
||||
jsr print_a
|
||||
.endmacro
|
||||
|
||||
.macro call arg
|
||||
ldy arg
|
||||
jsr KPR_DISPATCH_VECTOR
|
||||
.endmacro
|
||||
|
||||
; look for KIPPER signature at location pointed at by AX
|
||||
look_for_signature:
|
||||
stax temp_ptr
|
||||
ldy #5
|
||||
@check_one_byte:
|
||||
lda (temp_ptr),y
|
||||
cmp kipper_signature,y
|
||||
bne @bad_match
|
||||
dey
|
||||
bpl@check_one_byte
|
||||
clc
|
||||
rts
|
||||
@bad_match:
|
||||
sec
|
||||
rts
|
||||
|
||||
init:
|
||||
ldax #KPR_CART_SIGNATURE ; where signature should be in cartridge
|
||||
jsr look_for_signature
|
||||
bcc @found_kipper_signature
|
||||
jmp kipper_signature_not_found
|
||||
|
||||
@found_kipper_signature:
|
||||
lda #14
|
||||
jsr print_a ; switch to lower case
|
||||
|
||||
print #initializing
|
||||
ldax #initializing
|
||||
jsr print
|
||||
init_ip_via_dhcp
|
||||
jsr print_ip_config
|
||||
|
||||
lda #$4c
|
||||
sta $4000
|
||||
ldax #print_vars
|
||||
stax $4001
|
||||
|
||||
ldy #KPR_INITIALIZE
|
||||
jsr KPR_DISPATCH_VECTOR
|
||||
bcc :+
|
||||
print #failed
|
||||
jsr print_errorcode
|
||||
jmp bad_boot
|
||||
: print #ok
|
||||
print_cr
|
||||
|
||||
call #KPR_PRINT_IP_CONFIG
|
||||
print #listening
|
||||
ldax #listening
|
||||
jsr print
|
||||
ldax #httpd_callback
|
||||
; ldax #$0000
|
||||
call #KPR_HTTPD_START
|
||||
jsr print_errorcode
|
||||
rts
|
||||
jsr httpd_start
|
||||
|
||||
jmp exit_to_basic
|
||||
|
||||
|
||||
print_vars:
|
||||
lda #'h'
|
||||
call #KPR_HTTPD_GET_VAR_VALUE
|
||||
jsr http_get_value
|
||||
bcs :+
|
||||
call #KPR_PRINT_ASCIIZ
|
||||
print #said
|
||||
jsr print
|
||||
ldax #said
|
||||
jsr print
|
||||
lda #'m'
|
||||
call #KPR_HTTPD_GET_VAR_VALUE
|
||||
jsr http_get_value
|
||||
bcs :+
|
||||
call #KPR_PRINT_ASCIIZ
|
||||
print_cr
|
||||
jsr print
|
||||
jsr print_cr
|
||||
: rts
|
||||
|
||||
bad_boot:
|
||||
print #press_a_key_to_continue
|
||||
restart:
|
||||
jsr get_key
|
||||
jmp $fce2 ; do a cold start
|
||||
|
||||
print_errorcode:
|
||||
print #error_code
|
||||
call #KPR_GET_LAST_ERROR
|
||||
call #KPR_PRINT_HEX
|
||||
print_cr
|
||||
rts
|
||||
|
||||
; use C64 Kernel ROM function to read a key
|
||||
; inputs: none
|
||||
; outputs: A contains ASCII value of key just pressed
|
||||
get_key:
|
||||
jsr $ffe4
|
||||
cmp #0
|
||||
beq get_key
|
||||
rts
|
||||
|
||||
kipper_signature_not_found:
|
||||
ldy #0
|
||||
: lda kipper_signature_not_found_message,y
|
||||
beq restart
|
||||
jsr print_a
|
||||
iny
|
||||
jmp :-
|
||||
|
||||
httpd_callback:
|
||||
jsr print_vars
|
||||
ldax #html
|
||||
ldy #2 ; text/html
|
||||
ldy #2 ; text/html
|
||||
clc
|
||||
rts
|
||||
|
||||
|
||||
.rodata
|
||||
|
||||
kipper_signature:
|
||||
.byte "KIPPER" ; API signature
|
||||
error_code:
|
||||
.asciiz "ERROR CODE: $"
|
||||
press_a_key_to_continue:
|
||||
.byte "PRESS A KEY TO CONTINUE",13,0
|
||||
failed:
|
||||
.byte "FAILED ",0
|
||||
ok:
|
||||
.byte "OK ",0
|
||||
kipper_signature_not_found_message:
|
||||
.byte "NO KIPPER API FOUND",13,"PRESS ANY KEY TO RESET",0
|
||||
initializing:
|
||||
.byte "INITIALIZING ",0
|
||||
listening:
|
||||
@ -187,7 +61,7 @@ html:
|
||||
|
||||
|
||||
|
||||
; -- LICENSE FOR test_httpd.s --
|
||||
; -- LICENSE FOR httpd.s --
|
||||
; 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user