diff --git a/client/cfg/rrbin.cfg b/client/cfg/rrbin.cfg index 2712386..d5f6945 100644 --- a/client/cfg/rrbin.cfg +++ b/client/cfg/rrbin.cfg @@ -2,8 +2,7 @@ # default is for GAME=1, EXROM=0, MEMORY { - ZP: start = $02, size = $1A, type = rw, define = yes; - IP65ZP: start = $5f, size = $10, type = rw, define = yes; + IP65ZP: start = $A3, size = $0E, type = rw, define = yes; HEADER: start = $8000, size = $18, file = %O; ROM: start = $8018, size = $1F00, define = yes, file = %O; RAM: start = $C080, size = $0f80, define = yes; @@ -16,8 +15,5 @@ SEGMENTS { 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; - ZEROPAGE: load = ZP, type = zp; - - + IP65ZP: load = IP65ZP, type = zp; } diff --git a/client/clients/rrnetboot.s b/client/clients/rrnetboot.s index 6cc5bd5..144b6a7 100644 --- a/client/clients/rrnetboot.s +++ b/client/clients/rrnetboot.s @@ -68,10 +68,10 @@ .data exit_cart: -.if (BANKSWITCH_SUPPORT=$01) +.if (BANKSWITCH_SUPPORT=$02) lda #$02 sta $de00 ;turns off RR cartridge by modifying GROUND and EXROM -.elseif (BANKSWITCH_SUPPORT=$02) +.elseif (BANKSWITCH_SUPPORT=$01) lda #$36 sta $0001 ;turns off ordinary cartridge by modifying HIRAM/LORAM (this will also bank out BASIC) .endif @@ -245,6 +245,7 @@ init: lda nb65_param_buffer+NB65_TFTP_POINTER cmp #01 bne @not_a_basic_file + lda nb65_param_buffer+NB65_TFTP_POINTER+1 cmp #$08 bne @not_a_basic_file @@ -258,13 +259,15 @@ init: stx $2d ;save end-of-BASIC pointer (lo byte) sty $2e ;save end-of-BASIC pointer (hi byte) jsr $a659 ; CLR (reset variables) - ldax #$a7ae ; jump to BASIC interpreter loop + ldax #$a7ae ; jump to BASIC interpreter loop jmp exit_cart_via_ax @not_a_basic_file: ldax nb65_param_buffer+NB65_TFTP_POINTER exit_cart_via_ax: - stax call_downloaded_prg+1 + sta call_downloaded_prg+1 + stx call_downloaded_prg+2 + jmp exit_cart print_errorcode: @@ -364,10 +367,10 @@ press_a_key_to_continue: nb65_ram_stub: ; this gets copied to $C000 so programs can bank in the cartridge .byte $4E,$42,$36,$35 ; "NB65" - API signature -.if (BANKSWITCH_SUPPORT=$01) +.if (BANKSWITCH_SUPPORT=$02) lda #$01 sta $de00 ;turns on RR cartridge (since it will have been banked out when exiting to BASIC) -.elseif (BANKSWITCH_SUPPORT=$02) +.elseif (BANKSWITCH_SUPPORT=$01) lda #$37 sta $0001 ;turns on ordinary cartridge by modifying HIRAM/LORAM (this will also bank in BASIC) .endif diff --git a/client/inc/commonprint.i b/client/inc/commonprint.i index 4aa02c0..48da5fd 100644 --- a/client/inc/commonprint.i +++ b/client/inc/commonprint.i @@ -12,9 +12,10 @@ .export print .export print_decimal .import cs_driver_name +.importzp copy_src -.zeropage -pptr: .res 2 +;reuse the copy_src zero page var +pptr = copy_src .bss temp_bin: .res 1 temp_bcd: .res 2 diff --git a/client/ip65/function_dispatcher.s b/client/ip65/function_dispatcher.s index d53e310..1733f6b 100644 --- a/client/ip65/function_dispatcher.s +++ b/client/ip65/function_dispatcher.s @@ -39,10 +39,12 @@ .importzp copy_src .importzp copy_dest -.zeropage -nb65_params: .res 2 +;reuse the copy_src zero page location +nb65_params = copy_src .data + +old_ax: .res 2 jmp_old_irq: jmp $0000 @@ -91,7 +93,7 @@ set_tftp_params: nb65_dispatcher: stax nb65_params - + stax old_ax cpy #NB65_INITIALIZE @@ -128,12 +130,16 @@ irq_handler_installed: @after_tftp_call: ;write the current load address back to the param buffer (so if $0000 was passed in, the caller can find out the actual value used) bcs @tftp_error + ldax old_ax + stax nb65_params + ldy #NB65_TFTP_POINTER lda tftp_load_address sta (nb65_params),y iny lda tftp_load_address+1 - sta (nb65_params),y + sta (nb65_params),y + clc @tftp_error: @dns_error: