From bc9de5643aa2a861b12d952b8e102dda11415e9d Mon Sep 17 00:00:00 2001 From: Jose Rodriguez Date: Fri, 8 Mar 2019 00:32:56 +0100 Subject: [PATCH] Fix error on multiple ORG When using ORG several times, if the assembled regions overlaps, sometimes declaring a label on top of an existing (assembled) instruction crashed the ASM. Fixed. --- asmparse.py | 1 - tests/functional/orgasm.asm | 15 +++++++++++++++ tests/functional/orgasm.bin | Bin 0 -> 8 bytes 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/functional/orgasm.asm create mode 100644 tests/functional/orgasm.bin diff --git a/asmparse.py b/asmparse.py index 934422842..045a66c58 100755 --- a/asmparse.py +++ b/asmparse.py @@ -525,7 +525,6 @@ def declare_label(self, label, lineno, value=None, local=False, namespace=None): self.local_labels[-1][ex_label] = Label(ex_label, lineno, value, local, namespace, is_address) self.set_memory_slot() - self.memory_bytes[self.org] += ('%s:' % ex_label,) return self.local_labels[-1][ex_label] diff --git a/tests/functional/orgasm.asm b/tests/functional/orgasm.asm new file mode 100644 index 000000000..20137aebe --- /dev/null +++ b/tests/functional/orgasm.asm @@ -0,0 +1,15 @@ + org 32768 +__START_PROGRAM: + di + exx + ld hl, 0 + + ;org 32768 + halt + halt + +__END_PROGRAM: +__END_PERA: + nop +__ENDPINA: + END diff --git a/tests/functional/orgasm.bin b/tests/functional/orgasm.bin new file mode 100644 index 0000000000000000000000000000000000000000..bee12b0d09d61c55c04dd16af429c280fd756012 GIT binary patch literal 8 Pcmex-Q;~t8tc(Ew5TgRx literal 0 HcmV?d00001