git-svn-id: http://svn.code.sf.net/p/netboot65/code@210 93682198-c243-4bdb-bd91-e943c89aac3b

This commit is contained in:
jonnosan 2009-10-25 09:32:00 +00:00
parent 54589c23ef
commit ca2a29836e
5 changed files with 132 additions and 25 deletions

View File

@ -18,7 +18,7 @@ IP65TCPLIB=../ip65/ip65_tcp.lib
C64PROGLIB=../drivers/c64prog.lib
#C64NB65LIB=../drivers/c64nb65.lib
all: kipperkart.bin kipperkart_rr.bin netboot.bin kipperterm.bin kipperkart.prg
all: kipperkart.bin kipperkart_rr.bin netboot.bin kipperterm.bin kipperkart.prg kipperterm.prg
kipperkart.o: kipperkart.s $(INCFILES) ../inc/ping.i ../inc/disk_transfer.i ../inc/sidplay.i
$(AS) $(AFLAGS) -o $@ $<
@ -32,6 +32,9 @@ kipperterm.o: kipperterm.s $(INCFILES) ../inc/gopher.i ../inc/telnet.i
kipperkart.prg: kipperkart.bin c64_cart_ram_header.prg
cat c64_cart_ram_header.prg kipperkart.bin > kipperkart.prg
kipperterm.prg: kipperterm.bin c64_cart_ram_header.prg
cat c64_cart_ram_header.prg kipperterm.bin > kipperterm.prg
%.prg: %.o $(IP65LIB) $(C64PROGLIB) $(INCFILES) ../cfg/c64prg.cfg
$(LD) -m $*.map -vm -C ../cfg/c64prg.cfg -o $*.prg $(AFLAGS) $< $(IP65LIB) $(C64PROGLIB)

View File

@ -209,9 +209,9 @@ main_menu:
@get_key:
jsr get_key_ip65
pha
jsr print_hex
pla
; pha
; jsr print_hex
; pla
cmp #KEYCODE_F1
bne @not_f1

View File

@ -100,8 +100,8 @@ temp_ptr: .res 2
.segment "CARTRIDGE_HEADER"
.word init ;cold start vector
.word $FE47 ;warm start vector
.word cold_init ;cold start vector
.word warm_init ;warm start vector
.byte $C3,$C2,$CD,$38,$30 ; "CBM80"
.byte "KIPPER" ; API signature
jmp kipper_dispatcher ; KPR_DISPATCH_VECTOR : entry point for KIPPER functions
@ -112,7 +112,7 @@ jmp ip65_process ;KPR_PERIODIC_PROCESSING_VECTOR : routine to be period
init:
cold_init:
;first let the kernal do a normal startup
sei
@ -122,6 +122,7 @@ init:
jsr $ff5B ;init. VIC
cli ;KERNAL init. finished
warm_init:
;set some funky colours
LDA #$04 ;purple

View File

