From dbb7cd6850d6866a89a200590270b23874f6e9a7 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 13 Nov 2017 14:14:37 +0000 Subject: [PATCH] as: trap unresolved subtractions as we can't currently represent them --- Applications/MWC/cmd/asz80/as3.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Applications/MWC/cmd/asz80/as3.c b/Applications/MWC/cmd/asz80/as3.c index b448ac77..62fc4add 100644 --- a/Applications/MWC/cmd/asz80/as3.c +++ b/Applications/MWC/cmd/asz80/as3.c @@ -66,6 +66,11 @@ static void chksegment(ADDR *left, ADDR *right, int op) } /* Subtraction within segment produces an absolute */ if (op == '-') { + /* We can't currently represent this and it's hard because + we'd actually need to pass the expression tree to the + linker. Only allow known symbols so that you can + do a-b providing a and b are in your object module */ +#if 0 /* Unknown symbols may get segment forced as a result */ if (left->a_segment == UNKNOWN) { left->a_segment = right->a_segment; @@ -77,6 +82,9 @@ static void chksegment(ADDR *left, ADDR *right, int op) if (right->a_sym) setsegment(right->a_sym, right->a_segment); } +#else + if (left->a_segment != UNKNOWN && right->a_segment != UNKNOWN) +#endif if (left->a_segment == right->a_segment && op == '-') { left->a_segment = ABSOLUTE; left->a_sym = NULL; -- 2.34.1