From f06f075517e35a64781a9ec6b773a5aba0b8e36d Mon Sep 17 00:00:00 2001 From: Phil Budne Date: Wed, 2 Mar 2016 15:40:52 -0500 Subject: [PATCH] fix subtraction with relative values (relative-relative)=absolute! --- tools/as7 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/as7 b/tools/as7 index 333c340..41b0c09 100755 --- a/tools/as7 +++ b/tools/as7 @@ -465,15 +465,29 @@ sub parse_expression { if ($op eq '+') { $word += $syllable; + $flags |= $sylflags; } elsif ($op eq '-') { $word -= $syllable; + if ($flags & $RELATIVE) { + # relative-relative => absolute! + if ($sylflags & $RELATIVE) { + $flags &= ~$RELATIVE; + } + # else: relative-abs => relative (no change) + } + else { # word is absolute + if ($sylflags & $RELATIVE) { + err('A', 'absolute value minus relative??'); + } + # else: absolute-absolute => absolute (no change) + } } else { $word |= $syllable; + $flags |= $sylflags; } $word &= 0777777; - $flags |= $sylflags; printf("\tsyllable: %#o word: %#o\n", $syllable, $word) if ($debug); } }