various array related fixes

This commit is contained in:
FeralChild64 committed 2020-08-01 12:50:27 +02:00
1 parent 2c0e9e9511
commit 60e2bc5299
3 files changed
+17 -15

No files matched your search

+13 -9
View File
@@ -10,14 +10,15 @@ assign_variable:
jsr fetch_variable_name jsr fetch_variable_name
bcs_16 do_SYNTAX_error bcs_16 do_SYNTAX_error
jsr injest_assign
// Check for array // Check for array
lda DIMFLG lda DIMFLG
bpl assign_variable_not_array_1 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 ldx #$00
!: !:
@@ -32,9 +33,9 @@ assign_variable:
// Check if more dimensions are given // Check if more dimensions are given
cpy #$00 cpy #$00
beq !+ beq !-
// Push number of dimensions to stack // Store number of dimensions on the stack
phx_trash_a phx_trash_a
@@ -93,12 +94,15 @@ assign_variable_common_1:
bpl assign_variable_not_array_2 bpl assign_variable_not_array_2
// // Yes, this is an array - fetch the number of dimensions
// XXX add array handling here
//
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 jmp_8 assign_variable_common_2
assign_variable_not_array_2: assign_variable_not_array_2:
@@ -41,6 +41,10 @@ fetch_variable_arr_fetch_coords_loop:
cpy #$00 cpy #$00
beq fetch_variable_arr_fetch_coords_loop beq fetch_variable_arr_fetch_coords_loop
// Store number of dimensions, will be needed later
stx __FAC1+0
// FALLTROUGH // FALLTROUGH
fetch_variable_arr_check_dimensions: fetch_variable_arr_check_dimensions:
@@ -69,10 +73,6 @@ fetch_variable_arr_check_dimensions:
bne_16 do_BAD_SUBSCRIPT_error bne_16 do_BAD_SUBSCRIPT_error
// Store number of dimensions, will be needed later
stx __FAC1+0
// FALLTROUGH // FALLTROUGH
fetch_variable_arr_calc_pos: fetch_variable_arr_calc_pos:
@@ -26,9 +26,7 @@ helper_fetch_arr_coord:
beq helper_fetch_arr_last beq helper_fetch_arr_last
// FALLTROUGH // FALLTROUGH
!: !:
jmp do_SYNTAX_error jmp do_SYNTAX_error
helper_fetch_arr_more: helper_fetch_arr_more: