Skip to content

Commit 7dffe3d

Browse files
committed
Add end user's code MARK
Useful for debugging purposes
1 parent 4b67e6f commit 7dffe3d

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/arch/zx48k/backend/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,10 +1771,14 @@ def _inline(ins):
17711771

17721772
i = 0
17731773
while i < len(tmp):
1774-
if not tmp[i] or tmp[i][0] == ';': # a comment or empty string?
1774+
if not tmp[i]: # discard empty lines
17751775
tmp.pop(i)
17761776
continue
17771777

1778+
if not tmp[i] or tmp[i][0] == ';': # a comment
1779+
i += 1
1780+
continue
1781+
17781782
if tmp[i][0] == '#': # A preprocessor directive
17791783
i += 1
17801784
continue
@@ -2329,7 +2333,7 @@ def remove_unused_labels(output: List[str]):
23292333
output.pop(i)
23302334

23312335

2332-
def emit(mem, optimize=True):
2336+
def emit(mem: List[Quad], optimize=True):
23332337
""" Begin converting each quad instruction to asm
23342338
by iterating over the "mem" array, and called its
23352339
associated function. Each function returns an array of

src/libzxbc/zxbc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ def main(args=None, emitter=None):
251251
translator.emit_strings()
252252
# Emits jump tables
253253
translator.emit_jump_tables()
254+
# Signals end of user code
255+
translator.ic_inline(';; --- end of user code ---', zxblex.lexer.lineno)
254256

255257
if OPTIONS.emitBackend:
256258
with open_file(OPTIONS.outputFileName, 'wt', 'utf-8') as output_file:

0 commit comments

Comments
 (0)