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 // Check for array
lda DIMFLG 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 // Fetch assignment operator and continue
jsr injest_assign 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 // Require assignment operator
@@ -46,13 +62,14 @@ assign_variable_not_array:
jsr is_var_ST jsr is_var_ST
beq_16 do_SYNTAX_error beq_16 do_SYNTAX_error
// FALLTROUGH
assign_variable_common:
// Push the DIMFLG and VARNAM to the stack - it might get overridden // Push the DIMFLG and VARNAM to the stack - it might get overridden
lda DIMFLG lda DIMFLG
// FALLTROUGH
assign_variable_common_1:
pha pha
lda VARNAM+0 lda VARNAM+0
pha pha
@@ -72,12 +89,28 @@ assign_variable_common:
pla pla
sta DIMFLG // XXX is it needed? sta DIMFLG // XXX is it needed?
// Check if array
bpl assign_variable_not_array_2
//
// XXX add array handling here // 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 // Retrieve the variable address
jsr fetch_variable_find_addr jsr fetch_variable_find_addr
// FALLTROUGH
assign_variable_common_2:
// Determine variable type // Determine variable type
lda #$00 lda #$00
@@ -4,7 +4,7 @@
// //
// Carry set = failure, not recognized variable name // 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: fetch_variable_name:
@@ -89,7 +89,7 @@ fetch_variable_type_integer:
fetch_variable_type_string: fetch_variable_type_string:
ldy #$03 ldy #$03
lda #$80 lda #$FF
!: !:
sta VALTYP sta VALTYP
sty FOUR6 sty FOUR6
@@ -119,7 +119,7 @@ fetch_variable_name_check_array:
!: !:
// This is an array // This is an array
lda #$80 lda #$FF
sta DIMFLG sta DIMFLG
clc clc