From 104a4fe6bfca25aee178b9d5d98e91b5c8157e14 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Tue, 21 Jun 2011 11:46:33 +0000 Subject: [PATCH] git-svn-id: http://svn.code.sf.net/p/netboot65/code@317 93682198-c243-4bdb-bd91-e943c89aac3b --- client/wiznet/Makefile | 4 +-- client/wiznet/telnetd.s | 38 ++++++++++++++++++++++---- client/wiznet/wizbobcart.cfg | 27 +++++++++++++++++++ client/wiznet/wizbobcart.s | 52 +++++++++++++++++++++++------------- 4 files changed, 95 insertions(+), 26 deletions(-) create mode 100644 client/wiznet/wizbobcart.cfg diff --git a/client/wiznet/Makefile b/client/wiznet/Makefile index 754c282..874edb8 100644 --- a/client/wiznet/Makefile +++ b/client/wiznet/Makefile @@ -53,8 +53,8 @@ telnetd.bin: telnetd.o $(IP65WIZNETLIB) $(C64WIZNETLIB) $(INCFILES) ../cfg/c64_8 telnetd.prg: telnetd.bin cartheader.prg cat cartheader.prg telnetd.bin > $@ -wizbobcart.bin: wizbobcart.o $(IP65WIZNETLIB) $(C64WIZNETLIB) $(INCFILES) ../cfg/c64_8kcart.cfg - $(LD) -m wizbobcart.map -vm -C ../cfg/c64_8kcart.cfg -o $@ $< $(IP65WIZNETLIB) $(C64WIZNETLIB) +wizbobcart.bin: wizbobcart.o $(IP65WIZNETLIB) $(C64WIZNETLIB) $(INCFILES) wizbobcart.cfg + $(LD) -m wizbobcart.map -vm -C wizbobcart.cfg -o $@ $< $(IP65WIZNETLIB) $(C64WIZNETLIB) ruby ../carts/fix_cart.rb $@ 8192 wizbobcart.prg: wizbobcart.bin cartheader.prg diff --git a/client/wiznet/telnetd.s b/client/wiznet/telnetd.s index 382d3d3..8fd9538 100644 --- a/client/wiznet/telnetd.s +++ b/client/wiznet/telnetd.s @@ -84,6 +84,7 @@ warm_init: @real_init: sta init_flag + ;we need to set up BASIC as well jsr $e453 ;set BASIC vectors jsr $e3bf ;initialize zero page @@ -103,6 +104,14 @@ warm_init: jsr copymem +;set normal BASIC colour + LDA #$0e ;light blue + STA $D020 ;border + LDA #$06 ;dark blue + STA $D021 ;background + lda #$9a + jsr print_a + ;copy KERNAL to RAM so we can patch it @@ -133,6 +142,10 @@ init_ok: ;install our new STOP handler + ldax ISTOP + stax old_stop_handler + ldax #stop_handler + stax ISTOP cli @@ -201,6 +214,8 @@ get_key: tick_handler: ;called at least 60hz via $314 + lda sending_flag + bne @done inc jiffy_count lda jiffy_count cmp #$06 ;about 100ms @@ -234,10 +249,10 @@ telnet_callback: beq @done lda (buffer_ptr),y -; cmp #$03 ;is ^C? -; bne @not_ctrl_c -; inc break_flag -; jmp @key_done + cmp #$03 ;is ^C? + bne @not_ctrl_c + inc break_flag + jmp @key_done @not_ctrl_c: inc NDX sta KEYD,x @@ -257,13 +272,26 @@ new_charout: pha ldax #1 sta tcp_send_data_len + sta sending_flag ldax #output_buffer jsr tcp_send + dec sending_flag pla ldx temp_x ldy temp_y jmp $e719 ;after the code we patched + +stop_handler: + + lda break_flag + beq @no_stop + lda #$7F + sta $91 + lda #0 + sta break_flag +@no_stop: + jmp (old_stop_handler) .bss init_flag: .res 1 @@ -276,7 +304,7 @@ output_buffer: .res 64 .data jiffy_count: .byte 0 break_flag: .byte 0 - +sending_flag: .byte 0 .rodata startup_msg: diff --git a/client/wiznet/wizbobcart.cfg b/client/wiznet/wizbobcart.cfg new file mode 100644 index 0000000..d947ebf --- /dev/null +++ b/client/wiznet/wizbobcart.cfg @@ -0,0 +1,27 @@ +# CA65 config for a Retro Replay cartridge +# default is for GAME=1, EXROM=0, + +MEMORY { + IP65ZP: start = $A3, size = $0E, type = rw, define = yes; + HEADER: start = $8000, size = $18, file = %O; + DEFAULTS: start = $8018, size = $1F, file = %O; + ROM: start = $8037, size = $1FC9, define = yes, file = %O; + RAM: start = $C010, size = $0fE0, define = yes; + RAM4: start = $7800, size = $07C9, define = yes; #scratch area for apps embedded in cart to use + + +} +SEGMENTS { + CARTRIDGE_HEADER: load = HEADER, type = ro; + IP65_DEFAULTS: load = DEFAULTS, type = ro; + CODE: load = ROM, type = ro; + RODATA: load = ROM, run=ROM, type = ro; + DATA: load = ROM, run = RAM, type = rw, define = yes; + BSS: load = RAM, type = bss; + IP65ZP: load = IP65ZP, type = zp; + SELF_MODIFIED_CODE: load = ROM, run = RAM4, type = rw, define = yes; + APP_SCRATCH: load = RAM4, type = bss; + TCP_VARS: load = RAM4, type = bss; + HTTP_VARS: load=ROM, run = RAM4, type = rw,define = yes; + + } diff --git a/client/wiznet/wizbobcart.s b/client/wiznet/wizbobcart.s index 3093a62..d996604 100644 --- a/client/wiznet/wizbobcart.s +++ b/client/wiznet/wizbobcart.s @@ -104,13 +104,15 @@ crunched_line = $0200 ;Input buffer .import __SELF_MODIFIED_CODE_SIZE__ temp_ptr =copy_src -temp=copy_src -temp2=copy_dest +;temp=copy_src +;temp2=copy_dest + +.segment "IP65ZP" : zeropage + +pptr: .res 2 +temp2: .res 2 +temp=pptr -;.zeropage -;temp: .res 2 -;temp2: .res 2 -pptr=temp_ptr .segment "CARTRIDGE_HEADER" .word cold_init ;cold start vector .word warm_init ;warm start vector @@ -140,15 +142,22 @@ warm_init: jmp $fe5e ; contine on to real RESTORE routine @real_init: sta init_flag + ;we need to set up BASIC as well jsr $e453 ;set BASIC vectors jsr $e3bf ;initialize zero page - +;set normal BASIC colour + LDA #$0e ;light blue + STA $D020 ;border + LDA #$06 ;dark blue + STA $D021 ;background + lda #$9a + jsr print_a ;make some room for extra RAM - ldax #$5800 + ldax #$7000 stax MEMSIZ stax http_variables_buffer @@ -217,6 +226,9 @@ install_new_vectors_loop: jsr $A644 ;do a "NEW" + +; jmp $A474 ;"READY" prompt ;FIXME - delete this line to autoload 'INDEX.BAS' + ldax #loading_index_bas jsr print @@ -908,6 +920,7 @@ goto: find_hook: jsr calc_hash + ldy #0 ldx hooks beq @done @@ -953,20 +966,25 @@ calc_hash: bne @loop @done: sta hash + +; ldax #transfer_buffer +; jsr print +; lda hash +; jsr print_hex +; jsr print_cr rts yield_keyword: jsr flush_keyword jsr tcp_close - .ifdef DEBUG - dec $d020 - .endif jmp httpd_start gosub: + bang_keyword: + jsr FRMEVL bit VALTYP bmi @string_val @@ -1017,6 +1035,7 @@ got_http_request: sta transfer_buffer,y sty param_length sty tmp_length + tya clc lda #'P' sta VARNAM @@ -1107,9 +1126,6 @@ httpd_start: bcs @abort_key_pressed @connect_ok: -.ifdef DEBUG - inc $d020 -.endif ldax #connection_from jsr print ldax #tcp_remote_ip @@ -1156,9 +1172,6 @@ httpd_start: lda connection_closed beq @main_polling_loop @connection_timed_out: -.ifdef DEBUG - dec $d020 -.endif jmp @listen @got_eol: @@ -1397,8 +1410,8 @@ xsend_keyword: JSR CHRIN ;(get a byte from file) sta error_buffer,y iny - - JMP @error_loop ; next byte + cpy #error_buffer_length-1 + bne @error_loop ; next byte @error_eof: lda #0 sta error_buffer,y @@ -1711,6 +1724,7 @@ temp_x: .res 1 sent_header: .res 1 tmp_a: .res 1 error_buffer: .res 80 +error_buffer_length=*-error_buffer top_of_stack: .res 1 .segment "TCP_VARS"