From: Alan Cox Date: Thu, 16 Nov 2017 15:00:51 +0000 (+0000) Subject: z80: fix short relative branches to unknown symbols X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=4ae25c5d25a54f92e62f1b9c9dc46418c096cac0;p=FUZIX.git z80: fix short relative branches to unknown symbols We now error them with a rather more useful message --- diff --git a/Applications/MWC/cmd/asz80/as.h b/Applications/MWC/cmd/asz80/as.h index 22840d1f..d281da3b 100644 --- a/Applications/MWC/cmd/asz80/as.h +++ b/Applications/MWC/cmd/asz80/as.h @@ -153,7 +153,7 @@ typedef uint16_t VALUE; /* For symbol values */ #define DATA_IN_ZP 27 #define REQUIRE_Z180 28 #define SEGMENT_CLASH 29 - +#define UNKNOWN_SYMBOL 30 #elif TARGET_6502 diff --git a/Applications/MWC/cmd/asz80/as1.c b/Applications/MWC/cmd/asz80/as1.c index 83400181..e9630b9e 100644 --- a/Applications/MWC/cmd/asz80/as1.c +++ b/Applications/MWC/cmd/asz80/as1.c @@ -265,7 +265,9 @@ loop: } istuser(&a1); disp = a1.a_value-dot[segment]-2; - if (disp<-128 || disp>127 || a1.a_segment != segment) + if (a1.a_segment == UNKNOWN) + aerr(UNKNOWN_SYMBOL); + else if (disp<-128 || disp>127 || a1.a_segment != segment) aerr(BRA_RANGE); outab(opcode); outab(disp); diff --git a/Applications/MWC/cmd/asz80/as6.c b/Applications/MWC/cmd/asz80/as6.c index 33372c5b..a4a75c8b 100644 --- a/Applications/MWC/cmd/asz80/as6.c +++ b/Applications/MWC/cmd/asz80/as6.c @@ -180,8 +180,10 @@ char *etext[] = { "constant out of range", "data in BSS", "segment overflow", + "", "Z180 instruction", - "segment conflict" + "segment conflict", + "unknown symbol" }; /*