Skip to content

Commit 617a355

Browse files
authored
Merge pull request #383 from boriel/bugfix/dim_arr_at_wrong
Fix bug in dim array AT
2 parents 40dbd32 + 60a3d06 commit 617a355

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

arch/zx48k/translator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,8 @@ def visit_ARRAYDECL(self, node):
11181118
arr_data = []
11191119

11201120
if entry.addr:
1121-
self.ic_deflabel(data_label, "%s" % entry.addr)
1121+
addr = self.traverse_const(entry.addr) if isinstance(entry.addr, symbols.SYMBOL) else entry.addr
1122+
self.ic_deflabel(data_label, "%s" % addr)
11221123
else:
11231124
if entry.default_value is not None:
11241125
arr_data = Translator.array_default_value(node.type_, entry.default_value)

tests/functional/dim_arr_at_label0.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ __END_PROGRAM:
2828
__CALL_BACK__:
2929
DEFW 0
3030
ZXBASIC_USER_DATA:
31-
_a.__DATA__ EQU ADDRESS(c)
31+
_a.__DATA__ EQU __LABEL__c
3232
_a:
3333
DEFW __LABEL0
3434
_a.__DATA__.__PTR__:

tests/functional/dim_arr_at_label1.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ __END_PROGRAM:
2828
__CALL_BACK__:
2929
DEFW 0
3030
ZXBASIC_USER_DATA:
31-
_a.__DATA__ EQU ADDRESS(c) PLUS 1
31+
_a.__DATA__ EQU (__LABEL__c) + (1)
3232
_a:
3333
DEFW __LABEL0
3434
_a.__DATA__.__PTR__:

0 commit comments

Comments
 (0)