From ebf8bf4eb773c6cc8e800ca6aa81e705a6de92b5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 26 Feb 2020 21:59:03 +0100 Subject: [PATCH] moved most of the LIST command to Mega65 extra ROM --- Makefile | 3 +- .../{packed_strings => assets}/packed_chars.s | 0 .../packed_keywords.s | 0 .../packed_tokens.s | 0 .../{packed_strings => assets}/packed_words.s | 0 .../board_m65/4000.mega65_vectable_basic_1.s | 2 + c64/basic/board_m65/mega65_imports.s | 6 +- c64/basic/board_m65/mega65_proxies.s | 26 ++++ c64/basic/commands/cmd_list.s | 114 +--------------- c64/basic/print/list_single_line.s | 127 ++++++++++++++++++ c64/basic/{ => print}/print_integer.s | 0 c64/basic/{ => print}/print_packed_message.s | 0 12 files changed, 165 insertions(+), 113 deletions(-) rename c64/basic/{packed_strings => assets}/packed_chars.s (100%) rename c64/basic/{packed_strings => assets}/packed_keywords.s (100%) rename c64/basic/{packed_strings => assets}/packed_tokens.s (100%) rename c64/basic/{packed_strings => assets}/packed_words.s (100%) create mode 100644 c64/basic/print/list_single_line.s rename c64/basic/{ => print}/print_integer.s (100%) rename c64/basic/{ => print}/print_packed_message.s (100%) diff --git a/Makefile b/Makefile index 75b7270a..548e3a58 100644 --- a/Makefile +++ b/Makefile @@ -12,13 +12,14 @@ SRCDIR_BASIC = $(SRCDIR_COMMON) \ c64/basic \ c64/basic/,stubs \ c64/basic/,stubs_math \ + c64/basic/assets \ c64/basic/board_m65 \ c64/basic/board_x16 \ c64/basic/commands \ c64/basic/init \ c64/basic/math \ c64/basic/math_consts \ - c64/basic/packed_strings \ + c64/basic/print \ c64/basic/rom_revision SRCDIR_KERNAL = $(SRCDIR_COMMON) \ diff --git a/c64/basic/packed_strings/packed_chars.s b/c64/basic/assets/packed_chars.s similarity index 100% rename from c64/basic/packed_strings/packed_chars.s rename to c64/basic/assets/packed_chars.s diff --git a/c64/basic/packed_strings/packed_keywords.s b/c64/basic/assets/packed_keywords.s similarity index 100% rename from c64/basic/packed_strings/packed_keywords.s rename to c64/basic/assets/packed_keywords.s diff --git a/c64/basic/packed_strings/packed_tokens.s b/c64/basic/assets/packed_tokens.s similarity index 100% rename from c64/basic/packed_strings/packed_tokens.s rename to c64/basic/assets/packed_tokens.s diff --git a/c64/basic/packed_strings/packed_words.s b/c64/basic/assets/packed_words.s similarity index 100% rename from c64/basic/packed_strings/packed_words.s rename to c64/basic/assets/packed_words.s diff --git a/c64/basic/board_m65/4000.mega65_vectable_basic_1.s b/c64/basic/board_m65/4000.mega65_vectable_basic_1.s index 6914ef45..52769961 100644 --- a/c64/basic/board_m65/4000.mega65_vectable_basic_1.s +++ b/c64/basic/board_m65/4000.mega65_vectable_basic_1.s @@ -12,11 +12,13 @@ // Label definitions .label VB1__INITMSG = $4000 + 2 * 0 + .label VB1__list_single_line = $4000 + 2 * 1 #else // Vector table (OpenROMs private!) .word INITMSG + .word list_single_line #endif diff --git a/c64/basic/board_m65/mega65_imports.s b/c64/basic/board_m65/mega65_imports.s index 4a82834f..c89a7161 100644 --- a/c64/basic/board_m65/mega65_imports.s +++ b/c64/basic/board_m65/mega65_imports.s @@ -8,13 +8,17 @@ #import "BASIC_0_combined.sym" +.label peek_under_roms = BASIC_0.proxy_B1_peek_under_roms .label JCHROUT = BASIC_0.proxy_B1_JCHROUT .label plot_set = KERNAL_0.plot_set - .label basic_do_new = BASIC_0.proxy_B1_basic_do_new +.label packed_keywords = BASIC_0.packed_keywords +.label packed_word_search = BASIC_0.packed_word_search .label rom_revision_basic_string = BASIC_0.rom_revision_basic_string .label print_integer = BASIC_0.proxy_B1_print_integer .label print_packed_message = BASIC_0.proxy_B1_print_packed_message +.label print_return = BASIC_0.proxy_B1_print_return +.label print_space = BASIC_0.proxy_B1_print_space #if CONFIG_SHOW_PAL_NTSC .label print_pal_ntsc = BASIC_0.proxy_B1_print_pal_ntsc #endif diff --git a/c64/basic/board_m65/mega65_proxies.s b/c64/basic/board_m65/mega65_proxies.s index f78b47b9..14d898cd 100644 --- a/c64/basic/board_m65/mega65_proxies.s +++ b/c64/basic/board_m65/mega65_proxies.s @@ -6,6 +6,17 @@ // +proxy_B1_peek_under_roms: + + jsr map_NORMAL +#if CONFIG_MEMORY_MODEL_60K + jsr peek_under_roms +#else // CONFIG_MEMORY_MODEL_38K + lda (OLDTXT),y +#endif + jmp map_BASIC_1 + + proxy_B1_JCHROUT: jsr map_NORMAL @@ -33,6 +44,21 @@ proxy_B1_print_packed_message: jsr print_packed_message jmp map_BASIC_1 + +proxy_B1_print_return: + + jsr map_NORMAL + jsr print_return + jmp map_BASIC_1 + + +proxy_B1_print_space: + + jsr map_NORMAL + jsr print_space + jmp map_BASIC_1 + + #if CONFIG_SHOW_PAL_NTSC proxy_B1_print_pal_ntsc: diff --git a/c64/basic/commands/cmd_list.s b/c64/basic/commands/cmd_list.s index 973ebc89..a1fcdb1d 100644 --- a/c64/basic/commands/cmd_list.s +++ b/c64/basic/commands/cmd_list.s @@ -11,6 +11,9 @@ cmd_list: // Set current line pointer to start of memory jsr init_oldtxt + // Always start with empty line, for readability + jsr print_return + list_loop: ldy #1 @@ -39,114 +42,3 @@ list_more_lines: // Now link to the next line jsr basic_find_next_line jmp list_loop - -list_single_line: // entry point needed by DOS wedge - // Print line number - ldy #3 - -#if CONFIG_MEMORY_MODEL_60K - jsr peek_under_roms -#else // CONFIG_MEMORY_MODEL_38K - lda (OLDTXT),y -#endif - - pha - dey - -#if CONFIG_MEMORY_MODEL_60K - jsr peek_under_roms -#else // CONFIG_MEMORY_MODEL_38K - lda (OLDTXT),y -#endif - - tax - pla - jsr print_integer - jsr print_space - - // Iterate through printing out the line - // contents - lda #0 - sta QTSW - - ldy #4 -list_print_loop: - -#if CONFIG_MEMORY_MODEL_60K - ldx #packed_keywords - sta FRESPC+1 - - // Subtract $80 from token to get offset in word - // list - txa - and #$7f - tax - - // Now ask for it to be printed - ldy #$ff - jsr packed_word_search - - ply_trash_a - pla - - cmp #$8f - bne list_not_rem - // REM command locks quote flag on until the end of the line, allowing - // funny characters in REM statements without problem. - sta QTSW // Any value other than $00 or $FF will lock quote mode on, so the token value of REM is fine here - // FALL THROUGH -list_not_rem: - - iny - bne list_print_loop // branch always - -list_is_pi: - lda #$7E - - // FALLTROUGH - -list_is_literal: - jsr JCHROUT - iny - bne list_print_loop - -list_end_of_line: - // Print end of line - jmp print_return diff --git a/c64/basic/print/list_single_line.s b/c64/basic/print/list_single_line.s new file mode 100644 index 00000000..e3936d88 --- /dev/null +++ b/c64/basic/print/list_single_line.s @@ -0,0 +1,127 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# M65 * #TAKE +// #LAYOUT# X16 BASIC_0 #TAKE +// #LAYOUT# * * #IGNORE + +list_single_line: + +#if (ROM_LAYOUT_M65 && SEGMENT_BASIC_0) + + jsr map_BASIC_1 + jsr_ind VB1__list_single_line + jmp map_NORMAL + +#else + + // Print line number + ldy #3 + +#if ROM_LAYOUT_M65 || CONFIG_MEMORY_MODEL_60K + jsr peek_under_roms +#else + lda (OLDTXT),y +#endif + + pha + dey + +#if ROM_LAYOUT_M65 || CONFIG_MEMORY_MODEL_60K + jsr peek_under_roms +#else + lda (OLDTXT),y +#endif + + tax + pla + jsr print_integer + jsr print_space + + // Iterate through printing out the line + // contents + lda #0 + sta QTSW + + ldy #4 +list_print_loop: + +#if ROM_LAYOUT_M65 || CONFIG_MEMORY_MODEL_60K + ldx #packed_keywords + sta FRESPC+1 + + // Subtract $80 from token to get offset in word + // list + txa + and #$7f + tax + + // Now ask for it to be printed + ldy #$ff + jsr packed_word_search + + ply_trash_a + pla + + cmp #$8f + bne list_not_rem + // REM command locks quote flag on until the end of the line, allowing + // funny characters in REM statements without problem. + sta QTSW // Any value other than $00 or $FF will lock quote mode on, so the token value of REM is fine here + // FALL THROUGH +list_not_rem: + + iny + bne list_print_loop // branch always + +list_is_pi: + lda #$7E + + // FALLTROUGH + +list_is_literal: + jsr JCHROUT + iny + bne list_print_loop + +list_end_of_line: + // Print end of line + jmp print_return + + +#endif // ROM layout diff --git a/c64/basic/print_integer.s b/c64/basic/print/print_integer.s similarity index 100% rename from c64/basic/print_integer.s rename to c64/basic/print/print_integer.s diff --git a/c64/basic/print_packed_message.s b/c64/basic/print/print_packed_message.s similarity index 100% rename from c64/basic/print_packed_message.s rename to c64/basic/print/print_packed_message.s