diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 62954140..217ffa26 100644 Binary files a/bin/basic_generic.rom and b/bin/basic_generic.rom differ diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index 697d6d9e..f7d37a5e 100644 Binary files a/bin/basic_ultimate64.rom and b/bin/basic_ultimate64.rom differ diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 90ede62c..4353929f 100644 Binary files a/bin/kernal_generic.rom and b/bin/kernal_generic.rom differ diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index 74418042..176de95c 100644 Binary files a/bin/kernal_ultimate64.rom and b/bin/kernal_ultimate64.rom differ diff --git a/bin/mega65.rom b/bin/mega65.rom index aa8a0643..eb0abc7e 100644 Binary files a/bin/mega65.rom and b/bin/mega65.rom differ diff --git a/bin/mega65_pxlfont.rom b/bin/mega65_pxlfont.rom index cabc4485..9e2a96b5 100644 Binary files a/bin/mega65_pxlfont.rom and b/bin/mega65_pxlfont.rom differ diff --git a/src/,,config_generic.s b/src/,,config_generic.s index 391de569..42fa2925 100644 --- a/src/,,config_generic.s +++ b/src/,,config_generic.s @@ -36,9 +36,9 @@ // Memory model -// #define CONFIG_MEMORY_MODEL_38K +#define CONFIG_MEMORY_MODEL_38K // #define CONFIG_MEMORY_MODEL_46K -#define CONFIG_MEMORY_MODEL_50K +// #define CONFIG_MEMORY_MODEL_50K // #define CONFIG_MEMORY_MODEL_60K diff --git a/src/,,config_ultimate64.s b/src/,,config_ultimate64.s index b463c918..e30ec05d 100644 --- a/src/,,config_ultimate64.s +++ b/src/,,config_ultimate64.s @@ -36,9 +36,9 @@ // Memory model -// #define CONFIG_MEMORY_MODEL_38K +#define CONFIG_MEMORY_MODEL_38K // #define CONFIG_MEMORY_MODEL_46K -#define CONFIG_MEMORY_MODEL_50K +// #define CONFIG_MEMORY_MODEL_50K // #define CONFIG_MEMORY_MODEL_60K diff --git a/src/basic/basic_commands/cmd_print.s b/src/basic/basic_commands/cmd_print.s index 2c81a2de..c4c260c2 100644 --- a/src/basic/basic_commands/cmd_print.s +++ b/src/basic/basic_commands/cmd_print.s @@ -29,8 +29,9 @@ cmd_print_loop: cmd_print_after_comma: - // Now evaluate the expression + // Now evaluate the expression and check what to print + jsr tmpstr_free_all jsr FRMEVL lda VALTYP bpl cmd_print_float diff --git a/src/basic/board_m65/mega65_imports.s b/src/basic/board_m65/mega65_imports.s index c7aa9c34..a9891af5 100644 --- a/src/basic/board_m65/mega65_imports.s +++ b/src/basic/board_m65/mega65_imports.s @@ -25,6 +25,7 @@ .label JREADST = KERNAL_0.JREADST .label plot_set = KERNAL_0.plot_set .label init_oldtxt = BASIC_0.init_oldtxt +.label tmpstr_free_all_reset = BASIC_0.tmpstr_free_all_reset .label rom_revision_basic_string = BASIC_0.rom_revision_basic_string .label print_hex_byte = BASIC_0.proxy_B1_print_hex_byte .label print_integer = BASIC_0.proxy_B1_print_integer diff --git a/src/basic/engine_runtime/do_new_clr_restore.s b/src/basic/engine_runtime/do_new_clr_restore.s index 0323e5ad..28fbfed7 100644 --- a/src/basic/engine_runtime/do_new_clr_restore.s +++ b/src/basic/engine_runtime/do_new_clr_restore.s @@ -71,10 +71,7 @@ do_clr: // This is a good place to reset the temporary string stack - lda #$19 - sta TEMPPT - lda #$16 - sta LASTPT + jsr tmpstr_free_all_reset // FALLTROUGH (confirmed on real C64 that CLR indeed resets DATPTR) diff --git a/src/basic/engine_variables/tmpstr_free.s b/src/basic/engine_variables/tmpstr_free.s index b9d6c494..5d0086b8 100644 --- a/src/basic/engine_variables/tmpstr_free.s +++ b/src/basic/engine_variables/tmpstr_free.s @@ -67,7 +67,7 @@ tmpstr_free_loop: sty DSCPNT+0 phx_trash_a - jsr varstr_free + jsr varstr_free_non_0 plx_trash_a // Mark empty string as free and quit diff --git a/src/basic/engine_variables/tmpstr_free_all.s b/src/basic/engine_variables/tmpstr_free_all.s index 6f5c354c..303cff6e 100644 --- a/src/basic/engine_variables/tmpstr_free_all.s +++ b/src/basic/engine_variables/tmpstr_free_all.s @@ -9,12 +9,32 @@ tmpstr_free_all: ldx #$19 - // XXX implement this - //FALLTROUGH tmpstr_free_all_loop: - // XXX finish, deduplicate part with CLR + // Free all the strings, one by one + + cpx TEMPPT + beq tmpstr_free_all_reset + + lda $00, x + beq !+ + + phx_trash_a + jsr varstr_free_non_0 + plx_trash_a +!: + inx + bne tmpstr_free_all_loop // branch always + +tmpstr_free_all_reset: // entry point for CLR + + // RESET TEMPPT and LASTPT to default values + + lda #$19 + sta TEMPPT + lda #$16 + sta LASTPT rts diff --git a/src/basic/engine_variables/varstr_free.s b/src/basic/engine_variables/varstr_free.s index 8d9b5f4f..1f57d165 100644 --- a/src/basic/engine_variables/varstr_free.s +++ b/src/basic/engine_variables/varstr_free.s @@ -16,9 +16,11 @@ varstr_free: // Check the string size - do not do anything if 0 lda DSCPNT+0 - bne !+ + bne varstr_free_non_0 rts -!: + +varstr_free_non_0: // entry point to be used when it is clear that string is not empty + // Check if string is above FRETOP (in string area) // XXX move this check out of the routine