Skip to content

Commit f730156

Browse files
Support multiple arrays in DIM
1 parent 1cb00fa commit f730156

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

dim.s

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ exec_dim:
1515
ldax array_name_table_ptr ; Look for the name in the name table
1616
jsr find_name
1717
bcc @already_dimensioned
18-
jmp dimension_array ; Go do it
18+
jsr dimension_array ; Go do it
19+
jsr peek_byte ; Check for comma (more arrays)
20+
cmp #','
21+
bne @done ; No more arrays
22+
inc line_pos ; Skip ','
23+
bne exec_dim ; Unconditional: loop for next array
24+
25+
@done:
26+
rts
1927

2028
@invalid_variable:
2129
jmp raise_invalid_variable

expect_tests/array.exp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,14 @@ PRINT M(1,1),M(2,2),M(4,3),M(5,5)
4949
} {
5050
1 4 12 25
5151
}
52+
53+
# Multiple arrays in one DIM
54+
55+
test {
56+
DIM P(10),Q(20)
57+
LET P(5)=50
58+
LET Q(15)=150
59+
PRINT P(5),Q(15)
60+
} {
61+
50 150
62+
}

parser.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ statement_name_table:
847847
: name_table_entry "NEW"
848848
: name_table_entry "CLR"
849849
: name_table_entry "DIM"
850-
JUMP pvm_var
850+
JUMP pvm_var_list
851851
: name_table_entry "REM"
852852
JUMP pvm_text
853853
: name_table_entry "DATA"

0 commit comments

Comments
 (0)