diff --git a/src/basic/engine/fetch_character.s b/src/basic/engine/fetch_character.s index 68397cc7..8c1dcc99 100644 --- a/src/basic/engine/fetch_character.s +++ b/src/basic/engine/fetch_character.s @@ -7,6 +7,9 @@ // +// For these configurations we have optimized version in another file +#if !(ROM_LAYOUT_M65 && (CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K)) + fetch_character: ldy #0 @@ -46,3 +49,6 @@ consume_character: #endif rts + + +#endif diff --git a/src/basic/engine/fetch_character_m65_46K_50K.s b/src/basic/engine/fetch_character_m65_46K_50K.s new file mode 100644 index 00000000..84363222 --- /dev/null +++ b/src/basic/engine/fetch_character_m65_46K_50K.s @@ -0,0 +1,42 @@ +// #LAYOUT# M65 BASIC_0 #TAKE-HIGH +// #LAYOUT# * * #IGNORE + +// +// Fetches a single character - optimized version +// + + +#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K + + +fetch_character: + + ldy #0 + + // Unmap BASIC lower ROM + + lda #$26 + sta CPU_R6510 + + // Retrieve value from under ROMs + + lda (TXTPTR), y + + // Restore memory mapping + + pha + lda #$27 + sta CPU_R6510 + pla + + // FALLTROUGH + +consume_character: + + // Advance basic text pointer + + inw TXTPTR + rts + + +#endif diff --git a/src/basic/engine/fetch_character_skip_spaces.s b/src/basic/engine/fetch_character_skip_spaces.s index c17eeab7..e67ffc82 100644 --- a/src/basic/engine/fetch_character_skip_spaces.s +++ b/src/basic/engine/fetch_character_skip_spaces.s @@ -6,6 +6,10 @@ // Fetches a single character, but skips spaces // + +// For these configurations we have optimized version in another file +#if !(ROM_LAYOUT_M65 && (CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K)) + fetch_character_skip_spaces: jsr fetch_character @@ -13,3 +17,6 @@ fetch_character_skip_spaces: beq fetch_character_skip_spaces rts + + +#endif diff --git a/src/basic/engine/fetch_character_skip_spaces_m65_46K_50K.s b/src/basic/engine/fetch_character_skip_spaces_m65_46K_50K.s new file mode 100644 index 00000000..9970a5ef --- /dev/null +++ b/src/basic/engine/fetch_character_skip_spaces_m65_46K_50K.s @@ -0,0 +1,41 @@ +// #LAYOUT# M65 BASIC_0 #TAKE-HIGH +// #LAYOUT# * * #IGNORE + +// +// Fetches a single character, but skips spaces - optimized version +// + + +#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K + + +fetch_character_skip_spaces: + + ldy #0 + + // Unmap BASIC lower ROM + + lda #$26 + sta CPU_R6510 + + // Retrieve value from under ROMs, advance text pointer +!: + lda (TXTPTR), y + inw TXTPTR + + // Skip space characters + + cmp #$20 + beq !- + + // Restore memory mapping + + pha + lda #$27 + sta CPU_R6510 + pla + + rts + + +#endif diff --git a/src/basic/memory/under_rom_peek_poke_46k_50k.s b/src/basic/memory/under_rom_peek_46k_50k.s similarity index 100% rename from src/basic/memory/under_rom_peek_poke_46k_50k.s rename to src/basic/memory/under_rom_peek_46k_50k.s