diff --git a/src/basic/engine_variables/assign_variable.s b/src/basic/engine_variables/assign_variable.s index e593457d..d3508295 100644 --- a/src/basic/engine_variables/assign_variable.s +++ b/src/basic/engine_variables/assign_variable.s @@ -10,14 +10,15 @@ assign_variable: jsr fetch_variable_name bcs_16 do_SYNTAX_error - jsr injest_assign - // Check for array lda DIMFLG bpl assign_variable_not_array_1 - // Retrieve all the coordinates + // This is an array - store FOUR6 on the stack, retrieve all the coordinates + + lda FOUR6 + pha ldx #$00 !: @@ -32,9 +33,9 @@ assign_variable: // Check if more dimensions are given cpy #$00 - beq !+ + beq !- - // Push number of dimensions to stack + // Store number of dimensions on the stack phx_trash_a @@ -93,12 +94,15 @@ assign_variable_common_1: bpl assign_variable_not_array_2 - // - // XXX add array handling here - // + // Yes, this is an array - fetch the number of dimensions - jmp do_NOT_IMPLEMENTED_error + pla + sta __FAC1+0 + tax + // Fetch the address of the variable +.break + jsr fetch_variable_arr_calc_pos jmp_8 assign_variable_common_2 assign_variable_not_array_2: diff --git a/src/basic/engine_variables/fetch_variable_arr.s b/src/basic/engine_variables/fetch_variable_arr.s index 32a2ae10..ede9f16c 100644 --- a/src/basic/engine_variables/fetch_variable_arr.s +++ b/src/basic/engine_variables/fetch_variable_arr.s @@ -41,6 +41,10 @@ fetch_variable_arr_fetch_coords_loop: cpy #$00 beq fetch_variable_arr_fetch_coords_loop + // Store number of dimensions, will be needed later + + stx __FAC1+0 + // FALLTROUGH fetch_variable_arr_check_dimensions: @@ -69,10 +73,6 @@ fetch_variable_arr_check_dimensions: bne_16 do_BAD_SUBSCRIPT_error - // Store number of dimensions, will be needed later - - stx __FAC1+0 - // FALLTROUGH fetch_variable_arr_calc_pos: diff --git a/src/basic/engine_variables/helper_fetch_arr_coord.s b/src/basic/engine_variables/helper_fetch_arr_coord.s index 6329fbde..364b69ee 100644 --- a/src/basic/engine_variables/helper_fetch_arr_coord.s +++ b/src/basic/engine_variables/helper_fetch_arr_coord.s @@ -26,9 +26,7 @@ helper_fetch_arr_coord: beq helper_fetch_arr_last // FALLTROUGH - !: - jmp do_SYNTAX_error helper_fetch_arr_more: