Skip to content

Commit 29e6c4f

Browse files
committed
Fix crash upon constant dim declaration
1 parent f7d7eeb commit 29e6c4f

3 files changed

Lines changed: 55 additions & 2 deletions

File tree

symbols/bound.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ def make_node(lower, upper, lineno):
4848
syntax_error(lineno, 'Array bounds must be constants')
4949
return None
5050

51-
if isinstance(lower, SymbolVAR):
51+
while isinstance(lower, SymbolVAR):
5252
lower = lower.value
5353
if lower is None: # semantic error
5454
syntax_error(lineno, "Unknown lower bound for array dimension")
5555
return
5656

57-
if isinstance(upper, SymbolVAR):
57+
while isinstance(upper, SymbolVAR):
5858
upper = upper.value
5959
if upper is None: # semantic error
6060
syntax_error(lineno, "Unknown upper bound for array dimension")
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
org 32768
2+
__START_PROGRAM:
3+
di
4+
push ix
5+
push iy
6+
exx
7+
push hl
8+
exx
9+
ld hl, 0
10+
add hl, sp
11+
ld (__CALL_BACK__), hl
12+
ei
13+
ld hl, 0
14+
ld b, h
15+
ld c, l
16+
__END_PROGRAM:
17+
di
18+
ld hl, (__CALL_BACK__)
19+
ld sp, hl
20+
exx
21+
pop hl
22+
exx
23+
pop iy
24+
pop ix
25+
ei
26+
ret
27+
__CALL_BACK__:
28+
DEFW 0
29+
ZXBASIC_USER_DATA:
30+
_mobCoords:
31+
DEFW __LABEL0
32+
_mobCoords.__DATA__.__PTR__:
33+
DEFW _mobCoords.__DATA__
34+
_mobCoords.__DATA__:
35+
DEFB 00h
36+
DEFB 00h
37+
DEFB 00h
38+
DEFB 00h
39+
DEFB 00h
40+
DEFB 00h
41+
__LABEL0:
42+
DEFW 0001h
43+
DEFW 0002h
44+
DEFB 01h
45+
; Defines DATA END --> HEAP size is 0
46+
ZXBASIC_USER_DATA_END:
47+
; Defines USER DATA Length in bytes
48+
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
49+
END
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const MHEIGHT as ubyte = 2
2+
const MAXMOBS as ubyte = MHEIGHT
3+
dim mobCoords(0 to MAXMOBS, 0 to 1) as ubyte
4+

0 commit comments

Comments
 (0)