From 8e2a91cbd6dcd69493e1672817e1b35a17a1255e Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 29 Jul 2020 06:21:21 +0200 Subject: [PATCH] started work on array element location --- src/basic/engine_variables/array_create.s | 11 ++- src/basic/engine_variables/fetch_variable.s | 28 ------ .../engine_variables/fetch_variable_arr.s | 12 +++ src/basic/engine_variables/find_array.s | 89 +++++++++++++++++++ .../find_array_next_46K_50K.s | 44 +++++++++ .../helper_cmp_varnam_38K_60K.s | 34 +++++++ 6 files changed, 186 insertions(+), 32 deletions(-) create mode 100644 src/basic/engine_variables/find_array.s create mode 100644 src/basic/engine_variables/find_array_next_46K_50K.s create mode 100644 src/basic/engine_variables/helper_cmp_varnam_38K_60K.s diff --git a/src/basic/engine_variables/array_create.s b/src/basic/engine_variables/array_create.s index 867d1e89..a8de236a 100644 --- a/src/basic/engine_variables/array_create.s +++ b/src/basic/engine_variables/array_create.s @@ -10,15 +10,18 @@ array_create: jsr fetch_variable_name bcs_16 do_SYNTAX_error - // XXX check if the array already exists + // Make sure the array does not exist + + jsr find_array + bcc_16 do_REDIMD_ARRAY_error // Push variable name and FOUR6 on the stack - fetching dimensions might cause // the to be overwritten by the expression parser - lda VARNAM+0 - pha lda VARNAM+1 pha + lda VARNAM+0 + pha lda FOUR6 pha @@ -180,7 +183,7 @@ array_create_store_dims_done: // Restore FOUR6, calculate number of bytes needed for storage pla - sta FOUR6 // XXX do we need to store this value in FOUR6? is it still needed? + sta FOUR6 // needed by variable fetch routine sta __FAC1+3 stx __FAC1+4 // .X is 0 at this point diff --git a/src/basic/engine_variables/fetch_variable.s b/src/basic/engine_variables/fetch_variable.s index 29957635..7333ab14 100644 --- a/src/basic/engine_variables/fetch_variable.s +++ b/src/basic/engine_variables/fetch_variable.s @@ -57,36 +57,8 @@ fetch_variable_find_addr_loop: beq fetch_variable_alocate !: // Compare current variable name with searched one - // XXX consider creating optimized version for 46K/50K memory models -#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K jsr helper_cmp_varnam -#else - - ldy #$00 - -#if CONFIG_MEMORY_MODEL_60K - ldx #