@ -11,6 +11,8 @@
HTTPD_TIMEOUT_SECONDS=5 ;what's the maximum time we let 1 connection be open for?
DEBUG=1
.export httpd_start
.import http_parse_request
@ -49,6 +51,8 @@ sent_header: .res 1
connection_timeout_seconds: .byte 0
tcp_buffer_ptr: .res 2
buffer_size: .res 1
skip_mode: .res 1
temp_x: .res 1
.segment "HTTP_VARS"
@ -73,10 +77,14 @@ get_next_byte:
emit_a:
stx temp_x
ldx skip_mode
bne skip_emit_a
emit_a_ptr:
sta $ffff
inc emit_a+1
inc emit_a_ptr+1
bne :+
inc emit_a+2
inc emit_a_ptr+2
:
inc output_buffer_length
bne :+
@ -84,8 +92,10 @@ emit_a:
lda output_buffer_length+1
cmp #2
bne :+
jmp send_buffer
jsr send_buffer
:
skip_emit_a:
ldx temp_x
rts
.code
@ -135,6 +145,9 @@ httpd_start:
bcc @connect_ok
rts
@connect_ok:
.ifdef DEBUG
inc $d020
.endif
lda #0
sta connection_closed
sta found_eol
@ -180,6 +193,10 @@ httpd_start:
jsr send_response
:
.ifdef DEBUG
dec $d020
.endif
jmp @listen ;go listen for the next request
@ -301,11 +318,12 @@ send_file_callback:
reset_output_buffer:
ldax httpd_io_buffer
sta emit_a+1
stx emit_a+2
sta emit_a_ptr+1
stx emit_a_ptr+2
lda #0
sta output_buffer_length
sta output_buffer_length+1
sta skip_mode
rts
@ -374,7 +392,10 @@ send_response:
@response_loop:
jsr get_next_byte
cmp #0
beq send_buffer
bne @not_last_byte
@send_buffer:
jmp send_buffer
@not_last_byte:
cmp #'%'
beq @escape
@back_from_escape:
@ -384,23 +405,64 @@ send_response:
@escape:
jsr get_next_byte
cmp #0
beq send_buffer
beq @send_buffer
cmp #'%'
beq @back_from_escape
cmp #'C'
cmp #'$'
bne :+
jsr emit_disk_catalogue
jsr get_next_byte
jsr http_get_value
bcs @response_loop
jsr emit_string
jmp @response_loop
:
cmp #'.'
bne :+
lda #0
sta skip_mode
jmp @response_loop
:
cmp #'?'
bne :+
lda #0
sta skip_mode
jsr get_next_byte
jsr http_get_value
bcc @response_loop
inc skip_mode
jmp @response_loop
:
cmp #'!'
bne :+
lda #0
sta skip_mode
jsr get_next_byte
jsr http_get_value
bcs @response_loop
inc skip_mode
jmp @response_loop
:
cmp #';'
bne :+
jsr get_next_byte
sta jump_to_embedded_routine+1
jsr get_next_byte
sta jump_to_embedded_routine+2
jmp @call_embedded_routine
:
cmp #':'
bne :+
jsr @get_next_hex_value
sta jump_to_embedded_routine+2
jsr @get_next_hex_value
sta jump_to_embedded_routine+1
@call_embedded_routine:
lda skip_mode
bne @dont_call_embedded_routine
ldax #emit_a
jsr jump_to_embedded_routine
@dont_call_embedded_routine:
jmp @response_loop
:
;if we got here, it's an invalid escape code
@ -504,7 +566,9 @@ emit_string:
.rodata
default_html:
.byte "<h1>Index of /</h1><br><ul>%C</ul><p><i>kipper - the 100%% 6502 m/l web server </i> %:ab12"
.byte "<h1>Index of /</h1><br><ul>%;"
.word emit_disk_catalogue
.byte "</ul><i>kipper - the 100%% 6502 m/l web server </i> "
.byte 0

View File

@ -96,8 +96,17 @@ init:
@found_kipper_signature:
lda #14
jsr print_a ;switch to lower case
print #initializing
lda #$4c
sta $4000
ldax #print_vars
stax $4001
ldy #KPR_INITIALIZE
jsr KPR_DISPATCH_VECTOR
bcc :+
@ -110,11 +119,28 @@ init:
print_cr
call #KPR_PRINT_IP_CONFIG
ldax #$0000
print #listening
ldax #httpd_callback
; ldax #$0000
call #KPR_HTTPD_START
jsr print_errorcode
rts
print_vars:
lda #'h'
call #KPR_HTTPD_GET_VAR_VALUE
bcs :+
call #KPR_PRINT_ASCIIZ
print #said
lda #'m'
call #KPR_HTTPD_GET_VAR_VALUE
bcs :+
call #KPR_PRINT_ASCIIZ
print_cr
:
rts
bad_boot:
print #press_a_key_to_continue
restart:
@ -148,6 +174,16 @@ kipper_signature_not_found:
iny
jmp :-
httpd_callback:
jsr print_vars
ldax #html
ldy #2 ;text/html
clc
rts
.rodata
kipper_signature:
.byte "KIPPER" ; API signature
error_code:
@ -164,9 +200,12 @@ ok:
.byte "NO KIPPER API FOUND",13,"PRESS ANY KEY TO RESET", 0
initializing:
.byte "INITIALIZING ",0
listening:
.byte "LISTENING",0
said:
.byte ":",0
html:
.byte "<h1>hello world</h1>%?mMessage recorded as '%$h:%$m'%.<form>Your Handle:<input name=h type=text length=20 value='%$h'><br>Your Message: <input type=text lengh=60 name='m'><br><input type=submit></form><br>",0
;-- LICENSE FOR test_httpd.s --
; The contents of this file are subject to the Mozilla Public License