From: Greg King Date: Tue, 31 Oct 2017 04:45:17 +0000 (-0400) Subject: Fixed the way that the disassembler looks for the end of a segment. X-Git-Tag: V2.17~81 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=de1f80571aa0d4c45fbcc67b184d70da65bee0a3;p=cc65 Fixed the way that the disassembler looks for the end of a segment. It checks only the bytes that actually were printed. It won't show a bad error message when disassembling address $0000. Fixes #506 on cc65's Github project. --- diff --git a/src/da65/main.c b/src/da65/main.c index 0b0bf19e7..1454d01fb 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -350,6 +350,7 @@ static void OneOpcode (unsigned RemainingBytes) /* Disassemble one opcode */ { unsigned I; + unsigned OldPC = PC; /* Get the opcode from the current address */ unsigned char OPC = GetCodeByte (PC); @@ -476,7 +477,7 @@ static void OneOpcode (unsigned RemainingBytes) /* Change back to the default CODE segment if ** a named segment stops at the current address. */ - for (I = D->Size; I >= 1; --I) { + for (I = PC - OldPC; I > 0; --I) { if (IsSegmentEnd (PC - I)) { EndSegment (); break;