Skip to content

Commit 2197142

Browse files
committed
Bugfix: missing label err when no DATA is used
When no DATA sentence is used, but READ is, a missing label error shows because a default one is not output to signal the beginning of the DATA zone.
1 parent 500a49b commit 2197142

4 files changed

Lines changed: 1342 additions & 2 deletions

File tree

arch/zx48k/translator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ def emit_data_blocks(self):
190190
else:
191191
self.emit('data', self.TSUFFIX(d.value.type_), [self.traverse_const(d.value)])
192192

193+
if not gl.DATAS: # The above loop was not executed, because there's no data
194+
self.emit('label', '__DATA__0')
195+
193196
self.emit('vard', '__DATA__END', ['00'])
194197

195198
def emit_strings(self):

tests/functional/arrbase1.asm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ __END_PROGRAM:
5656
ret
5757
__CALL_BACK__:
5858
DEFW 0
59+
__DATA__0:
5960
__DATA__END:
6061
DEFB 00h
6162
#line 1 "array.asm"
@@ -257,7 +258,7 @@ __FNMUL2:
257258

258259
ENDP
259260

260-
#line 47 "arrbase1.bas"
261+
#line 48 "arrbase1.bas"
261262
#line 1 "read_restore.asm"
262263

263264
;; This implements READ & RESTORE functions
@@ -1544,7 +1545,7 @@ __DATA_ADDR: ;; Stores current DATA ptr
15441545

15451546

15461547

1547-
#line 48 "arrbase1.bas"
1548+
#line 49 "arrbase1.bas"
15481549

15491550
ZXBASIC_USER_DATA:
15501551
_k:

0 commit comments

Comments
 (0)