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.
/* Disassemble one opcode */
{
unsigned I;
+ unsigned OldPC = PC;
/* Get the opcode from the current address */
unsigned char OPC = GetCodeByte (PC);
/* 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;