flag handling cleanup

This commit is contained in:
FeralChild64 committed 2020-07-31 17:02:43 +02:00
1 parent dd85061c47
commit 2c0e9e9511
2 files changed
+46 -13

No files matched your search

+43 -10
View File
@@ -15,21 +15,37 @@ assign_variable:
// Check for array
lda DIMFLG
bpl assign_variable_not_array
bpl assign_variable_not_array_1
// Retrieve all the dimensions
// Retrieve all the coordinates
// XXX implement this
ldx #$00
!:
inx
jsr helper_fetch_arr_coord
jmp do_NOT_IMPLEMENTED_error
lda LINNUM+0
pha
lda LINNUM+1
pha
// Check if more dimensions are given
cpy #$00
beq !+
// Push number of dimensions to stack
phx_trash_a
// Fetch assignment operator and continue
jsr injest_assign
jmp_8 assign_variable_common
lda #$FF // force DIMFLG to be array
jmp_8 assign_variable_common_1
assign_variable_not_array:
assign_variable_not_array_1:
// Require assignment operator
@@ -46,13 +62,14 @@ assign_variable_not_array:
jsr is_var_ST
beq_16 do_SYNTAX_error
// FALLTROUGH
assign_variable_common:
// Push the DIMFLG and VARNAM to the stack - it might get overridden
lda DIMFLG
// FALLTROUGH
assign_variable_common_1:
pha
lda VARNAM+0
pha
@@ -72,12 +89,28 @@ assign_variable_common:
pla
sta DIMFLG // XXX is it needed?
// Check if array
bpl assign_variable_not_array_2
//
// XXX add array handling here
//
jmp do_NOT_IMPLEMENTED_error
jmp_8 assign_variable_common_2
assign_variable_not_array_2:
// Retrieve the variable address
jsr fetch_variable_find_addr
// FALLTROUGH
assign_variable_common_2:
// Determine variable type
lda #$00
@@ -4,7 +4,7 @@
//
// Carry set = failure, not recognized variable name
// sets FOUR6 and DIMFLG ($80 for array, $00 for regular variable)
// sets FOUR6 and DIMFLG ($FF for array, $00 for regular variable)
fetch_variable_name:
@@ -89,7 +89,7 @@ fetch_variable_type_integer:
fetch_variable_type_string:
ldy #$03
lda #$80
lda #$FF
!:
sta VALTYP
sty FOUR6
@@ -119,7 +119,7 @@ fetch_variable_name_check_array:
!:
// This is an array
lda #$80
lda #$FF
sta DIMFLG
clc