From 080ea5dab575bf8d636b97d33b1c4fd37f3e4ad7 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 18 Jul 2020 21:20:55 +0200 Subject: [PATCH] added missing code for some meory models --- src/,,config_custom.s | 4 +- .../helper_add_concat_46K_50K.s | 53 +++++++++++++++++++ src/basic/basic_operators/oper_add.s | 36 ++++++++++--- src/basic/engine/varstr_garbage_index_up_a.s | 8 +-- 4 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 src/basic/basic_operators/helper_add_concat_46K_50K.s diff --git a/src/,,config_custom.s b/src/,,config_custom.s index da689381..ad83a50a 100644 --- a/src/,,config_custom.s +++ b/src/,,config_custom.s @@ -39,9 +39,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_operators/helper_add_concat_46K_50K.s b/src/basic/basic_operators/helper_add_concat_46K_50K.s new file mode 100644 index 00000000..f777a3e3 --- /dev/null +++ b/src/basic/basic_operators/helper_add_concat_46K_50K.s @@ -0,0 +1,53 @@ +// #LAYOUT# STD * #TAKE-HIGH +// #LAYOUT# * BASIC_0 #TAKE-HIGH +// #LAYOUT# * * #IGNORE + +// This has to go $E000 or above - routines below banks out the main BASIC ROM! + +// +// Helper routine for string concatenation +// + + +#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K + +helper_add_concat: + + // Unmap BASIC lower ROM + + lda #$26 + sta CPU_R6510 + + // Copy data from the first string + + ldy #$00 +!: + lda (__FAC2+1),y + sta (INDEX),y + iny + cpy __FAC2+0 + bne !- + + // Increase INDEX pointer by the size of the 1st string + + tya + jsr varstr_INDEX_up_A + + // Copy data from the second string + + ldy #$00 +!: + lda (__FAC1+1),y + sta (INDEX),y + iny + cpy __FAC1+0 + bne !- + + // Restore default memory mapping + + lda #$27 + sta CPU_R6510 + + rts + +#endif diff --git a/src/basic/basic_operators/oper_add.s b/src/basic/basic_operators/oper_add.s index 46d124c7..1118acbf 100644 --- a/src/basic/basic_operators/oper_add.s +++ b/src/basic/basic_operators/oper_add.s @@ -73,16 +73,38 @@ oper_add_strings: #if CONFIG_MEMORY_MODEL_60K - // XXX - // XXX - // XXX + // Copy data from the first string + + ldy #$00 +!: + ldx #<(__FAC2+1) + jsr peek_under_roms + ldx #