changeset 16:a2a81589380d default tip

Reformat the whole source via clang-format for better consistency.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 14 Oct 2021 01:53:20 +0300
parents 89183953bddc
children
files dump.c label.c main.c opcodes.h proto.h scan.c structures.h table.c vector.c
diffstat 9 files changed, 1777 insertions(+), 1772 deletions(-) [+]
line wrap: on
line diff
--- a/dump.c	Thu Oct 14 01:40:24 2021 +0300
+++ b/dump.c	Thu Oct 14 01:53:20 2021 +0300
@@ -27,300 +27,290 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "proto.h"
+#include "opcodes.h"
 #include "options.h"
-#include "opcodes.h"
+#include "proto.h"
 
-void Dump (void)
+void Dump(void)
 {
-  ADDR_T address, addr;
-  unsigned counter, size, maxwidth;
-  char *lineprefix, *lineinfix;
-  table *entry;
-  opcodes *instr;
+    ADDR_T address, addr;
+    unsigned counter, size, maxwidth;
+    char *lineprefix, *lineinfix;
+    table *entry;
+    opcodes *instr;
 
-  if (fVerbose)
-    fprintf (stderr, "%s: Dumping the source code.\n", prog);
+    if (fVerbose)
+        fprintf(stderr, "%s: Dumping the source code.\n", prog);
 
-  /* determine the maximum amount of bytes dumped per line */
-
-  maxwidth = listwidth < 2 ? 2 : listwidth;
+    /* determine the maximum amount of bytes dumped per line */
 
-  for (counter = 0; counter < 256; counter++)
-    if (maxwidth < sizes[opset[counter].admode])
-      maxwidth = sizes[opset[counter].admode];
+    maxwidth = listwidth < 2 ? 2 : listwidth;
 
-  /* create prefix string for lines without address information */
-  switch (Options & M_ADDRESSES) {
-  case O_ADR_ADRPFIX:
-    counter = 5;
-    break;
+    for (counter = 0; counter < 256; counter++)
+        if (maxwidth < sizes[opset[counter].admode])
+            maxwidth = sizes[opset[counter].admode];
 
-  case O_ADR_ADR_DMP:
-    counter = 5 + 3 * maxwidth;
-    break;
+    /* create prefix string for lines without address information */
+    switch (Options & M_ADDRESSES)
+    {
+    case O_ADR_ADRPFIX:
+        counter = 5;
+        break;
 
-  default:
-    counter = 0;
-  }
-
-  lineprefix = malloc (counter + 1);
+    case O_ADR_ADR_DMP:
+        counter = 5 + 3 * maxwidth;
+        break;
 
-  if (counter >= 5) {
-    lineinfix = lineprefix + 5;
+    default:
+        counter = 0;
+    }
 
-    for (lineprefix[counter] = 0; counter--; lineprefix[counter] = ' ');
-  }
-  else {
-    *lineprefix = 0;
-    lineinfix = lineprefix;
-  }
+    lineprefix = malloc(counter + 1);
+
+    if (counter >= 5)
+    {
+        lineinfix = lineprefix + 5;
 
-  /* print the label definitions */
-  for (address = EndAddress < StartAddress ? EndAddress : 0;
-       address != StartAddress; address++)
-  {
-    if (IsLabeled (address) && !IsInsideRegion(address) && IsReferenced(address))
+        for (lineprefix[counter] = 0; counter--; lineprefix[counter] = ' ');
+    }
+    else
     {
-      fprintf (stdout, "%s%s = $%x\n", lineprefix, Label (address, abso, 0),
-	address);
+        *lineprefix = 0;
+        lineinfix = lineprefix;
     }
-  }
 
-  if (EndAddress >= StartAddress)
-  {
-    for (address = EndAddress; address; address++)
+    /* print the label definitions */
+    for (address = EndAddress < StartAddress ? EndAddress : 0; address != StartAddress; address++)
     {
-      if (IsLabeled (address) && !IsInsideRegion(address) && IsReferenced(address))
-      {
-        fprintf (stdout, "%s%s = $%x\n", lineprefix, Label (address, abso, 0),
-		address);
-      }
+        if (IsLabeled(address) && !IsInsideRegion(address) && IsReferenced(address))
+        {
+            fprintf(stdout, "%s%s = $%x\n", lineprefix, Label(address, abso, 0), address);
+        }
     }
-  }
 
-  /* dump the program */
-  fprintf(stdout, "\n\n");
-
-  if(Options & B_SA_WORD)
-	fprintf(stdout, "%s\t.word $%04x", lineprefix, StartAddress);
-
-  fprintf (stdout, "\n%s\t* = $%04x\n\n", lineprefix, StartAddress);
-  if(BasicHeaderLength)
-	fprintf(stdout, "; %d byte BASIC header.\n", BasicHeaderLength);
-
-
-  for (address = StartAddress; (ADDR_T)(address - StartAddress) <
-       (ADDR_T)(EndAddress - StartAddress); address += size)
-    if (GetMemType (address) == MEM_INSTRUCTION) {
+    if (EndAddress >= StartAddress)
+    {
+        for (address = EndAddress; address; address++)
+        {
+            if (IsLabeled(address) && !IsInsideRegion(address) && IsReferenced(address))
+            {
+                fprintf(stdout, "%s%s = $%x\n", lineprefix, Label(address, abso, 0), address);
+            }
+        }
+    }
 
-      if (IsLabeled (address) && IsReferenced(address)) {
-	if (Options & M_ADDRESSES)
-	  fprintf (stdout, "%04x %s%s:\n", address,
-                   lineinfix, Label (address, abso, 0));
-	else {
-	  fprintf (stdout, "%s", Label (address, abso, 0));
-		if (Options & B_LABCOL)
-			fprintf(stdout, ":\n");
-	}
-      }
+    /* dump the program */
+    fprintf(stdout, "\n\n");
+
+    if (Options & B_SA_WORD)
+        fprintf(stdout, "%s\t.word $%04x", lineprefix, StartAddress);
 
-      instr = &opset[Memory[address]];
-      size = sizes[instr->admode];
+    fprintf(stdout, "\n%s\t* = $%04x\n\n", lineprefix, StartAddress);
+    if (BasicHeaderLength)
+        fprintf(stdout, "; %d byte BASIC header.\n", BasicHeaderLength);
 
-      for (counter = 1; counter < size; counter++) {
-        if (IsLabeled (address + counter))
+    for (address = StartAddress; (ADDR_T)(address - StartAddress) < (ADDR_T)(EndAddress - StartAddress);
+         address += size)
+        if (GetMemType(address) == MEM_INSTRUCTION)
         {
-	  if (Options & M_ADDRESSES)
-	    fprintf (stdout, "\t%04x %s%s = * + %u\n",
-                     (ADDR_T)(address + counter),
-		     lineinfix, Label (address + counter, abso, 0), counter);
-	  else
-	    fprintf (stdout, "\t%s = * + %u\n",
-		     Label (address + counter, abso, 0), counter);
-	}
+
+            if (IsLabeled(address) && IsReferenced(address))
+            {
+                if (Options & M_ADDRESSES)
+                    fprintf(stdout, "%04x %s%s:\n", address, lineinfix, Label(address, abso, 0));
+                else
+                {
+                    fprintf(stdout, "%s", Label(address, abso, 0));
+                    if (Options & B_LABCOL)
+                        fprintf(stdout, ":\n");
+                }
+            }
 
-        if (FindNextEntry (NULL, address, ~0, WRN_INSTR_WRITTEN_TO))
-          fprintf (stdout, "%s; Instruction opcode $%04x accessed.\n",
-                   lineprefix, address);
-
-        entry = NULL;
+            instr = &opset[Memory[address]];
+            size = sizes[instr->admode];
 
-        while ((entry = FindNextEntry (entry, address + counter, 0, 0)))
-          switch (entry->type) {
-          case WRN_PARAM_WRITTEN_TO:
-            fprintf (stdout, "%s; Instruction parameter $%04x accessed.\n",
-		     lineprefix, address + counter);
-            break;
+            for (counter = 1; counter < size; counter++)
+            {
+                if (IsLabeled(address + counter))
+                {
+                    if (Options & M_ADDRESSES)
+                        fprintf(stdout, "\t%04x %s%s = * + %u\n", (ADDR_T)(address + counter), lineinfix,
+                                Label(address + counter, abso, 0), counter);
+                    else
+                        fprintf(stdout, "\t%s = * + %u\n", Label(address + counter, abso, 0), counter);
+                }
 
-          case WRN_PARAM_JUMPED_TO:
-            fprintf (stdout, "%s; Instruction parameter $%04x jumped to.\n",
-		     lineprefix, address + counter);
-            break;
-          }
-      }
+                if (FindNextEntry(NULL, address, ~0, WRN_INSTR_WRITTEN_TO))
+                    fprintf(stdout, "%s; Instruction opcode $%04x accessed.\n", lineprefix, address);
+
+                entry = NULL;
+
+                while ((entry = FindNextEntry(entry, address + counter, 0, 0)))
+                    switch (entry->type)
+                    {
+                    case WRN_PARAM_WRITTEN_TO:
+                        fprintf(stdout, "%s; Instruction parameter $%04x accessed.\n", lineprefix, address + counter);
+                        break;
 
-      switch (Options & M_ADDRESSES) {
-      case O_ADR_ADRPFIX:
-	fprintf (stdout, "%04x ", address);
-	break;
-
-      case O_ADR_ADR_DMP:
-	fprintf (stdout, "%04x ", address);
+                    case WRN_PARAM_JUMPED_TO:
+                        fprintf(stdout, "%s; Instruction parameter $%04x jumped to.\n", lineprefix, address + counter);
+                        break;
+                    }
+            }
 
-	for (counter = 0; counter < size; counter++)
-	  fprintf (stdout, "%02x ", Memory[(ADDR_T)(address + counter)]);
+            switch (Options & M_ADDRESSES)
+            {
+            case O_ADR_ADRPFIX:
+                fprintf(stdout, "%04x ", address);
+                break;
 
-	fputs (lineinfix + 3 * counter, stdout);
-      }
+            case O_ADR_ADR_DMP:
+                fprintf(stdout, "%04x ", address);
 
-      fputs ("\t", stdout);
+                for (counter = 0; counter < size; counter++)
+                    fprintf(stdout, "%02x ", Memory[(ADDR_T)(address + counter)]);
 
-      switch (instr->admode) {
-      case accu:
-      case impl:
-        fprintf (stdout, "%s%s\n", mne[instr->mnemonic],
-                 postfix[instr->admode]);
-        break;
-      case imm:
-        addr = Memory[(ADDR_T)(address + 1)];
-        fprintf (stdout, "%s #$%02x\n", mne[instr->mnemonic], addr);
-        break;
-      case abso:
-      case absx:
-      case absy:
-      case iabs:
-      case iabsx:
-        addr = Memory[(ADDR_T)(address + 1)] |
-          (Memory[(ADDR_T)(address + 2)] << 8);
-          /* Fix to ensure 16-bit addresses to zero-page are maintained as 16-bit */
-          fprintf (stdout, "%s %s%s%s%s\n", mne[instr->mnemonic],
-		prefix[instr->admode],
-                   ((addr < 256 && instr->mnemonic != S_JMP &&
-			instr->mnemonic != S_JSR) ? "!" : ""),
-                   Label (addr, abso, 1), postfix[instr->admode]);
-        break;
-      case zp:
-      case zpx:
-      case zpy:
-      case ind:
-      case indx:
-      case indy:
-        addr = Memory[(ADDR_T)(address + 1)];
-        fprintf (stdout, "%s %s%s%s\n", mne[instr->mnemonic],
-                 prefix[instr->admode], Label (addr, zp, 1),
-                 postfix[instr->admode]);
-        break;
-      case rel:
-        addr = (int)(char)Memory[(ADDR_T)(address + 1)];
-	/* addr -= (addr > 127) ? 256 : 0; BUGFIX: sign extend already done */
-/*fprintf(stderr, "%d %d %d\n", address, size, addr);*/
-        addr += address + size;
-        fprintf (stdout, "%s %s%s%s\n", mne[instr->mnemonic],
-                 prefix[instr->admode], Label (addr, abso, 1),
-                 postfix[instr->admode]);
-        break;
-      case zrel: /* BBR0, etc. 65C02 instructions */
-        addr = (int)(char)Memory[(ADDR_T)(address + 2)];
-	/* addr -= (addr > 127) ? 256 : 0; BUGFIX: sign extend already done */
-        addr += address + size;
-        fprintf (stdout, "%s %s, %s\n", mne[instr->mnemonic],
-                Label (Memory[(ADDR_T)(address + 1)], abso, 1),
-		Label (addr, abso, 1));
-        break;
-      }
-    }
-    else if (address != (addr = WordTableEnd (address))) { /* word table */
-      for (size = (ADDR_T)(addr - address); size;
-	   address += (counter = size > (maxwidth & ~1) ?
-                       (maxwidth & ~1) : size), size -= counter) {
-	if (IsLabeled (address)) {
-	  if (Options & M_ADDRESSES)
-	    fprintf (stdout, "%04x %s%s:\n", address, lineinfix,
-                     Label (address, abso, 0));
-	  else
-	    fprintf (stdout, "%s ", Label (address, abso, 0));
-	}
-	for (counter = size > (maxwidth & ~1) ? (maxwidth & ~1) : size,
-	     addr = address + 1; --counter; addr++)
-	  if (IsLabeled (addr)) {
-	    if (Options & M_ADDRESSES)
-	      fprintf (stdout, "%04x %s%s = * + %u\n", addr, lineinfix,
-		       Label (addr, abso, 0), (ADDR_T)(addr - address));
-	    else
-	      fprintf (stdout, "\t%s = * + %u\n", Label (addr, abso, 0),
-		       (ADDR_T)(addr - address));
-	  }
+                fputs(lineinfix + 3 * counter, stdout);
+            }
+
+            fputs("\t", stdout);
 
-	if (Options & M_ADDRESSES)
-	  fprintf (stdout, "%04x ", address);
-
-	if ((Options & M_ADDRESSES) == O_ADR_ADR_DMP) {
-	  for (counter = size > (maxwidth & ~1) ? (maxwidth & ~1) : size,
-	       addr = address; counter--; addr++) {
-	    fprintf (stdout, "%02x ", Memory[addr]);
-	  }
-	  fputs (lineinfix + 3 * (size > (maxwidth & ~1) ?
-				  (maxwidth & ~1) : size), stdout);
-	}
-
-	fprintf (stdout, "  .word %s",
-		 Label (Memory[address] |
-                 (Memory[(ADDR_T)(address + 1)] << 8), abso, 0));
-
-	for (counter = size > (maxwidth & ~1) ? (maxwidth & ~1) : size,
-	     addr = address + 2; counter -= 2; addr += 2)
-	  fprintf (stdout, ",%s",
-		   Label (Memory[addr] | (Memory[(ADDR_T)(addr + 1)] << 8),
-			abso, 0));
-			
-
-	fputc ('\n', stdout);
-      }
-    }
-    else { /* data block */
-      for (size = 1; size < maxwidth; size++) { /* determine the size */
-	addr = address + size;
-
-	if (GetMemType (addr) == MEM_INSTRUCTION ||
-	    addr != WordTableEnd (addr))
-	  break;
-      }
+            switch (instr->admode)
+            {
+            case accu:
+            case impl:
+                fprintf(stdout, "%s%s\n", mne[instr->mnemonic], postfix[instr->admode]);
+                break;
+            case imm:
+                addr = Memory[(ADDR_T)(address + 1)];
+                fprintf(stdout, "%s #$%02x\n", mne[instr->mnemonic], addr);
+                break;
+            case abso:
+            case absx:
+            case absy:
+            case iabs:
+            case iabsx:
+                addr = Memory[(ADDR_T)(address + 1)] | (Memory[(ADDR_T)(address + 2)] << 8);
+                /* Fix to ensure 16-bit addresses to zero-page are maintained as 16-bit */
+                fprintf(stdout, "%s %s%s%s%s\n", mne[instr->mnemonic], prefix[instr->admode],
+                        ((addr < 256 && instr->mnemonic != S_JMP && instr->mnemonic != S_JSR) ? "!" : ""),
+                        Label(addr, abso, 1), postfix[instr->admode]);
+                break;
+            case zp:
+            case zpx:
+            case zpy:
+            case ind:
+            case indx:
+            case indy:
+                addr = Memory[(ADDR_T)(address + 1)];
+                fprintf(stdout, "%s %s%s%s\n", mne[instr->mnemonic], prefix[instr->admode], Label(addr, zp, 1),
+                        postfix[instr->admode]);
+                break;
+            case rel:
+                addr = (int)(char)Memory[(ADDR_T)(address + 1)];
+                /* addr -= (addr > 127) ? 256 : 0; BUGFIX: sign extend already done */
+                /*fprintf(stderr, "%d %d %d\n", address, size, addr);*/
+                addr += address + size;
+                fprintf(stdout, "%s %s%s%s\n", mne[instr->mnemonic], prefix[instr->admode], Label(addr, abso, 1),
+                        postfix[instr->admode]);
+                break;
+            case zrel: /* BBR0, etc. 65C02 instructions */
+                addr = (int)(char)Memory[(ADDR_T)(address + 2)];
+                /* addr -= (addr > 127) ? 256 : 0; BUGFIX: sign extend already done */
+                addr += address + size;
+                fprintf(stdout, "%s %s, %s\n", mne[instr->mnemonic], Label(Memory[(ADDR_T)(address + 1)], abso, 1),
+                        Label(addr, abso, 1));
+                break;
+            }
+        }
+        else if (address != (addr = WordTableEnd(address)))
+        { /* word table */
+            for (size = (ADDR_T)(addr - address); size;
+                 address += (counter = size > (maxwidth & ~1) ? (maxwidth & ~1) : size), size -= counter)
+            {
+                if (IsLabeled(address))
+                {
+                    if (Options & M_ADDRESSES)
+                        fprintf(stdout, "%04x %s%s:\n", address, lineinfix, Label(address, abso, 0));
+                    else
+                        fprintf(stdout, "%s ", Label(address, abso, 0));
+                }
+                for (counter = size > (maxwidth & ~1) ? (maxwidth & ~1) : size, addr = address + 1; --counter; addr++)
+                    if (IsLabeled(addr))
+                    {
+                        if (Options & M_ADDRESSES)
+                            fprintf(stdout, "%04x %s%s = * + %u\n", addr, lineinfix, Label(addr, abso, 0),
+                                    (ADDR_T)(addr - address));
+                        else
+                            fprintf(stdout, "\t%s = * + %u\n", Label(addr, abso, 0), (ADDR_T)(addr - address));
+                    }
 
-      if (IsLabeled (address)) {
-	if (Options & M_ADDRESSES)
-	  fprintf (stdout, "%04x %s%s:\n", address, lineinfix,
-		   Label (address, abso, 0));
-	else
-	  fprintf (stdout, "%s ", Label (address, abso, 0));
-      }
+                if (Options & M_ADDRESSES)
+                    fprintf(stdout, "%04x ", address);
+
+                if ((Options & M_ADDRESSES) == O_ADR_ADR_DMP)
+                {
+                    for (counter = size > (maxwidth & ~1) ? (maxwidth & ~1) : size, addr = address; counter--; addr++)
+                    {
+                        fprintf(stdout, "%02x ", Memory[addr]);
+                    }
+                    fputs(lineinfix + 3 * (size > (maxwidth & ~1) ? (maxwidth & ~1) : size), stdout);
+                }
+
+                fprintf(stdout, "  .word %s", Label(Memory[address] | (Memory[(ADDR_T)(address + 1)] << 8), abso, 0));
 
-      for (counter = size, addr = address + 1; --counter; addr++)
-        if (IsLabeled (addr)) {
-	  if (Options & M_ADDRESSES)
-	    fprintf (stdout, "%04x %s%s = * + %u\n", addr, lineinfix,
-		     Label (addr, abso, 0), (ADDR_T)(addr - address));
-	  else
-	    fprintf (stdout, "\t%s = * + %u\n", Label (addr, abso, 0),
-		     (ADDR_T)(addr - address));
+                for (counter = size > (maxwidth & ~1) ? (maxwidth & ~1) : size, addr = address + 2; counter -= 2;
+                     addr += 2)
+                    fprintf(stdout, ",%s", Label(Memory[addr] | (Memory[(ADDR_T)(addr + 1)] << 8), abso, 0));
+
+                fputc('\n', stdout);
+            }
         }
+        else
+        { /* data block */
+            for (size = 1; size < maxwidth; size++)
+            { /* determine the size */
+                addr = address + size;
+
+                if (GetMemType(addr) == MEM_INSTRUCTION || addr != WordTableEnd(addr))
+                    break;
+            }
 
-      if (Options & M_ADDRESSES)
-	fprintf (stdout, "%04x ", address);
+            if (IsLabeled(address))
+            {
+                if (Options & M_ADDRESSES)
+                    fprintf(stdout, "%04x %s%s:\n", address, lineinfix, Label(address, abso, 0));
+                else
+                    fprintf(stdout, "%s ", Label(address, abso, 0));
+            }
 
-      if ((Options & M_ADDRESSES) == O_ADR_ADR_DMP) {
-	for (counter = size, addr = address; counter--; addr++)
-	  fprintf (stdout, "%02x ", Memory[addr]);
-
-	fputs (lineinfix + 3 * size, stdout);
-      }
+            for (counter = size, addr = address + 1; --counter; addr++)
+                if (IsLabeled(addr))
+                {
+                    if (Options & M_ADDRESSES)
+                        fprintf(stdout, "%04x %s%s = * + %u\n", addr, lineinfix, Label(addr, abso, 0),
+                                (ADDR_T)(addr - address));
+                    else
+                        fprintf(stdout, "\t%s = * + %u\n", Label(addr, abso, 0), (ADDR_T)(addr - address));
+                }
 
-      fprintf (stdout, "\t.byt $%02x", Memory[address]);
+            if (Options & M_ADDRESSES)
+                fprintf(stdout, "%04x ", address);
+
+            if ((Options & M_ADDRESSES) == O_ADR_ADR_DMP)
+            {
+                for (counter = size, addr = address; counter--; addr++)
+                    fprintf(stdout, "%02x ", Memory[addr]);
 
-      for (counter = size, addr = address + 1; --counter; addr++)
-	if (addr < EndAddress) /* problems with this overflowing */
-		fprintf (stdout, ",$%02x", Memory[addr]);
+                fputs(lineinfix + 3 * size, stdout);
+            }
+
+            fprintf(stdout, "\t.byt $%02x", Memory[address]);
 
-      fputc ('\n', stdout);
-    }
+            for (counter = size, addr = address + 1; --counter; addr++)
+                if (addr < EndAddress) /* problems with this overflowing */
+                    fprintf(stdout, ",$%02x", Memory[addr]);
+
+            fputc('\n', stdout);
+        }
 }
--- a/label.c	Thu Oct 14 01:40:24 2021 +0300
+++ b/label.c	Thu Oct 14 01:53:20 2021 +0300
@@ -22,144 +22,144 @@
 
 #define _LABEL_C_
 
+#include <stdio.h>
 #include <stdlib.h>
-#include <stdio.h>
 #include <string.h>
 
-#include "proto.h"
+#include "opcodes.h"
 #include "options.h"
-#include "opcodes.h"
+#include "proto.h"
 
 label *labeltable;
 char defaultlabel[512];
 unsigned numLabels = 0;
 
-
 void AddLabel(ADDR_T address, char *name, int is_range, ADDR_T len)
 {
-  label * entry = numLabels ?
-    realloc (labeltable, (numLabels + 1) * sizeof *entry) :
-    malloc (sizeof *entry);
+    label *entry = numLabels ? realloc(labeltable, (numLabels + 1) * sizeof *entry) : malloc(sizeof *entry);
 
-  if (!entry) return;
+    if (!entry)
+        return;
 
-  labeltable = entry;
-  entry = &labeltable[numLabels++];
+    labeltable = entry;
+    entry = &labeltable[numLabels++];
 
-  entry->address = address;
-  entry->name = strdup(name);
-  entry->is_range = is_range;
-  entry->len = len;
+    entry->address = address;
+    entry->name = strdup(name);
+    entry->is_range = is_range;
+    entry->len = len;
 }
 
-
 int IsInsideRegion(ADDR_T address)
 {
-  label *entry;
+    label *entry;
 
-  for (entry = &labeltable[numLabels]; entry-- > labeltable;)
-  {
-    int offs = address - entry->address;
-    if (entry->is_range && offs > 0 && offs < entry->len)
-      return TRUE;
-  }
-  return FALSE;
+    for (entry = &labeltable[numLabels]; entry-- > labeltable;)
+    {
+        int offs = address - entry->address;
+        if (entry->is_range && offs > 0 && offs < entry->len)
+            return TRUE;
+    }
+    return FALSE;
 }
 
-
 char *Label(ADDR_T address, int admode, int allow_range)
 {
-  label *entry;
-  int match = 0;
+    label *entry;
+    int match = 0;
+
+    if (!IsLabeled(address))
+    {
+        // dirty kludge to allow zero page stuff to still work. this sometimes
+        // guesses wrong
+        if (admode == zp)
+        {
+            snprintf(defaultlabel, sizeof(defaultlabel), "$%02x", address);
+        }
+        else
+        {
+            snprintf(defaultlabel, sizeof(defaultlabel), "$%04x", address);
+        }
+
+        return defaultlabel;
+    }
 
-  if (!IsLabeled (address)) {
-    // dirty kludge to allow zero page stuff to still work. this sometimes
-    // guesses wrong
-    if (admode == zp) {
-      snprintf(defaultlabel, sizeof(defaultlabel), "$%02x", address);
-    } else {
-      snprintf(defaultlabel, sizeof(defaultlabel), "$%04x", address);
+    for (entry = &labeltable[numLabels]; entry-- > labeltable;)
+    {
+        if (entry->address == address)
+            return entry->name;
     }
 
+    for (entry = &labeltable[numLabels]; entry-- > labeltable;)
+    {
+        int offs = address - entry->address;
+        if (entry->is_range && offs >= 0 && offs < entry->len)
+        {
+            match = 1;
+            if (allow_range)
+            {
+                snprintf(defaultlabel, sizeof(defaultlabel), (offs < 16) ? "%s + %d" : "%s + $%x", entry->name, offs);
+                return defaultlabel;
+            }
+            else
+                break;
+        }
+    }
+
+    if (match)
+        snprintf(defaultlabel, sizeof(defaultlabel), "XXX_%x", address);
+    else
+        snprintf(defaultlabel, sizeof(defaultlabel), "l_%x", address);
+
     return defaultlabel;
-  }
-
-  for (entry = &labeltable[numLabels]; entry-- > labeltable;)
-  {
-    if (entry->address == address)
-      return entry->name;
-  }
-
-  for (entry = &labeltable[numLabels]; entry-- > labeltable;)
-  {
-    int offs = address - entry->address;
-    if (entry->is_range && offs >= 0 && offs < entry->len)
-    {
-      match = 1;
-      if (allow_range)
-      {
-        snprintf(defaultlabel, sizeof(defaultlabel),
-          (offs < 16) ? "%s + %d" : "%s + $%x",
-          entry->name, offs);
-        return defaultlabel;
-      }
-      else
-        break;
-    }
-  }
-
-  if (match)
-    snprintf(defaultlabel, sizeof(defaultlabel), "XXX_%x", address);
-  else
-    snprintf(defaultlabel, sizeof(defaultlabel), "l_%x", address);
-
-  return defaultlabel;
 }
 
-
-void Collect (void)
+void Collect(void)
 {
-  unsigned counter = 0;
-  table *entry = NULL, *entry2;
-  label *labels;
+    unsigned counter = 0;
+    table *entry = NULL, *entry2;
+    label *labels;
 
-  if (fVerbose)
-    fprintf (stderr, "%s: collecting garbage.\n", prog);
-
-  while ((entry = entry2 = FindNextEntryType (entry, 0, 0)))
-  {
-    counter++;
+    if (fVerbose)
+        fprintf(stderr, "%s: collecting garbage.\n", prog);
 
-    PutLabel (entry->address);
-    PutLowByte (entry->address);
-    PutHighByte (entry->address);
-
-    while ((entry2 = FindNextEntry (entry2, entry->address, ~0, entry->type)))
+    while ((entry = entry2 = FindNextEntryType(entry, 0, 0)))
     {
-      DeleteEntry (entry2); /* remove duplicate warnings */
-    }
-  }
+        counter++;
 
-  if ((entry = malloc (counter * sizeof *entry))) { /* compact the table */
-    entrycount = counter;
+        PutLabel(entry->address);
+        PutLowByte(entry->address);
+        PutHighByte(entry->address);
 
-    for (entry2 = scantable; counter; entry2++) {
-      if (!entry2->type) continue;
-
-      memcpy (&entry[--counter], entry2, sizeof *entry);
+        while ((entry2 = FindNextEntry(entry2, entry->address, ~0, entry->type)))
+        {
+            DeleteEntry(entry2); /* remove duplicate warnings */
+        }
     }
 
-    free (scantable);
-    scantable = entry;
-  }
+    if ((entry = malloc(counter * sizeof *entry)))
+    { /* compact the table */
+        entrycount = counter;
+
+        for (entry2 = scantable; counter; entry2++)
+        {
+            if (!entry2->type)
+                continue;
+
+            memcpy(&entry[--counter], entry2, sizeof *entry);
+        }
 
-  for (labels = &labeltable[numLabels]; labels-- > labeltable;)
-  {
-    if ((ADDR_T)(labels->address - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+        free(scantable);
+        scantable = entry;
+    }
+
+    for (labels = &labeltable[numLabels]; labels-- > labeltable;)
     {
-      PutLabel (labels->address);
-      PutLowByte (labels->address);
-      PutHighByte (labels->address);
+        if ((ADDR_T)(labels->address - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+        {
+            PutLabel(labels->address);
+            PutLowByte(labels->address);
+            PutHighByte(labels->address);
+        }
     }
-  }
 }
--- a/main.c	Thu Oct 14 01:40:24 2021 +0300
+++ b/main.c	Thu Oct 14 01:53:20 2021 +0300
@@ -34,582 +34,598 @@
 #ifdef LONG_OPTIONS
 #include <getopt.h>
 #endif /* __GNUC__ */
-#include "proto.h"
+#include "opcodes.h"
 #include "options.h"
-#include "opcodes.h"
+#include "proto.h"
 
 
-int main (int argc, char **argv)
+int main(int argc, char **argv)
 {
-  FILE *file;
-  unsigned address1, address2;
+    FILE *file;
+    unsigned address1, address2;
 #ifdef LONG_OPTIONS
-  int option_index;
+    int option_index;
 #endif
-  int fFinished = FALSE, fType;
-  char labelname[MAXLINE], strig[MAXLINE], *scanner;
+    int optsfinished = FALSE, ftype;
+    char labelname[MAXLINE], strig[MAXLINE], *scanner;
 
-  extern char *optarg;
-  extern int optind;
+    extern char *optarg;
+    extern int optind;
 
 #ifdef LONG_OPTIONS
-  static struct option cmd_options [] = {
-    { "datablock", 1, 0, 'b' }, /* an address range to be marked
-                                   as a data block */
-    { "datablocks", 1, 0, 'B' },/* a file containing the address ranges
-                                   to be marked as data blocks */
-    { "labels", 1, 0, 'l' },    /* a file containing labels to be translated
-                                   in the output phase */
-    { "routine", 1, 0, 'r' },   /* an address of a routine */
-    { "routines", 1, 0, 'R' },  /* a file containing the addresses */
+    static struct option cmd_options [] = {
+        { "datablock", 1, 0, 'b' }, /* an address range to be marked
+                                       as a data block */
+        { "datablocks", 1, 0, 'B' },/* a file containing the address ranges
+                                       to be marked as data blocks */
+        { "labels", 1, 0, 'l' },    /* a file containing labels to be translated
+                                       in the output phase */
+        { "routine", 1, 0, 'r' },   /* an address of a routine */
+        { "routines", 1, 0, 'R' },  /* a file containing the addresses */
 
-    { "listing-width", 1, 0, 'L' },
-                                /* maximum number of dumped bytes per line */
-    { "addresses", 1, 0, 'a' }, /* dumping addresses in the output phase */
-    { "datablock-detection", 1, 0, 'd' },
-                                /* data block detection options */
-    { "processor", 1, 0, 'p' }, /* instruction set */
-    { "no-colon-newline", 0, 0, 'n' },
-    { "colon-newline", 0, 0, 'N' },
-    { "no-external-labels", 0, 0, 'e' },
-    { "external-labels", 0, 0, 'E' },
-    { "address-tables", 0, 0, 't' },
-    { "no-address-statements", 0, 0, 's' },
-    { "address-statements", 0, 0, 'S' },
-    { "suspect-jsr", 0, 0, 'J' },
-    { "no-suspect-jsr", 0, 0, 'j' },
-    { "one-byte-routines", 0, 0, 'O' },
-    { "no-one-byte-routines", 0, 0, 'o' },
-    { "stupid-jumps", 0, 0, 'M' },
-    { "no-stupid-jumps", 0, 0, 'm' },
-    { "allow-brk", 0, 0, 'W' },
-    { "no-allow-brk", 0, 0, 'w' },
-    { "suspect-branches", 0, 0, 'C' },
-    { "no-suspect-branches", 0, 0, 'c' },
-    { "cross-reference", 0, 0, 'X' },
-    { "no-cross-reference", 0, 0, 'x' },
-    { "verbose", 0, 0, 'v' },
-    { "help", 0, 0, '?' },
-    { "word-sa", 0, 0, 'Q' },
-    { "no-word-sa", 0, 0, 'q' },
-    { "get-sa", 0, 0, 'G' },
-    { "no-get-sa", 0, 0, 'g' },
-    { "detect-basic", 0, 0, 'U' },
-    { "no-detect-basic", 0, 0, 'u' },
-    { NULL, 0, 0, 0 }
-  };
+        { "listing-width", 1, 0, 'L' },
+                                    /* maximum number of dumped bytes per line */
+        { "addresses", 1, 0, 'a' }, /* dumping addresses in the output phase */
+        { "datablock-detection", 1, 0, 'd' },
+                                    /* data block detection options */
+        { "processor", 1, 0, 'p' }, /* instruction set */
+        { "no-colon-newline", 0, 0, 'n' },
+        { "colon-newline", 0, 0, 'N' },
+        { "no-external-labels", 0, 0, 'e' },
+        { "external-labels", 0, 0, 'E' },
+        { "address-tables", 0, 0, 't' },
+        { "no-address-statements", 0, 0, 's' },
+        { "address-statements", 0, 0, 'S' },
+        { "suspect-jsr", 0, 0, 'J' },
+        { "no-suspect-jsr", 0, 0, 'j' },
+        { "one-byte-routines", 0, 0, 'O' },
+        { "no-one-byte-routines", 0, 0, 'o' },
+        { "stupid-jumps", 0, 0, 'M' },
+        { "no-stupid-jumps", 0, 0, 'm' },
+        { "allow-brk", 0, 0, 'W' },
+        { "no-allow-brk", 0, 0, 'w' },
+        { "suspect-branches", 0, 0, 'C' },
+        { "no-suspect-branches", 0, 0, 'c' },
+        { "cross-reference", 0, 0, 'X' },
+        { "no-cross-reference", 0, 0, 'x' },
+        { "verbose", 0, 0, 'v' },
+        { "help", 0, 0, '?' },
+        { "word-sa", 0, 0, 'Q' },
+        { "no-word-sa", 0, 0, 'q' },
+        { "get-sa", 0, 0, 'G' },
+        { "no-get-sa", 0, 0, 'g' },
+        { "detect-basic", 0, 0, 'U' },
+        { "no-detect-basic", 0, 0, 'u' },
+        { NULL, 0, 0, 0 }
+    };
 #endif /* LONG_OPTIONS */
 
-  opset = standard_nmos6502;
+    opset = standard_nmos6502;
 
-  StartAddress = 0;
-  Options = O_ADR_ADR_DMP | B_LBL_ALWAYS | O_TBL_NOEXT |
-    B_STM_DETECT | B_STK_BALANCE | B_RSC_STRICT | O_DBL_STRICT |
-    B_JMP_STRICT | B_BRK_REJECT;
+    StartAddress = 0;
+    Options = O_ADR_ADR_DMP | B_LBL_ALWAYS | O_TBL_NOEXT | B_STM_DETECT | B_STK_BALANCE | B_RSC_STRICT | O_DBL_STRICT |
+              B_JMP_STRICT | B_BRK_REJECT;
 
-	/* dxa defaults */
-        Options = (Options & ~M_ADDRESSES) | O_ADR_NOTHING;
-        Options = (Options & ~M_DATA_BLOCKS) | O_DBL_IGNORE;
-        Options &= ~B_LBL_ALWAYS;
-	Options &= ~B_LABCOL;
-	Options |= B_SA_WORD;
-	Options |= B_GET_SA;
+    /* dxa defaults */
+    Options = (Options & ~M_ADDRESSES) | O_ADR_NOTHING;
+    Options = (Options & ~M_DATA_BLOCKS) | O_DBL_IGNORE;
+    Options &= ~B_LBL_ALWAYS;
+    Options &= ~B_LABCOL;
+    Options |= B_SA_WORD;
+    Options |= B_GET_SA;
 
-  for (address1 = sizeof MemType / sizeof *MemType; address1--;
-       MemType[address1] = 0);
+    for (address1 = sizeof MemType / sizeof *MemType; address1--; MemType[address1] = 0);
+
+    for (address1 = sizeof MemFlag / sizeof *MemFlag; address1--; MemFlag[address1] = MemLabel[address1] = 0);
 
-  for (address1 = sizeof MemFlag / sizeof *MemFlag; address1--;
-       MemFlag[address1] = MemLabel[address1] = 0);
+    for (address1 = sizeof LowByte / sizeof *LowByte; address1--; HighByte[address1] = LowByte[address1] = 0);
 
-  for (address1 = sizeof LowByte / sizeof *LowByte; address1--;
-       HighByte[address1] = LowByte[address1] = 0);
+    for (address1 = sizeof MemReferenced / sizeof *MemReferenced; address1--; MemReferenced[address1] = 0);
 
-  for (address1 = sizeof MemReferenced / sizeof *MemReferenced; address1--;
-       MemReferenced[address1] = 0);
+    for (prog = *argv; *prog; prog++);
 
-  for (prog = *argv; *prog; prog++);
-  for (;prog > *argv; prog--)
-    if (*prog == '/') {
-      prog++;
-      break;
+    for (; prog > *argv; prog--)
+    if (*prog == '/')
+    {
+        prog++;
+        break;
     }
 
-  while (!fFinished)
+
+    while (!optsfinished)
+    {
 #ifdef LONG_OPTIONS
-    switch (getopt_long (argc, argv,
-			 "?b:B:L:r:R:h:l:a:d:p:g:t:eEnNsSjJoOcCmMvVwWxXqQGuU",
-                         cmd_options, &option_index)) {
+        switch (getopt_long(argc, argv, "?b:B:L:r:R:h:l:a:d:p:g:t:eEnNsSjJoOcCmMvVwWxXqQGuU", cmd_options, &option_index))
+        {
 #else
-    switch (getopt (argc, argv,
-	"?b:B:L:r:R:h:l:a:d:p:g:t:eEnNsSjJoOcCmMvVwWxXqQGuU")){
+        switch (getopt(argc, argv, "?b:B:L:r:R:h:l:a:d:p:g:t:eEnNsSjJoOcCmMvVwWxXqQGuU"))
+        {
 #endif /* LONG_OPTIONS */
-    case -1:
-    case ':':
-      fFinished = TRUE;
-      break;
-
-    case '?':
-    case 'V':
-      goto Usage;
+        case -1:
+        case ':':
+            optsfinished = TRUE;
+            break;
 
-    case 'b':
-      if (*optarg == '!') {
-        fType = MEM_PARAMETER;
-        optarg++;
-      }
-      else if (*optarg == '?') {
-        fType = MEM_UNPROCESSED;
-        optarg++;
-      }
-      else
-        fType = MEM_DATA;
+        case '?':
+        case 'V':
+            goto usage;
 
-      if (!sscanf (optarg, "%X-%X", &address1, &address2) ||
-          address1 > 65535 || address2 > 65535) {
-        fprintf (stderr, "%s: Error in data block address range `%s'.\n\n",
-                 prog, optarg);
-        goto Usage;
-      }
+        case 'b':
+            if (*optarg == '!')
+            {
+                ftype = MEM_PARAMETER;
+                optarg++;
+            }
+            else if (*optarg == '?')
+            {
+                ftype = MEM_UNPROCESSED;
+                optarg++;
+            }
+            else
+                ftype = MEM_DATA;
 
-      for (; (ADDR_T)address1 != address2; address1++) {
-        SetMemType (address1, fType);
-        SetMemFlag (address1);
-      }
-
-      SetMemType (address1, fType);
-      SetMemFlag (address1);
+            if (!sscanf(optarg, "%X-%X", &address1, &address2) || address1 > 65535 || address2 > 65535)
+            {
+                fprintf(stderr, "%s: Error in data block address range `%s'.\n\n", prog, optarg);
+                goto usage;
+            }
 
-      break;
+            for (; (ADDR_T)address1 != address2; address1++)
+            {
+                SetMemType(address1, ftype);
+                SetMemFlag(address1);
+            }
 
-    case 'B':
-      if (!((file = fopen (optarg, "rt")))) {
-        fprintf (stderr, "%s: Could not open %s.\n", prog, optarg);
-        return 2;
-      }
+            SetMemType(address1, ftype);
+            SetMemFlag(address1);
+
+            break;
 
-      while (!feof (file)) {
-        if ('!' == (fType = fgetc (file)))
-          fType = MEM_PARAMETER;
-        else if ('?' == fType)
-          fType = MEM_UNPROCESSED;
-        else {
-          ungetc (fType, file);
-          fType = MEM_DATA;
-        }
+        case 'B':
+            if (!((file = fopen(optarg, "rt"))))
+            {
+                fprintf(stderr, "%s: Could not open %s.\n", prog, optarg);
+                return 2;
+            }
 
-        if (!fscanf (file, "%X-%X\n", &address1, &address2) ||
-            address1 > 65535 || address2 > 65535) {
-          fprintf (stderr, "%s: Error in data block address file %s.\n",
-                   prog, optarg);
+            while (!feof(file))
+            {
+                if ('!' == (ftype = fgetc(file)))
+                    ftype = MEM_PARAMETER;
+                else if ('?' == ftype)
+                    ftype = MEM_UNPROCESSED;
+                else
+                {
+                    ungetc(ftype, file);
+                    ftype = MEM_DATA;
+                }
 
-          fclose (file);
-          return 3;
-        }
-
-        for (; (ADDR_T)address1 != address2; address1++) {
-          SetMemType (address1, fType);
-          SetMemFlag (address1);
-        }
+                if (!fscanf(file, "%X-%X\n", &address1, &address2) || address1 > 65535 || address2 > 65535)
+                {
+                    fprintf(stderr, "%s: Error in data block address file %s.\n", prog, optarg);
 
-        SetMemType (address1, fType);
-        SetMemFlag (address1);
-      }
-
-      fclose (file);
-      break;
+                    fclose(file);
+                    return 3;
+                }
 
-    case 'r':
-      if (!sscanf (optarg, "%X", &address1) || address1 > 65535) {
-        fprintf (stderr, "%s: Error in routine address `%s'.\n\n",
-                 prog, optarg);
-        goto Usage;
-      }
+                for (; (ADDR_T)address1 != address2; address1++)
+                {
+                    SetMemType(address1, ftype);
+                    SetMemFlag(address1);
+                }
 
-      AddEntry (address1, address1, RTN_SURE);
-      break;
+                SetMemType(address1, ftype);
+                SetMemFlag(address1);
+            }
+
+            fclose(file);
+            break;
 
-    case 'R':
-      if (!((file = fopen (optarg, "rt")))) {
-        fprintf (stderr, "%s: Could not open %s.\n", prog, optarg);
-        return 2;
-      }
+        case 'r':
+            if (!sscanf(optarg, "%X", &address1) || address1 > 65535)
+            {
+                fprintf(stderr, "%s: Error in routine address `%s'.\n\n", prog, optarg);
+                goto usage;
+            }
 
-      while (!feof (file)) {
-        if (!fscanf (file, "%X\n", &address1) || address1 > 65535) {
-          fprintf (stderr, "%s: Error in data block address file `%s'.\n",
-                   prog, optarg);
+            AddEntry(address1, address1, RTN_SURE);
+            break;
 
-          fclose (file);
-          return 3;
-        }
-
-        AddEntry (address1, address1, RTN_SURE);
-      }
-
-      fclose (file);
-      break;
+        case 'R':
+            if (!((file = fopen(optarg, "rt"))))
+            {
+                fprintf(stderr, "%s: Could not open %s.\n", prog, optarg);
+                return 2;
+            }
 
-    case 'L':
-      if (0 > (listwidth = atoi (optarg))) {
-	fprintf (stderr, "%s: Illegal listing width specified.\n\n", prog);
-	goto Usage;
-      }
+            while (!feof(file))
+            {
+                if (!fscanf(file, "%X\n", &address1) || address1 > 65535)
+                {
+                    fprintf(stderr, "%s: Error in data block address file `%s'.\n", prog, optarg);
 
-      break;
+                    fclose(file);
+                    return 3;
+                }
+
+                AddEntry(address1, address1, RTN_SURE);
+            }
+
+            fclose(file);
+            break;
 
-    case 'a':
-      if (!strcmp (optarg, "disabled"))
-        Options = (Options & ~M_ADDRESSES) | O_ADR_NOTHING;
-      else if (!strcmp (optarg, "enabled"))
-        Options = (Options & ~M_ADDRESSES) | O_ADR_ADRPFIX;
-      else if (!strcmp (optarg, "dump"))
-        Options = (Options & ~M_ADDRESSES) | O_ADR_ADR_DMP;
-      else {
-        fprintf (stderr, "%s: Unrecognized option for dumping addresses.\n\n",
-                 prog);
-        goto Usage;
-      }
-      break;
+        case 'L':
+            if (0 > (listwidth = atoi(optarg)))
+            {
+                fprintf(stderr, "%s: Illegal listing width specified.\n\n", prog);
+                goto usage;
+            }
+
+            break;
 
-    case 'd':
-      if (!strcmp (optarg, "poor"))
-        Options = (Options & ~M_DATA_BLOCKS) | O_DBL_IGNORE;
-      else if (!strcmp (optarg, "extended"))
-        Options = (Options & ~M_DATA_BLOCKS) | O_DBL_DETECT;
-      else if (!strcmp (optarg, "skip-scanning"))
-        Options = (Options & ~M_DATA_BLOCKS) | O_DBL_NOSCAN;
-      else if (!strcmp (optarg, "strict"))
-        Options = (Options & ~M_DATA_BLOCKS) | O_DBL_STRICT;
-      else {
-        fprintf (stderr,
-                 "%s: Unrecognized option for detecting data blocks.\n\n",
-                 prog);
-        goto Usage;
-      }
-      break;
+        case 'a':
+            if (!strcmp(optarg, "disabled"))
+                Options = (Options & ~M_ADDRESSES) | O_ADR_NOTHING;
+            else if (!strcmp(optarg, "enabled"))
+                Options = (Options & ~M_ADDRESSES) | O_ADR_ADRPFIX;
+            else if (!strcmp(optarg, "dump"))
+                Options = (Options & ~M_ADDRESSES) | O_ADR_ADR_DMP;
+            else
+            {
+                fprintf(stderr, "%s: Unrecognized option for dumping addresses.\n\n", prog);
+                goto usage;
+            }
+            break;
 
-    case 'p':
-      if (!strcmp (optarg, "all-nmos6502"))
-        opset = all_nmos6502;
-      else if (!strcmp (optarg, "rational-nmos6502"))
-        opset = rational_nmos6502;
-      else if (!strcmp (optarg, "useful-nmos6502"))
-        opset = useful_nmos6502;
-      else if (!strcmp (optarg, "traditional-nmos6502"))
-        opset = traditional_nmos6502;
-      else if (!strcmp (optarg, "r65c02"))
-        opset = r65c02;
-      else if (!strcmp (optarg, "standard-nmos6502"))
-        opset = standard_nmos6502;
-      else {
-        fprintf (stderr, "%s: Unsupported instruction set `%s'.\n\n",
-                 prog, optarg);
-        goto Usage;
-      }
-      break;
+        case 'd':
+            if (!strcmp(optarg, "poor"))
+                Options = (Options & ~M_DATA_BLOCKS) | O_DBL_IGNORE;
+            else if (!strcmp(optarg, "extended"))
+                Options = (Options & ~M_DATA_BLOCKS) | O_DBL_DETECT;
+            else if (!strcmp(optarg, "skip-scanning"))
+                Options = (Options & ~M_DATA_BLOCKS) | O_DBL_NOSCAN;
+            else if (!strcmp(optarg, "strict"))
+                Options = (Options & ~M_DATA_BLOCKS) | O_DBL_STRICT;
+            else
+            {
+                fprintf(stderr, "%s: Unrecognized option for detecting data blocks.\n\n", prog);
+                goto usage;
+            }
+            break;
 
-    case 'e':
-      Options &= ~B_LBL_ALWAYS;
-      break;
-    case 'E':
-      Options |= B_LBL_ALWAYS;
-      break;
+        case 'p':
+            if (!strcmp(optarg, "all-nmos6502"))
+                opset = all_nmos6502;
+            else if (!strcmp(optarg, "rational-nmos6502"))
+                opset = rational_nmos6502;
+            else if (!strcmp(optarg, "useful-nmos6502"))
+                opset = useful_nmos6502;
+            else if (!strcmp(optarg, "traditional-nmos6502"))
+                opset = traditional_nmos6502;
+            else if (!strcmp(optarg, "r65c02"))
+                opset = r65c02;
+            else if (!strcmp(optarg, "standard-nmos6502"))
+                opset = standard_nmos6502;
+            else
+            {
+                fprintf(stderr, "%s: Unsupported instruction set `%s'.\n\n", prog, optarg);
+                goto usage;
+            }
+            break;
 
-    case 't':
-      if (!strcmp (optarg, "ignore"))
-        Options = (Options & ~M_ADR_TABLES) | O_TBL_IGNORE;
-      else if (!strcmp (optarg, "detect-all"))
-        Options = (Options & ~M_ADR_TABLES) | O_TBL_DETECT;
-      else if (!strcmp (optarg, "detect-internal"))
-        Options = (Options & ~M_ADR_TABLES) | O_TBL_NOEXT;
-      else {
-        fprintf (stderr,
-                 "%s: Unknown address table detection option `%s'.\n\n",
-                 prog, optarg);
-        goto Usage;
-      }
-      break;
+        case 'e':
+            Options &= ~B_LBL_ALWAYS;
+            break;
+        case 'E':
+            Options |= B_LBL_ALWAYS;
+            break;
 
-    case 's':
-      Options &= ~B_STM_DETECT;
-      break;
-    case 'S':
-      Options |= B_STM_DETECT;
-      break;
+        case 't':
+            if (!strcmp(optarg, "ignore"))
+                Options = (Options & ~M_ADR_TABLES) | O_TBL_IGNORE;
+            else if (!strcmp(optarg, "detect-all"))
+                Options = (Options & ~M_ADR_TABLES) | O_TBL_DETECT;
+            else if (!strcmp(optarg, "detect-internal"))
+                Options = (Options & ~M_ADR_TABLES) | O_TBL_NOEXT;
+            else
+            {
+                fprintf(stderr, "%s: Unknown address table detection option `%s'.\n\n", prog, optarg);
+                goto usage;
+            }
+            break;
 
-    case 'J':
-      Options &= ~B_STK_BALANCE;
-      break;
-    case 'j':
-      Options |= B_STK_BALANCE;
-      break;
+        case 's':
+            Options &= ~B_STM_DETECT;
+            break;
+        case 'S':
+            Options |= B_STM_DETECT;
+            break;
 
-    case 'o':
-      Options &= ~B_RSC_STRICT;
-      break;
-    case 'O':
-      Options |= B_RSC_STRICT;
-      break;
+        case 'J':
+            Options &= ~B_STK_BALANCE;
+            break;
+        case 'j':
+            Options |= B_STK_BALANCE;
+            break;
 
-    case 'c':
-      Options &= ~B_SCEPTIC;
-      break;
-    case 'C':
-      Options |= B_SCEPTIC;
-      break;
+        case 'o':
+            Options &= ~B_RSC_STRICT;
+            break;
+        case 'O':
+            Options |= B_RSC_STRICT;
+            break;
 
-    case 'M':
-      Options &= ~B_JMP_STRICT;
-      break;
-    case 'm':
-      Options |= B_JMP_STRICT;
-      break;
-
-    case 'v':
-      fVerbose = TRUE;
-      break;
+        case 'c':
+            Options &= ~B_SCEPTIC;
+            break;
+        case 'C':
+            Options |= B_SCEPTIC;
+            break;
 
-    case 'W':
-      Options &= ~B_BRK_REJECT;
-      break;
-    case 'w':
-      Options |= B_BRK_REJECT;
-      break;
+        case 'M':
+            Options &= ~B_JMP_STRICT;
+            break;
+        case 'm':
+            Options |= B_JMP_STRICT;
+            break;
+
+        case 'v':
+            fVerbose = TRUE;
+            break;
 
-    case 'x':
-      Options &= ~B_CROSSREF;
-      break;
-    case 'X':
-      Options |= B_CROSSREF;
-      break;
+        case 'W':
+            Options &= ~B_BRK_REJECT;
+            break;
+        case 'w':
+            Options |= B_BRK_REJECT;
+            break;
+
+        case 'x':
+            Options &= ~B_CROSSREF;
+            break;
+        case 'X':
+            Options |= B_CROSSREF;
+            break;
 
-/* new or altered dxa options */
-    case 'n':
-	Options &= ~B_LABCOL;
-	break;
-    case 'N':
-	Options |= B_LABCOL;
-	break;
-    case 'q':
-	Options &= ~B_SA_WORD;
-	break;
-    case 'Q':
-	Options |= B_SA_WORD;
-	break;
-    case 'u':
-	Options &= ~B_DETECT_BASIC;
-	break;
-    case 'U':
-	Options |= B_DETECT_BASIC;
-	break;
-    case 'G':
-	Options |= B_GET_SA;
-	break;
-    case 'g':
-	Options &= ~B_GET_SA;
-        if (!sscanf (optarg, "%X", &address1) || address1 > 65535) {
-          fprintf (stderr, "%s: Error specifying starting address `%s'.\n\n",
-                 prog, optarg);
-          goto Usage;
-        }
-	StartAddress = address1;
-	break;
-    case 'l':
-      if (!((file = fopen (optarg, "rt")))) {
-        fprintf (stderr,
-                 "%s: Label file %s could not be opened for reading.\n\n",
-                 prog, optarg);
+            /* new or altered dxa options */
+        case 'n':
+            Options &= ~B_LABCOL;
+            break;
+        case 'N':
+            Options |= B_LABCOL;
+            break;
+        case 'q':
+            Options &= ~B_SA_WORD;
+            break;
+        case 'Q':
+            Options |= B_SA_WORD;
+            break;
+        case 'u':
+            Options &= ~B_DETECT_BASIC;
+            break;
+        case 'U':
+            Options |= B_DETECT_BASIC;
+            break;
+        case 'G':
+            Options |= B_GET_SA;
+            break;
+        case 'g':
+            Options &= ~B_GET_SA;
+            if (!sscanf(optarg, "%X", &address1) || address1 > 65535)
+            {
+                fprintf(stderr, "%s: Error specifying starting address `%s'.\n\n", prog, optarg);
+                goto usage;
+            }
+            StartAddress = address1;
+            break;
+        case 'l':
+            if (!((file = fopen(optarg, "rt"))))
+            {
+                fprintf(stderr, "%s: Label file %s could not be opened for reading.\n\n", prog, optarg);
 
-        goto Usage;
-      }
+                goto usage;
+            }
 
-      while (!feof (file)) {
-        int tmp;
-        fType = fgetc (file);
+            while (!feof(file))
+            {
+                int tmp;
+                ftype = fgetc(file);
 
-        if (feof (file))
-          break;
+                if (feof(file))
+                    break;
 
-        ungetc (fType, file);
+                ungetc(ftype, file);
 
-	/* This is the xa-compatible label scanner. */
-	if (!fscanf(file, "%s%i,%i,%i", labelname, &address1, &tmp, &address2) ||
-            address1 > 65535 ||
-            !fgets(strig, sizeof strig, file)) {
+                /* This is the xa-compatible label scanner. */
+                if (!fscanf(file, "%s%i,%i,%i", labelname, &address1, &tmp, &address2) || address1 > 65535 ||
+                    !fgets(strig, sizeof strig, file))
+                {
 
-	LabelError:
-          fprintf (stderr, "%s: Error in label file %s.\n", prog, optarg);
-	  fprintf (stderr, "Address(?): 0x%x ... Label(?): \"%s\"\n\n",
-		address1, labelname);
-          fclose (file);
-          return 3;
-        }
+                LabelError:
+                    fprintf(stderr, "%s: Error in label file %s.\n", prog, optarg);
+                    fprintf(stderr, "Address(?): 0x%x ... Label(?): \"%s\"\n\n", address1, labelname);
+                    fclose(file);
+                    return 3;
+                }
 
-        for (scanner = labelname; *scanner; scanner++);
-
-#if(0)
-        if (scanner[-1] != '\n') goto LabelError; /* line too long */
+                for (scanner = labelname; *scanner; scanner++);
+#if (0)
+                if (scanner[-1] != '\n')
+                    goto LabelError; /* line too long */
 #endif
 
-        while (--scanner > labelname && (
-		*(unsigned char *)scanner < 32 ||
-		*(unsigned char *)scanner == 44)) /* and commas */
-          *scanner = 0;         /* remove trailing control characters */
+                while (--scanner > labelname &&
+                       (*(unsigned char *)scanner < 32 || *(unsigned char *)scanner == 44)) /* and commas */
+                    *scanner = 0; /* remove trailing control characters */
+
+                for (scanner = labelname; *(unsigned char *)scanner < 32; scanner++)
+                    if (!*scanner)
+                        goto LabelError; /* label name missing */
+
+                AddLabel(address1, scanner, address2 != 0, address2);
+            }
+
+            fclose(file);
+        }
+    }
+
+    if (argc - optind > 1)
+    {
+        usage:
+        fprintf(stderr, "dxa %s -- symbolic 65xx disassembler\n", DXA_VERSION);
+        fprintf(stderr, "Based on d65 copyright (C) 1993-4 Marko M\"akel\"a\n");
+        fprintf(stderr, "Changes for dxa copyright (c) 2006-19 Cameron Kaiser\n\n");
+        fprintf(stderr, "Modifications for ++ version (c) 2015-2021 Matti 'ccr' Hamalainen <ccr@tnsp.org>\n\n");
+        fprintf(stderr, "Usage: %s [options] [filename]\n", prog);
+        return 1;
+    }
 
-        for (scanner = labelname; *(unsigned char *)scanner < 32; scanner++)
-          if (!*scanner) goto LabelError;         /* label name missing */
+    /* Fix, Need "rb" (binary mode) on Windows to avoid termintating on $1A */
+    if (!(file = (argc - optind) ? fopen(argv[argc - 1], "rb") : stdin))
+    {
+        fprintf(stderr, "%s: Couldn't open input file.\n", prog);
+        return 2;
+    }
+
+    if (Options & B_GET_SA)
+    {
+        StartAddress = (unsigned)fgetc(file);
+        StartAddress |= (unsigned)fgetc(file) << 8;
+    }
 
-        AddLabel (address1, scanner, address2 != 0, address2);
-      }
+    if (feof(file))
+    {
+        fprintf(stderr, "%s: Error reading the file.\n", prog);
+        return 3;
+    }
+
+    /* this doesn't work so well */
+    /* AddEntry (StartAddress, StartAddress, RTN_SURE); */
+    EndAddress = StartAddress + fread(&Memory[StartAddress], sizeof(char), 65536 - StartAddress, file);
 
-      fclose (file);
+    if (!feof(file))
+    {
+        if ((EndAddress = fread(Memory, sizeof(char), StartAddress, file)))
+            fprintf(stderr, "%s: Warning: Input file caused an address overflow.\n", prog);
+
+        if (!feof(file))
+        {
+            fprintf(stderr, "%s: Error: Input file is longer than 64 kilobytes.\n", prog);
+            fclose(file);
+            return 3;
+        }
     }
 
-  if (argc - optind > 1) {
-  Usage:
-    fprintf (stderr, "dxa %s -- symbolic 65xx disassembler\n", DXA_VERSION);
-    fprintf (stderr, "Based on d65 copyright (C) 1993-4 Marko M\"akel\"a\n");
-    fprintf (stderr, "Changes for dxa copyright (c) 2006-19 Cameron Kaiser\n\n");
-    fprintf (stderr, "Modifications for ++ version (c) 2015-2021 Matti 'ccr' Hamalainen <ccr@tnsp.org>\n\n");
-    fprintf (stderr, "Usage: %s [options] [filename]\n", prog);
-    return 1;
-  }
+    fclose(file);
 
-	/* Fix, Need "rb" (binary mode) on Windows to avoid termintating on $1A */
-  if (!(file = (argc - optind) ? fopen (argv[argc - 1], "rb") : stdin)) {
-    fprintf (stderr, "%s: Couldn't open input file.\n", prog);
-    return 2;
-  }
-
-  if (Options & B_GET_SA) {
-  	StartAddress = (unsigned)fgetc (file);
-  	StartAddress |= (unsigned)fgetc (file) << 8;
-  }
-
-  if (feof (file)) {
-    fprintf (stderr, "%s: Error reading the file.\n", prog);
-    return 3;
-  }
-
-/* this doesn't work so well */
-/* AddEntry (StartAddress, StartAddress, RTN_SURE); */
-  EndAddress = StartAddress + fread (&Memory[StartAddress], sizeof (char),
-                                     65536 - StartAddress, file);
+    BasicHeaderLength = 0;
+    if ((Options & B_DETECT_BASIC) && ((EndAddress - StartAddress) > 11) &&
+        (StartAddress == 0x0401 ||      /* PET */
+         StartAddress == 0x0801 ||      /* C64 */
+         StartAddress == 0x1001 ||      /* VIC, 16, +4 */
+         StartAddress == 0x1c01))       /* 128 */
+    {
+        /* If this file starts at a typical BASIC starting address, try to mark
+           that as data. Bonus points for turning SYS xxxx into an entry point.
+           For example, 1010 SYS 2061 comes out like this:
+            .byt $0b,$08,$0a
+            .byt $0a,$9e,$32
+            .byt $30,$36,$31
+            .byt $00,$00,$00
+        */
 
-  if (!feof (file)) {
-    if ((EndAddress = fread (Memory, sizeof (char), StartAddress, file)))
-      fprintf (stderr, "%s: Warning: Input file caused an address overflow.\n",
-               prog);
-
-    if (!feof (file)) {
-      fprintf (stderr, "%s: Error: Input file is longer than 64 kilobytes.\n",
-               prog);
-      fclose (file);
-      return 3;
-    }
-  }
-
-  fclose (file);
+        /* Heuristic: try to validate the line link address. If it seems sane,
+        process further. */
+        ADDR_T ll = Memory[StartAddress] + (Memory[StartAddress + 1] << 8);
+        if ((ll > StartAddress) && (ll < EndAddress - 2) && Memory[ll] == 0)
+        {
+            ADDR_T offs = StartAddress + 5; /* byte after presumed first token */
+            ADDR_T val = 0;
+            ADDR_T i = 0;
+            int ok = 0;
 
-  BasicHeaderLength = 0;
-  if ((Options & B_DETECT_BASIC) && ((EndAddress - StartAddress) > 11) && (0 ||
-	StartAddress == 0x0401 || /* PET */
-	StartAddress == 0x0801 || /* C64 */
-	StartAddress == 0x1001 || /* VIC, 16, +4 */
-	StartAddress == 0x1c01 || /* 128 */
-      0)) {
-    /* If this file starts at a typical BASIC starting address, try to mark
-       that as data. Bonus points for turning SYS xxxx into an entry point.
-       For example, 1010 SYS 2061 comes out like this:
-        .byt $0b,$08,$0a
-        .byt $0a,$9e,$32
-        .byt $30,$36,$31
-        .byt $00,$00,$00
-    */
-
-    /* Heuristic: try to validate the line link address. If it seems sane,
-	process further. */
-    ADDR_T ll = Memory[StartAddress] + (Memory[StartAddress+1] << 8);
-    if ((ll > StartAddress) && (ll < EndAddress - 2) && Memory[ll] == 0) {
-        ADDR_T offs = StartAddress + 5; /* byte after presumed first token */
-	ADDR_T val = 0;
-	ADDR_T i = 0;
-	int ok = 0;
+            /* See if there is an encoded SYS address in the first line. */
+            if (Memory[StartAddress + 4] == 0x9e /* SYS */)
+            {
+                for (; offs < StartAddress + 11; offs++)
+                { /* stop overrun */
+                    if (Memory[offs] == 0x00)
+                    {
+                        ok = 1;
+                        break;
+                    }
+                    if (Memory[offs] == 32) /* space */
+                        continue;
+                    if (Memory[offs] < 48 || Memory[offs] > 57)
+                    {
+                        ok = 0;
+                        break;
+                    }
+                    if (val > 6553 || (val == 6553 && Memory[offs] > 53))
+                    {
+                        ok = 0; /* imminent overflow */
+                        break;
+                    }
+                    val = (val * 10) + (Memory[offs] - 48);
+                }
 
-    	/* See if there is an encoded SYS address in the first line. */
-    	if (Memory[StartAddress+4] == 0x9e /* SYS */) {
-		for(; offs < StartAddress + 11; offs++) { /* stop overrun */
-    			if (Memory[offs] == 0x00) {
-				ok = 1;
-				break;
-			}
-			if (Memory[offs] == 32) /* space */
-				continue;
-			if (Memory[offs] < 48 || Memory[offs] > 57) {
-				ok = 0;
-				break;
-			}
-			if (val > 6553 || (val == 6553 && Memory[offs] > 53)) {
-				ok = 0; /* imminent overflow */
-				break;
-			}
-			val = (val * 10) + (Memory[offs] - 48);
-		}
+                if (ok && val > StartAddress && val < EndAddress)
+                {
+                    /* Address validates; mark it as an entry point. */
+                    AddEntry(val, val, RTN_SURE);
+                    if (fVerbose)
+                        fprintf(stderr, "%s: SYS %d found, marking as entry point\n", prog, val);
+                }
+            }
 
-		if (ok && val > StartAddress && val < EndAddress) {
-			/* Address validates; mark it as an entry point. */
-			AddEntry (val, val, RTN_SURE);
-			if (fVerbose)
-fprintf(stderr, "%s: SYS %d found, marking as entry point\n", prog, val);
-		}
-	}
-
-	/* Try to find the end of BASIC text. Three nulls needed. */
-	ok = 0;
-	for(; offs < EndAddress; offs++) {
-		if (Memory[offs] == 0) {
-			ok++;
-			if (ok == 3) {
-				BasicHeaderLength = (offs - StartAddress) + 1;
+            /* Try to find the end of BASIC text. Three nulls needed. */
+            ok = 0;
+            for (; offs < EndAddress; offs++)
+            {
+                if (Memory[offs] == 0)
+                {
+                    ok++;
+                    if (ok == 3)
+                    {
+                        BasicHeaderLength = (offs - StartAddress) + 1;
 
-				/* Mark entire length of BASIC text as dead. */
-				for(i = StartAddress; i < offs; i++) {
-					SetMemType(i, MEM_UNPROCESSED);
-					SetMemFlag(i);
-				}
-				if (fVerbose)
-fprintf(stderr, "%s: BASIC text marked as dead through $%04x\n", prog, offs);
-				break;
-			} else
-				continue;
-		}
-		ok = 0;
-	}
-	if (ok < 3 && fVerbose)
-fprintf(stderr, "%s: warning: couldn't find a valid end of BASIC text\n", prog);
-
-     } else if (fVerbose)
-fprintf(stderr, "%s: warning: BASIC starting address $%04x, but invalid line\n",
-	prog, StartAddress);
+                        /* Mark entire length of BASIC text as dead. */
+                        for (i = StartAddress; i < offs; i++)
+                        {
+                            SetMemType(i, MEM_UNPROCESSED);
+                            SetMemFlag(i);
+                        }
+                        if (fVerbose)
+                            fprintf(stderr, "%s: BASIC text marked as dead through $%04x\n", prog, offs);
+                        break;
+                    }
+                    else
+                        continue;
+                }
+                ok = 0;
+            }
+            if (ok < 3 && fVerbose)
+                fprintf(stderr, "%s: warning: couldn't find a valid end of BASIC text\n", prog);
+        }
+        else if (fVerbose)
+            fprintf(stderr, "%s: warning: BASIC starting address $%04x, but invalid line\n", prog, StartAddress);
+    }
 
-  }
+    if (fVerbose)
+        fprintf(stderr, "%s: disassembling $%04x-$%04x\n", prog, StartAddress, EndAddress);
 
-  if (fVerbose)
-    fprintf (stderr, "%s: disassembling $%04x-$%04x\n", prog,
-             StartAddress, EndAddress);
-
-  if (ScanSpecified ()) {
-    fprintf (stderr, "\n%s: Invalid routine address(es) specified. Stop.\n",
-             prog);
+    if (ScanSpecified())
+    {
+        fprintf(stderr, "\n%s: Invalid routine address(es) specified. Stop.\n", prog);
 
-    return 4;
-  }
+        return 4;
+    }
 
-  ScanPotentials ();
-  ScanTheRest ();
-  Collect ();
-  SearchVectors ();
-  Dump ();
+    ScanPotentials();
+    ScanTheRest();
+    Collect();
+    SearchVectors();
+    Dump();
 
-  return 0;
+    return 0;
 }
--- a/opcodes.h	Thu Oct 14 01:40:24 2021 +0300
+++ b/opcodes.h	Thu Oct 14 01:53:20 2021 +0300
@@ -86,21 +86,19 @@
 };
 
 #ifdef _DUMP_C_
-static char *prefix[] = { "", "#", "", "", "", "", "", "",
-                          "(", "", "", "", "(", "(", "(", "(" };
+static char *prefix[] = {"", "#", "", "", "", "", "", "", "(", "", "", "", "(", "(", "(", "("};
 
 /* static char *postfix[] = { " A", "", "", "", ",X", ",Y", ",X", ",Y", */
-static char *postfix[] = { "", "", "", "", ",x", ",y", ",x", ",y",
-                           ",x)", "", "", "", ",x)", "),y", ")", ")" };
+static char *postfix[] = {"", "", "", "", ",x", ",y", ",x", ",y", ",x)", "", "", "", ",x)", "),y", ")", ")"};
 #endif /* _DUMP_C_ */
 
 /* Adressing mode types. */
 enum
 {
-  absindir, /* absolute parameter (8 or 16 bits) for indirection */
-  absolute, /* absolute parameter (8 or 16 bits), not indexed */
-  other,    /* something else (except impimm) */
-  impimm    /* implied or immediate parameter */
+    absindir, /* absolute parameter (8 or 16 bits) for indirection */
+    absolute, /* absolute parameter (8 or 16 bits), not indexed */
+    other,    /* something else (except impimm) */
+    impimm    /* implied or immediate parameter */
 };
 
 #ifndef _SCAN_C_
@@ -115,13 +113,13 @@
 #ifndef _SCAN_C_
 extern unsigned int sizes[];
 #else
-unsigned int sizes[] = { 1, 2, 3, 2, 2, 2, 3, 3, 3, 1, 2, 3, 2, 2, 3, 2 };
+unsigned int sizes[] = {1, 2, 3, 2, 2, 2, 3, 3, 3, 1, 2, 3, 2, 2, 3, 2};
 #endif
 
 typedef struct opcodes
 {
-  int mnemonic; /* index to mnemonic instruction name table */
-  int admode;   /* addressing mode */
+    int mnemonic; /* index to mnemonic instruction name table */
+    int admode;   /* addressing mode */
 } opcodes;
 
 #ifndef _MAIN_C_
--- a/proto.h	Thu Oct 14 01:40:24 2021 +0300
+++ b/proto.h	Thu Oct 14 01:53:20 2021 +0300
@@ -40,13 +40,9 @@
 
 /* table.c */
 
-table *FindNextEntryType(table *entry, unsigned char andmask,
-                                unsigned char eormask);
-table *FindNextEntryTypeParent(table *entry, ADDR_T parent,
-                                      unsigned char andmask,
-                                      unsigned char eormask);
-table *FindNextEntry(table *entry, ADDR_T address,
-                            unsigned char andmask, unsigned char eormask);
+table *FindNextEntryType(table *entry, unsigned char andmask, unsigned char eormask);
+table *FindNextEntryTypeParent(table *entry, ADDR_T parent, unsigned char andmask, unsigned char eormask);
+table *FindNextEntry(table *entry, ADDR_T address, unsigned char andmask, unsigned char eormask);
 void AddEntry(ADDR_T address, ADDR_T parent, unsigned char type);
 void DeleteEntry(table *entry);
 
--- a/scan.c	Thu Oct 14 01:40:24 2021 +0300
+++ b/scan.c	Thu Oct 14 01:53:20 2021 +0300
@@ -21,872 +21,887 @@
 \*/
 
 #define _SCAN_C_
-#include <stdio.h>
-#include "proto.h"
 #include "opcodes.h"
 #include "options.h"
-
-
-int ScanSure (ADDR_T scanstart)
-{
-  ADDR_T address, addr;
-  opcodes *instr;
-
-  unsigned int size, counter;
-  if (fVerbose)
-    fprintf(stderr, "\n%s: scanning sure section $%04x", prog, scanstart);
+#include "proto.h"
+#include <stdio.h>
 
-  for (address = scanstart;; address += size) {
-    if (GetMemFlag (address)) /* rest of routine not valid */
-      return ((Options & M_DATA_BLOCKS) == O_DBL_STRICT);
-
-    instr = &opset[Memory[address]];
+int ScanSure(ADDR_T scanstart)
+{
+    ADDR_T address, addr;
+    opcodes *instr;
 
-    if (!instr->mnemonic) /* invalid opcode */
-      return ((Options & M_DATA_BLOCKS) == O_DBL_STRICT);
-
-    size = sizes[instr->admode];
-    if ((ADDR_T)(address + size - StartAddress) >
-        (ADDR_T)(EndAddress - StartAddress))
-      break; /* end of program code encountered */
+    unsigned int size, counter;
+    if (fVerbose)
+        fprintf(stderr, "\n%s: scanning sure section $%04x", prog, scanstart);
 
-    switch (GetMemType (address)) {
-    case MEM_INSTRUCTION:
-      return 0; /* The rest of the routine has already been processed. */
+    for (address = scanstart;; address += size)
+    {
+        if (GetMemFlag(address)) /* rest of routine not valid */
+            return ((Options & M_DATA_BLOCKS) == O_DBL_STRICT);
 
-    case MEM_DATA:
-      AddEntry (address, scanstart, WRN_INSTR_WRITTEN_TO);
-      break;
-
-    case MEM_PARAMETER:
-      AddEntry (address, scanstart, WRN_PARAM_JUMPED_TO);
-    }
-
-    SetMemType (address, MEM_INSTRUCTION);
+        instr = &opset[Memory[address]];
 
-    for (counter = size, addr = address + 1; --counter; addr++)
-      switch GetMemType(addr) {
-      case MEM_INSTRUCTION:
-        AddEntry (addr, scanstart, WRN_PARAM_JUMPED_TO);
-        break;
-      case MEM_DATA:
-        AddEntry (addr, scanstart, WRN_PARAM_WRITTEN_TO);
-        /* fall through */
-      default:
-        SetMemType (addr, MEM_PARAMETER);
-      }
+        if (!instr->mnemonic) /* invalid opcode */
+            return ((Options & M_DATA_BLOCKS) == O_DBL_STRICT);
 
-    if (instr->admode == zrel) {
-      addr = Memory[(ADDR_T)(address + 1)];
+        size = sizes[instr->admode];
+        if ((ADDR_T)(address + size - StartAddress) > (ADDR_T)(EndAddress - StartAddress))
+            break; /* end of program code encountered */
 
-      if (GetMemFlag (addr) && GetMemType (addr) == MEM_UNPROCESSED)
-	return (Options & M_DATA_BLOCKS) == O_DBL_STRICT;
-
-      if (((ADDR_T)(addr - StartAddress) <
-	   (ADDR_T)(EndAddress - StartAddress) ||
-	   Options & B_LBL_ALWAYS)) {
-
-	PutLabel (addr);
-	PutReference (addr);
-	PutLowByte (addr);
-	PutHighByte (addr);
-      }
+        switch (GetMemType(address))
+        {
+        case MEM_INSTRUCTION:
+            return 0; /* The rest of the routine has already been processed. */
 
-      addr = (ADDR_T)((int)(char)Memory[(ADDR_T)(address + 2)] +
-		      address + size);
-      goto IsJump;
-    }
+        case MEM_DATA:
+            AddEntry(address, scanstart, WRN_INSTR_WRITTEN_TO);
+            break;
 
-    if (instr->admode == rel) {
-      addr = (ADDR_T)((int)(char)Memory[(ADDR_T)(address + 1)] +
-                      address + size);
-
-      goto IsJump;
-    }
-    if ((instr->mnemonic == S_JSR || instr->mnemonic == S_JMP) &&
-        instr->admode == abso) {
-      addr = Memory[(ADDR_T)(address + 1)] +
-        (Memory[(ADDR_T)(address + 2)] << 8);
+        case MEM_PARAMETER:
+            AddEntry(address, scanstart, WRN_PARAM_JUMPED_TO);
+        }
 
-    IsJump:
-      if (GetMemFlag (addr))
-        return ((Options & M_DATA_BLOCKS) == O_DBL_STRICT);
+        SetMemType(address, MEM_INSTRUCTION);
 
-      if ((ADDR_T)(addr - StartAddress) <
-          (ADDR_T)(EndAddress - StartAddress)) {
-        if (GetMemType (addr) == MEM_INSTRUCTION) {
-          PutLabel (addr);
-          PutReference (addr);
-          PutLowByte (addr);
-          PutHighByte (addr);
-        }
-        else
-          AddEntry (addr, scanstart, Options & B_SCEPTIC &&
-                    instr->admode == rel && instr->mnemonic != S_BRA ?
-                    RTN_POTENTIAL : RTN_SURE);
-      }
-      else if (Options & B_LBL_ALWAYS) {
-        PutLabel (addr);
-	PutReference (addr);
-        PutLowByte (addr);
-        PutHighByte (addr);
-      }
-
-      if ((Options & M_DATA_BLOCKS) == O_DBL_STRICT &&
-	  Options & B_JMP_STRICT &&
-	  addr == address && instr->mnemonic != S_BVC)
-        return 1;
-    }
+        for (counter = size, addr = address + 1; --counter; addr++)
+            switch
+                GetMemType(addr)
+                {
+                case MEM_INSTRUCTION:
+                    AddEntry(addr, scanstart, WRN_PARAM_JUMPED_TO);
+                    break;
+                case MEM_DATA:
+                    AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO);
+                    /* fall through */
+                default:
+                    SetMemType(addr, MEM_PARAMETER);
+                }
 
-    switch (instr->mnemonic) {
-    case S_JMP:
-      addr = Memory[(ADDR_T)(address + 1)] +
-	(Memory[(ADDR_T)(address + 2)] << 8);
-
-      if (instr->admode == iabs && (ADDR_T)(addr - StartAddress) <
-	  (ADDR_T)(EndAddress - StartAddress)) {
-	PutLabel (addr);
-        PutReference (addr);
-	PutLowByte (addr);
-	PutHighByte (addr);
+        if (instr->admode == zrel)
+        {
+            addr = Memory[(ADDR_T)(address + 1)];
 
-	/* Mark pointer as data. */
-	switch (GetMemType (addr)) {
-	case MEM_UNPROCESSED:
-	  SetMemType (addr, MEM_DATA);
-	  break;
-	case MEM_INSTRUCTION:
-	  AddEntry (addr, scanstart, WRN_INSTR_WRITTEN_TO);
-	  break;
-	case MEM_PARAMETER:
-	  AddEntry (addr, scanstart, WRN_PARAM_WRITTEN_TO);
-	  break;
-	}
+            if (GetMemFlag(addr) && GetMemType(addr) == MEM_UNPROCESSED)
+                return (Options & M_DATA_BLOCKS) == O_DBL_STRICT;
 
-	addr++;
+            if (((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress) || Options & B_LBL_ALWAYS))
+            {
 
-	if ((ADDR_T)(addr - StartAddress) <
-	    (ADDR_T)(EndAddress - StartAddress))
-	  switch (GetMemType (addr)) {
-	  case MEM_UNPROCESSED:
-	    SetMemType (addr, MEM_DATA);
-	    break;
-	  case MEM_INSTRUCTION:
-	    AddEntry (addr, scanstart, WRN_INSTR_WRITTEN_TO);
-	    break;
-	  case MEM_PARAMETER:
-	    AddEntry (addr, scanstart, WRN_PARAM_WRITTEN_TO);
-	    break;
-	  }
-      }
-      else if (Options & B_LBL_ALWAYS) {
-	PutLabel (addr);
-	PutReference (addr);
-	PutLowByte (addr);
-	PutHighByte (addr);
-      }
-      return 0;
+                PutLabel(addr);
+                PutReference(addr);
+                PutLowByte(addr);
+                PutHighByte(addr);
+            }
+
+            addr = (ADDR_T)((int)(char)Memory[(ADDR_T)(address + 2)] + address + size);
+            goto IsJump;
+        }
 
-    case S_BRA:
-    case S_RTS:
-    case S_RTI:
-      return 0;
+        if (instr->admode == rel)
+        {
+            addr = (ADDR_T)((int)(char)Memory[(ADDR_T)(address + 1)] + address + size);
 
-    case S_BRK:
-    case S_STP:
-      return (Options & M_DATA_BLOCKS) == O_DBL_STRICT &&
-	Options & B_BRK_REJECT;
-    }
+            goto IsJump;
+        }
+        if ((instr->mnemonic == S_JSR || instr->mnemonic == S_JMP) && instr->admode == abso)
+        {
+            addr = Memory[(ADDR_T)(address + 1)] + (Memory[(ADDR_T)(address + 2)] << 8);
 
-    if (instr->admode == rel) {
-      if ((ADDR_T)(addr - scanstart) >= (ADDR_T)(address - scanstart)
-          || GetMemType (addr) != MEM_INSTRUCTION) {
-        if (GetMemType (address + size) != MEM_INSTRUCTION)
-          AddEntry (address + size, scanstart, RTN_POTENTIAL);
-
-        return 0;
-      }
-
-      continue;
-    }
-
-    if (instr->mnemonic == S_JSR) {
-      if (!(Options & B_STK_BALANCE)) {
-        if (GetMemType (address + size) != MEM_INSTRUCTION)
-          AddEntry (address + size, scanstart, RTN_POTENTIAL);
-
-        return 0;
-      }
-
-      continue;
-    }
+        IsJump:
+            if (GetMemFlag(addr))
+                return ((Options & M_DATA_BLOCKS) == O_DBL_STRICT);
 
-    switch (size) {
-    case 2:
-      addr = Memory[(ADDR_T)(address + 1)];
-      break;
-    case 3:
-      addr = Memory[(ADDR_T)(address + 1)] +
-        (Memory[(ADDR_T)(address + 2)] << 8);
-      break;
-    }
-
-    if (types[instr->admode] != impimm && GetMemFlag (addr) &&
-	GetMemType (addr) == MEM_UNPROCESSED)
-      return (Options & M_DATA_BLOCKS) == O_DBL_STRICT;
+            if ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+            {
+                if (GetMemType(addr) == MEM_INSTRUCTION)
+                {
+                    PutLabel(addr);
+                    PutReference(addr);
+                    PutLowByte(addr);
+                    PutHighByte(addr);
+                }
+                else
+                    AddEntry(addr, scanstart,
+                             Options & B_SCEPTIC && instr->admode == rel && instr->mnemonic != S_BRA ? RTN_POTENTIAL
+                                                                                                     : RTN_SURE);
+            }
+            else if (Options & B_LBL_ALWAYS)
+            {
+                PutLabel(addr);
+                PutReference(addr);
+                PutLowByte(addr);
+                PutHighByte(addr);
+            }
 
-    if (types[instr->admode] != impimm &&
-        ((ADDR_T)(addr - StartAddress) <
-        (ADDR_T)(EndAddress - StartAddress) ||
-        Options & B_LBL_ALWAYS)) {
-      PutLabel (addr);
-      PutReference (addr);
-      PutLowByte (addr);
-      PutHighByte (addr);
-    }
-
-    if (types[instr->admode] != other && types[instr->admode] != impimm) {
-      if ((ADDR_T)(addr - StartAddress) <
-          (ADDR_T)(EndAddress - StartAddress)) {
-        switch (GetMemType (addr)) {
-        case MEM_UNPROCESSED:
-          SetMemType (addr, MEM_DATA);
-          break;
-        case MEM_INSTRUCTION:
-          AddEntry (addr, scanstart, WRN_INSTR_WRITTEN_TO);
-          break;
-        case MEM_PARAMETER:
-          AddEntry (addr, scanstart, WRN_PARAM_WRITTEN_TO);
-          break;
+            if ((Options & M_DATA_BLOCKS) == O_DBL_STRICT && Options & B_JMP_STRICT && addr == address &&
+                instr->mnemonic != S_BVC)
+                return 1;
         }
 
-        if (types[instr->admode] == absindir) { /* indirect mode */
-          addr++; /* set flags for upper vector byte */
+        switch (instr->mnemonic)
+        {
+        case S_JMP:
+            addr = Memory[(ADDR_T)(address + 1)] + (Memory[(ADDR_T)(address + 2)] << 8);
+
+            if (instr->admode == iabs && (ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+            {
+                PutLabel(addr);
+                PutReference(addr);
+                PutLowByte(addr);
+                PutHighByte(addr);
+
+                /* Mark pointer as data. */
+                switch (GetMemType(addr))
+                {
+                case MEM_UNPROCESSED:
+                    SetMemType(addr, MEM_DATA);
+                    break;
+                case MEM_INSTRUCTION:
+                    AddEntry(addr, scanstart, WRN_INSTR_WRITTEN_TO);
+                    break;
+                case MEM_PARAMETER:
+                    AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO);
+                    break;
+                }
+
+                addr++;
+
+                if ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+                    switch (GetMemType(addr))
+                    {
+                    case MEM_UNPROCESSED:
+                        SetMemType(addr, MEM_DATA);
+                        break;
+                    case MEM_INSTRUCTION:
+                        AddEntry(addr, scanstart, WRN_INSTR_WRITTEN_TO);
+                        break;
+                    case MEM_PARAMETER:
+                        AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO);
+                        break;
+                    }
+            }
+            else if (Options & B_LBL_ALWAYS)
+            {
+                PutLabel(addr);
+                PutReference(addr);
+                PutLowByte(addr);
+                PutHighByte(addr);
+            }
+            return 0;
+
+        case S_BRA:
+        case S_RTS:
+        case S_RTI:
+            return 0;
+
+        case S_BRK:
+        case S_STP:
+            return (Options & M_DATA_BLOCKS) == O_DBL_STRICT && Options & B_BRK_REJECT;
+        }
+
+        if (instr->admode == rel)
+        {
+            if ((ADDR_T)(addr - scanstart) >= (ADDR_T)(address - scanstart) || GetMemType(addr) != MEM_INSTRUCTION)
+            {
+                if (GetMemType(address + size) != MEM_INSTRUCTION)
+                    AddEntry(address + size, scanstart, RTN_POTENTIAL);
+
+                return 0;
+            }
 
-          if ((ADDR_T)(addr - StartAddress) <
-              (ADDR_T)(EndAddress - StartAddress))
-            switch (GetMemType (addr)) {
-            case MEM_UNPROCESSED:
-              SetMemType (addr, MEM_DATA);
-              break;
-            case MEM_INSTRUCTION:
-              AddEntry (addr, scanstart, WRN_INSTR_WRITTEN_TO);
-              break;
-            case MEM_PARAMETER:
-              AddEntry (addr, scanstart, WRN_PARAM_WRITTEN_TO);
-              break;
+            continue;
+        }
+
+        if (instr->mnemonic == S_JSR)
+        {
+            if (!(Options & B_STK_BALANCE))
+            {
+                if (GetMemType(address + size) != MEM_INSTRUCTION)
+                    AddEntry(address + size, scanstart, RTN_POTENTIAL);
+
+                return 0;
+            }
+
+            continue;
+        }
+
+        switch (size)
+        {
+        case 2:
+            addr = Memory[(ADDR_T)(address + 1)];
+            break;
+        case 3:
+            addr = Memory[(ADDR_T)(address + 1)] + (Memory[(ADDR_T)(address + 2)] << 8);
+            break;
+        }
+
+        if (types[instr->admode] != impimm && GetMemFlag(addr) && GetMemType(addr) == MEM_UNPROCESSED)
+            return (Options & M_DATA_BLOCKS) == O_DBL_STRICT;
+
+        if (types[instr->admode] != impimm &&
+            ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress) || Options & B_LBL_ALWAYS))
+        {
+            PutLabel(addr);
+            PutReference(addr);
+            PutLowByte(addr);
+            PutHighByte(addr);
+        }
+
+        if (types[instr->admode] != other && types[instr->admode] != impimm)
+        {
+            if ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+            {
+                switch (GetMemType(addr))
+                {
+                case MEM_UNPROCESSED:
+                    SetMemType(addr, MEM_DATA);
+                    break;
+                case MEM_INSTRUCTION:
+                    AddEntry(addr, scanstart, WRN_INSTR_WRITTEN_TO);
+                    break;
+                case MEM_PARAMETER:
+                    AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO);
+                    break;
+                }
+
+                if (types[instr->admode] == absindir)
+                {           /* indirect mode */
+                    addr++; /* set flags for upper vector byte */
+
+                    if ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+                        switch (GetMemType(addr))
+                        {
+                        case MEM_UNPROCESSED:
+                            SetMemType(addr, MEM_DATA);
+                            break;
+                        case MEM_INSTRUCTION:
+                            AddEntry(addr, scanstart, WRN_INSTR_WRITTEN_TO);
+                            break;
+                        case MEM_PARAMETER:
+                            AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO);
+                            break;
+                        }
+                }
             }
         }
-      }
-    }
-  }
-
-  /* end of program (unexpectedly) encountered */
-
-  if (Options & O_DBL_STRICT) return 1;
-
-  AddEntry (EndAddress, scanstart, WRN_RTN_TRUNCATED);
-  return 0;
-}
-
-
-int ScanPotential (ADDR_T scanstart)
-{
-  ADDR_T address, addr;
-  opcodes *instr;
-
-  unsigned int size, counter;
-
-  for (address = scanstart;; address += size) {
-    if (GetMemFlag (address)) /* rest of routine not valid */
-      return 1;
-
-    instr = &opset[Memory[address]];
-
-    if (!instr->mnemonic) { /* invalid opcode */
-      SetMemFlag (address);
-
-      if (GetMemType (address) == MEM_UNPROCESSED)
-        SetMemType (address, MEM_DATA);
-      return 1;
-    }
-
-    size = sizes[instr->admode];
-    if ((ADDR_T)(address + size - StartAddress) >
-        (ADDR_T)(EndAddress - StartAddress))
-      break; /* end of program code encountered */
-
-    if (GetMemType (address) == MEM_INSTRUCTION)
-      return 0; /* The rest of the routine has already been processed. */
-
-    if (instr->admode == zrel) {
-      addr = Memory[(ADDR_T)(address + 1)];
-
-      if (GetMemFlag (addr) && GetMemType (addr) == MEM_UNPROCESSED)
-	goto Failure;
-
-      if (((ADDR_T)(addr - StartAddress) <
-	   (ADDR_T)(EndAddress - StartAddress) ||
-	   Options & B_LBL_ALWAYS))
-	AddEntry (addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
-
-      addr = (ADDR_T)((int)(char)Memory[(ADDR_T)(address + 1)] +
-                      address + size);
-
-      goto IsJump;
-    }
-
-    if (instr->admode == rel) {
-      addr = (ADDR_T)((int)(char)Memory[(ADDR_T)(address + 1)] +
-                      address + size);
-
-      goto IsJump;
-    }
-
-    switch (size) {
-    case 2:
-      addr = Memory[(ADDR_T)(address + 1)];
-      break;
-    case 3:
-      addr = Memory[(ADDR_T)(address + 1)] +
-        (Memory[(ADDR_T)(address + 2)] << 8);
-      break;
-    default:
-      addr = address;
-    }
-
-    if (types[instr->admode] != impimm && GetMemFlag (addr) &&
-        GetMemType (addr) == MEM_UNPROCESSED) {
-    Failure:
-      SetMemFlag (address);
-
-      if (GetMemType (address) == MEM_UNPROCESSED)
-        SetMemType (address, MEM_DATA);
-      return 1;
-    }
-
-    if ((instr->mnemonic == S_JSR || instr->mnemonic == S_JMP) &&
-        instr->admode == abso) {
-    IsJump:
-      if (GetMemFlag (addr)) {
-        SetMemFlag (address);
-
-        if (GetMemType (address) == MEM_UNPROCESSED)
-          SetMemType (address, MEM_DATA);
-        return 1;
-      }
-
-      if ((ADDR_T)(addr - StartAddress) <
-          (ADDR_T)(EndAddress - StartAddress))
-        AddEntry (addr, scanstart, Options & B_SCEPTIC &&
-                  instr->admode == rel && instr->mnemonic != S_BRA ?
-                  RTN_SUSP_POT : RTN_SUSPECTED);
-      else if (Options & B_LBL_ALWAYS)
-        AddEntry (addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
-
-      if (Options & B_JMP_STRICT && addr == address &&
-          instr->mnemonic != S_BVC) {
-        SetMemFlag (address);
-
-        if (GetMemType (address) == MEM_UNPROCESSED)
-          SetMemType (address, MEM_DATA);
-        return 1;
-      }
-    }
-
-    switch (instr->mnemonic) {
-    case S_BRK:
-    case S_STP:
-      if (Options & B_BRK_REJECT) {
-        SetMemFlag (address);
-
-        if (GetMemType (address) == MEM_UNPROCESSED)
-          SetMemType (address, MEM_DATA);
-        return 1;
-      }
     }
 
-    if (!GetMemFlag (address))
-      switch (GetMemType (address)) {
-      case MEM_DATA:
-        AddEntry (address, scanstart, WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
-        break;
+    /* end of program (unexpectedly) encountered */
+
+    if (Options & O_DBL_STRICT)
+        return 1;
+
+    AddEntry(EndAddress, scanstart, WRN_RTN_TRUNCATED);
+    return 0;
+}
+
+int ScanPotential(ADDR_T scanstart)
+{
+    ADDR_T address, addr;
+    opcodes *instr;
+
+    unsigned int size, counter;
+
+    for (address = scanstart;; address += size)
+    {
+        if (GetMemFlag(address)) /* rest of routine not valid */
+            return 1;
+
+        instr = &opset[Memory[address]];
+
+        if (!instr->mnemonic)
+        { /* invalid opcode */
+            SetMemFlag(address);
 
-      case MEM_PARAMETER:
-        AddEntry (address, scanstart, WRN_PARAM_JUMPED_TO | WRN_B_TEMPORARY);
-      }
+            if (GetMemType(address) == MEM_UNPROCESSED)
+                SetMemType(address, MEM_DATA);
+            return 1;
+        }
+
+        size = sizes[instr->admode];
+        if ((ADDR_T)(address + size - StartAddress) > (ADDR_T)(EndAddress - StartAddress))
+            break; /* end of program code encountered */
+
+        if (GetMemType(address) == MEM_INSTRUCTION)
+            return 0; /* The rest of the routine has already been processed. */
+
+        if (instr->admode == zrel)
+        {
+            addr = Memory[(ADDR_T)(address + 1)];
 
-    SetMemType (address, MEM_INSTRUCTION);
+            if (GetMemFlag(addr) && GetMemType(addr) == MEM_UNPROCESSED)
+                goto Failure;
+
+            if (((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress) || Options & B_LBL_ALWAYS))
+                AddEntry(addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
+
+            addr = (ADDR_T)((int)(char)Memory[(ADDR_T)(address + 1)] + address + size);
+
+            goto IsJump;
+        }
+
+        if (instr->admode == rel)
+        {
+            addr = (ADDR_T)((int)(char)Memory[(ADDR_T)(address + 1)] + address + size);
+
+            goto IsJump;
+        }
 
-    for (counter = size, addr = address + 1; --counter; addr++)
-      switch (GetMemType (addr)) {
-      case MEM_INSTRUCTION:
-        AddEntry (addr, scanstart, WRN_PARAM_JUMPED_TO | WRN_B_TEMPORARY);
-        break;
-      case MEM_DATA:
-        if (!GetMemFlag (addr))
-          AddEntry (addr, scanstart, WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
-        break;
-      default:
-        SetMemType (addr, MEM_PARAMETER);
-      }
+        switch (size)
+        {
+        case 2:
+            addr = Memory[(ADDR_T)(address + 1)];
+            break;
+        case 3:
+            addr = Memory[(ADDR_T)(address + 1)] + (Memory[(ADDR_T)(address + 2)] << 8);
+            break;
+        default:
+            addr = address;
+        }
+
+        if (types[instr->admode] != impimm && GetMemFlag(addr) && GetMemType(addr) == MEM_UNPROCESSED)
+        {
+        Failure:
+            SetMemFlag(address);
+
+            if (GetMemType(address) == MEM_UNPROCESSED)
+                SetMemType(address, MEM_DATA);
+            return 1;
+        }
+
+        if ((instr->mnemonic == S_JSR || instr->mnemonic == S_JMP) && instr->admode == abso)
+        {
+        IsJump:
+            if (GetMemFlag(addr))
+            {
+                SetMemFlag(address);
+
+                if (GetMemType(address) == MEM_UNPROCESSED)
+                    SetMemType(address, MEM_DATA);
+                return 1;
+            }
 
-    switch (instr->mnemonic) {
-    case S_BRK:
-    case S_STP:
-    case S_RTS:
-    case S_BRA:
-    case S_RTI:
-      return 0;
+            if ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+                AddEntry(addr, scanstart,
+                         Options & B_SCEPTIC && instr->admode == rel && instr->mnemonic != S_BRA ? RTN_SUSP_POT
+                                                                                                 : RTN_SUSPECTED);
+            else if (Options & B_LBL_ALWAYS)
+                AddEntry(addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
+
+            if (Options & B_JMP_STRICT && addr == address && instr->mnemonic != S_BVC)
+            {
+                SetMemFlag(address);
+
+                if (GetMemType(address) == MEM_UNPROCESSED)
+                    SetMemType(address, MEM_DATA);
+                return 1;
+            }
+        }
 
-    case S_JMP:
-      addr = Memory[(ADDR_T)(address + 1)] +
-	(Memory[(ADDR_T)(address + 2)] << 8);
+        switch (instr->mnemonic)
+        {
+        case S_BRK:
+        case S_STP:
+            if (Options & B_BRK_REJECT)
+            {
+                SetMemFlag(address);
 
-      if (instr->admode == iabs && (ADDR_T)(addr - StartAddress) <
-	  (ADDR_T)(EndAddress - StartAddress)) {
-	AddEntry (addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
+                if (GetMemType(address) == MEM_UNPROCESSED)
+                    SetMemType(address, MEM_DATA);
+                return 1;
+            }
+        }
+
+        if (!GetMemFlag(address))
+            switch (GetMemType(address))
+            {
+            case MEM_DATA:
+                AddEntry(address, scanstart, WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
+                break;
+
+            case MEM_PARAMETER:
+                AddEntry(address, scanstart, WRN_PARAM_JUMPED_TO | WRN_B_TEMPORARY);
+            }
 
-	/* Mark pointer as data. */
-	switch (GetMemType (addr)) {
-	case MEM_UNPROCESSED:
-	  AddEntry (addr, scanstart, WRN_I_ACCESSED | WRN_B_TEMPORARY);
-	  break;
-	case MEM_INSTRUCTION:
-	  AddEntry (addr, scanstart, WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
-	  break;
-	case MEM_PARAMETER:
-	  AddEntry (addr, scanstart, WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
-	  break;
-	}
+        SetMemType(address, MEM_INSTRUCTION);
+
+        for (counter = size, addr = address + 1; --counter; addr++)
+            switch (GetMemType(addr))
+            {
+            case MEM_INSTRUCTION:
+                AddEntry(addr, scanstart, WRN_PARAM_JUMPED_TO | WRN_B_TEMPORARY);
+                break;
+            case MEM_DATA:
+                if (!GetMemFlag(addr))
+                    AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
+                break;
+            default:
+                SetMemType(addr, MEM_PARAMETER);
+            }
+
+        switch (instr->mnemonic)
+        {
+        case S_BRK:
+        case S_STP:
+        case S_RTS:
+        case S_BRA:
+        case S_RTI:
+            return 0;
+
+        case S_JMP:
+            addr = Memory[(ADDR_T)(address + 1)] + (Memory[(ADDR_T)(address + 2)] << 8);
+
+            if (instr->admode == iabs && (ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+            {
+                AddEntry(addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
 
-	addr++;
+                /* Mark pointer as data. */
+                switch (GetMemType(addr))
+                {
+                case MEM_UNPROCESSED:
+                    AddEntry(addr, scanstart, WRN_I_ACCESSED | WRN_B_TEMPORARY);
+                    break;
+                case MEM_INSTRUCTION:
+                    AddEntry(addr, scanstart, WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
+                    break;
+                case MEM_PARAMETER:
+                    AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
+                    break;
+                }
+
+                addr++;
+
+                if ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+                    switch (GetMemType(addr))
+                    {
+                    case MEM_UNPROCESSED:
+                        AddEntry(addr, scanstart, WRN_I_ACCESSED | WRN_B_TEMPORARY);
+                        break;
+                    case MEM_INSTRUCTION:
+                        AddEntry(addr, scanstart, WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
+                        break;
+                    case MEM_PARAMETER:
+                        AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
+                        break;
+                    }
+            }
+            else if (Options & B_LBL_ALWAYS)
+                AddEntry(addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
+
+            return 0;
+        }
 
-	if ((ADDR_T)(addr - StartAddress) <
-	    (ADDR_T)(EndAddress - StartAddress))
-	  switch (GetMemType (addr)) {
-	  case MEM_UNPROCESSED:
-	    AddEntry (addr, scanstart, WRN_I_ACCESSED | WRN_B_TEMPORARY);
-	    break;
-	  case MEM_INSTRUCTION:
-	    AddEntry (addr, scanstart,
-		      WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
-	    break;
-	  case MEM_PARAMETER:
-	    AddEntry (addr, scanstart,
-		      WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
-	    break;
-	  }
-      }
-      else if (Options & B_LBL_ALWAYS)
-	AddEntry (addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
+        if (instr->admode == rel && GetMemType(address + size) != MEM_INSTRUCTION)
+        {
+            AddEntry(address + size, scanstart, RTN_SUSP_POT);
+
+            return 0;
+        }
+
+        if (instr->mnemonic == S_JSR)
+        {
+            if (!(Options & B_STK_BALANCE))
+            {
+                if (GetMemType(address + size) != MEM_INSTRUCTION)
+                    AddEntry(address + size, scanstart, RTN_SUSP_POT);
+
+                return 0;
+            }
 
-      return 0;
-    }
+            continue;
+        }
+
+        switch (size)
+        {
+        case 2:
+            addr = Memory[(ADDR_T)(address + 1)];
+            break;
+        case 3:
+            addr = Memory[(ADDR_T)(address + 1)] + (Memory[(ADDR_T)(address + 2)] << 8);
+            break;
+        }
+
+        if (types[instr->admode] != impimm &&
+            ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress) || Options & B_LBL_ALWAYS))
+            AddEntry(addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
 
-    if (instr->admode == rel &&
-        GetMemType (address + size) != MEM_INSTRUCTION) {
-      AddEntry (address + size, scanstart, RTN_SUSP_POT);
-
-      return 0;
-    }
-
-    if (instr->mnemonic == S_JSR) {
-      if (!(Options & B_STK_BALANCE)) {
-        if (GetMemType (address + size) != MEM_INSTRUCTION)
-          AddEntry (address + size, scanstart, RTN_SUSP_POT);
+        if (types[instr->admode] != other && types[instr->admode] != impimm)
+        {
+            if ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+            {
+                switch (GetMemType(addr))
+                {
+                case MEM_UNPROCESSED:
+                    AddEntry(addr, scanstart, WRN_I_ACCESSED | WRN_B_TEMPORARY);
+                    break;
+                case MEM_INSTRUCTION:
+                    AddEntry(addr, scanstart, WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
+                    break;
+                case MEM_PARAMETER:
+                    AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
+                    break;
+                }
 
-        return 0;
-      }
-
-      continue;
-    }
+                if (types[instr->admode] == absindir)
+                {           /* indirect mode */
+                    addr++; /* set flags for upper vector byte */
 
-    switch (size) {
-    case 2:
-      addr = Memory[(ADDR_T)(address + 1)];
-      break;
-    case 3:
-      addr = Memory[(ADDR_T)(address + 1)] +
-        (Memory[(ADDR_T)(address + 2)] << 8);
-      break;
+                    if ((ADDR_T)(addr - StartAddress) < (ADDR_T)(EndAddress - StartAddress))
+                        switch (GetMemType(addr))
+                        {
+                        case MEM_UNPROCESSED:
+                            AddEntry(addr, scanstart, WRN_I_ACCESSED | WRN_B_TEMPORARY);
+                            break;
+                        case MEM_INSTRUCTION:
+                            AddEntry(addr, scanstart, WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
+                            break;
+                        case MEM_PARAMETER:
+                            AddEntry(addr, scanstart, WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
+                            break;
+                        }
+                }
+            }
+        }
     }
 
-    if (types[instr->admode] != impimm &&
-        ((ADDR_T)(addr - StartAddress) <
-        (ADDR_T)(EndAddress - StartAddress) ||
-        Options & B_LBL_ALWAYS))
-      AddEntry (addr, scanstart, WRN_I_LABEL_NEEDED | WRN_B_TEMPORARY);
-
-    if (types[instr->admode] != other && types[instr->admode] != impimm) {
-      if ((ADDR_T)(addr - StartAddress) <
-          (ADDR_T)(EndAddress - StartAddress)) {
-        switch (GetMemType (addr)) {
-        case MEM_UNPROCESSED:
-          AddEntry (addr, scanstart, WRN_I_ACCESSED | WRN_B_TEMPORARY);
-          break;
-        case MEM_INSTRUCTION:
-          AddEntry (addr, scanstart, WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
-          break;
-        case MEM_PARAMETER:
-          AddEntry (addr, scanstart, WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
-          break;
-        }
-
-        if (types[instr->admode] == absindir) { /* indirect mode */
-          addr++; /* set flags for upper vector byte */
+    /* end of program (unexpectedly) encountered */
 
-          if ((ADDR_T)(addr - StartAddress) <
-              (ADDR_T)(EndAddress - StartAddress))
-            switch (GetMemType (addr)) {
-            case MEM_UNPROCESSED:
-              AddEntry (addr, scanstart, WRN_I_ACCESSED | WRN_B_TEMPORARY);
-              break;
-            case MEM_INSTRUCTION:
-              AddEntry (addr, scanstart,
-                        WRN_INSTR_WRITTEN_TO | WRN_B_TEMPORARY);
-              break;
-            case MEM_PARAMETER:
-              AddEntry (addr, scanstart,
-                        WRN_PARAM_WRITTEN_TO | WRN_B_TEMPORARY);
-              break;
-            }
-        }
-      }
-    }
-  }
-
-  /* end of program (unexpectedly) encountered */
-
-  return 1;
+    return 1;
 }
 
-
-int ScanSpecified (void)
-{
-  table *entry;
-
-  if (fVerbose)
-    fprintf (stderr, "%s: scanning the routines at specified address(es)",
-             prog);
-
-  while ((entry = FindNextEntryType (NULL, ~0, RTN_SURE))) {
-    PutLabel (entry->address);
-    PutReference (entry->address);
-    PutLowByte (entry->address);
-    PutHighByte (entry->address);
-
-    if (ScanSure (entry->address)) {
-		fprintf(stderr,"For routine specified at %i:",
-			(unsigned int)entry->address);
-		return 1;
-	}
-    entry = FindNextEntryType (NULL, ~0, RTN_SURE); // valgrind fart
-    DeleteEntry (entry);
-  }
-
-  return 0;
-}
-
-
-void UnDoScan (ADDR_T scanstart)
+int ScanSpecified(void)
 {
-  opcodes *instr;
-  unsigned counter;
-  ADDR_T address;
+    table *entry;
 
-  for (address = scanstart; address != EndAddress; address++) {
-    if (GetMemFlag (address)) return;
-
-    switch (GetMemType (address)) {
-    case MEM_UNPROCESSED:
-      return;
+    if (fVerbose)
+        fprintf(stderr, "%s: scanning the routines at specified address(es)", prog);
 
-    case MEM_INSTRUCTION:
-      SetMemFlag (address);
-      SetMemType (address, MEM_DATA); /* This could cause WRN_PARAM_WRITTEN_TO
-					 in vain. */
-      instr = &opset[Memory[address++]];
-      for (counter = sizes[instr->admode]; --counter; address++)
-        if (GetMemType (address) == MEM_PARAMETER)
-          SetMemType (address, MEM_UNPROCESSED);
-        else if (GetMemType (address) == MEM_INSTRUCTION)
-          break;
+    while ((entry = FindNextEntryType(NULL, ~0, RTN_SURE)))
+    {
+        PutLabel(entry->address);
+        PutReference(entry->address);
+        PutLowByte(entry->address);
+        PutHighByte(entry->address);
 
-      if (instr->mnemonic == S_STP || instr->mnemonic == S_BRK ||
-          instr->mnemonic == S_RTI || instr->mnemonic == S_RTS ||
-          instr->mnemonic == S_JMP || instr->admode == rel)
-        return;
+        if (ScanSure(entry->address))
+        {
+            fprintf(stderr, "For routine specified at %i:", (unsigned int)entry->address);
+            return 1;
+        }
+        entry = FindNextEntryType(NULL, ~0, RTN_SURE); // valgrind fart
+        DeleteEntry(entry);
+    }
 
-      address--;
-      break;
-
-    case MEM_PARAMETER:
-      SetMemType (address, MEM_UNPROCESSED);
-    }
-  }
+    return 0;
 }
 
-
-void DeleteSuspectedParents (ADDR_T child)
+void UnDoScan(ADDR_T scanstart)
 {
-  table *entry = NULL;
+    opcodes *instr;
+    unsigned counter;
+    ADDR_T address;
 
-  while ((entry = FindNextEntry (entry, child, ~(RTN_B_PROCESSED |
-                                                 RTN_B_TEMPORARY),
-                                 RTN_SUSPECTED))) {
-    if (entry->type & RTN_B_PROCESSED && entry->parent != child)
-      DeleteSuspectedParents (entry->parent);
+    for (address = scanstart; address != EndAddress; address++)
+    {
+        if (GetMemFlag(address))
+            return;
 
-    DeleteEntry (entry);
-  }
-
-  entry = NULL;
+        switch (GetMemType(address))
+        {
+        case MEM_UNPROCESSED:
+            return;
 
-  while ((entry = FindNextEntryTypeParent (entry, child, ~0, RTN_SUSP_POT)))
-    DeleteEntry (entry);
-
-  entry = NULL;
+        case MEM_INSTRUCTION:
+            SetMemFlag(address);
+            SetMemType(address, MEM_DATA); /* This could cause WRN_PARAM_WRITTEN_TO
+                          in vain. */
+            instr = &opset[Memory[address++]];
+            for (counter = sizes[instr->admode]; --counter; address++)
+                if (GetMemType(address) == MEM_PARAMETER)
+                    SetMemType(address, MEM_UNPROCESSED);
+                else if (GetMemType(address) == MEM_INSTRUCTION)
+                    break;
 
-  while ((entry = FindNextEntryTypeParent (entry, child,
-                                           MASK_ANY | WRN_B_TEMPORARY,
-                                           WRN_ANY | WRN_B_TEMPORARY))) {
-    if (entry->type == (WRN_PARAM_JUMPED_TO | WRN_B_TEMPORARY))
-      SetMemType (entry->address, MEM_PARAMETER);
+            if (instr->mnemonic == S_STP || instr->mnemonic == S_BRK || instr->mnemonic == S_RTI ||
+                instr->mnemonic == S_RTS || instr->mnemonic == S_JMP || instr->admode == rel)
+                return;
 
-    DeleteEntry (entry);
-  }
+            address--;
+            break;
 
-  UnDoScan (child);
+        case MEM_PARAMETER:
+            SetMemType(address, MEM_UNPROCESSED);
+        }
+    }
 }
 
-
-void ScanPotentials (void)
+void DeleteSuspectedParents(ADDR_T child)
 {
-  table *entry;
-  ADDR_T address;
-
-  if (fVerbose)
-    fprintf (stderr, "\n%s: scanning potential routines\n", prog);
-
-  while ((entry = FindNextEntryType (NULL, ~0, RTN_POTENTIAL))) {
-    address = entry->address;
-    DeleteEntry (entry);
-
-    if (!ScanPotential (address)) {
-      while ((entry = FindNextEntryType (NULL, ~RTN_B_TEMPORARY,
-                                         RTN_SUSPECTED))) {
-        entry->type |= RTN_B_PROCESSED;
+    table *entry = NULL;
 
-        if (ScanPotential (entry->address) &&
-            (Options & M_DATA_BLOCKS) != O_DBL_IGNORE) {
-          DeleteSuspectedParents (entry->address);
-          SetMemType (address, MEM_DATA);
-        }
-      }
+    while ((entry = FindNextEntry(entry, child, ~(RTN_B_PROCESSED | RTN_B_TEMPORARY), RTN_SUSPECTED)))
+    {
+        if (entry->type & RTN_B_PROCESSED && entry->parent != child)
+            DeleteSuspectedParents(entry->parent);
 
-      if (GetMemType (address) != MEM_DATA) {
-        PutLabel (address);
-        PutLowByte (address);
-        PutHighByte (address);
-      }
+        DeleteEntry(entry);
+    }
 
-      entry = NULL;
-
-      while ((entry = FindNextEntryType (entry, ~0, RTN_B_TEMPORARY |
-                                         RTN_SUSPECTED | RTN_B_PROCESSED)))
-        DeleteEntry (entry);
-
-      entry = NULL;
+    entry = NULL;
 
-      while ((entry = FindNextEntryType (entry, ~0,
-                                         RTN_SUSPECTED | RTN_B_PROCESSED))) {
-        PutLabel (entry->address);
-        PutReference (entry->address);
-        PutLowByte (entry->address);
-        PutHighByte (entry->address);
-        DeleteEntry (entry);
-      }
-
-      entry = NULL;
+    while ((entry = FindNextEntryTypeParent(entry, child, ~0, RTN_SUSP_POT)))
+        DeleteEntry(entry);
 
-      while ((entry = FindNextEntryType (entry, ~0, RTN_SUSP_POT)))
-        entry->type = RTN_POTENTIAL;
-
-      entry = NULL;
-
-      while ((entry = FindNextEntryType (entry, MASK_ANY | WRN_B_TEMPORARY,
-                                         WRN_ANY | WRN_B_TEMPORARY))) {
-        switch (entry->type & ~WRN_B_TEMPORARY) {
-        case WRN_PARAM_WRITTEN_TO:
-          if (GetMemType (entry->address) == MEM_DATA)
-            SetMemType (entry->address, MEM_PARAMETER);
-          entry->type &= ~WRN_B_TEMPORARY;
-          break;
+    entry = NULL;
 
-        case WRN_INSTR_WRITTEN_TO:
-          if (GetMemType (entry->address) == MEM_DATA)
-            SetMemType (entry->address, MEM_INSTRUCTION);
-          entry->type &= ~WRN_B_TEMPORARY;
-          break;
+    while ((entry = FindNextEntryTypeParent(entry, child, MASK_ANY | WRN_B_TEMPORARY, WRN_ANY | WRN_B_TEMPORARY)))
+    {
+        if (entry->type == (WRN_PARAM_JUMPED_TO | WRN_B_TEMPORARY))
+            SetMemType(entry->address, MEM_PARAMETER);
 
-        case WRN_I_ACCESSED:
-          SetMemType (entry->address, MEM_DATA);
-          /* fall through */
-        case WRN_I_LABEL_NEEDED:
-          PutLabel (entry->address);
-          PutReference (entry->address);
-          PutLowByte (entry->address);
-          PutHighByte (entry->address);
-          DeleteEntry (entry);
-          break;
+        DeleteEntry(entry);
+    }
 
-        default:
-          entry->type &= ~WRN_B_TEMPORARY;
-        }
-      }
-    }
-    else {
-      DeleteSuspectedParents (address);
-      SetMemType (address, MEM_DATA);
-    }
-  }
+    UnDoScan(child);
 }
 
-
-void ScanTheRest (void)
+void ScanPotentials(void)
 {
-  ADDR_T address;
-  table *entry;
-  unsigned int fPotentials;
+    table *entry;
+    ADDR_T address;
+
+    if (fVerbose)
+        fprintf(stderr, "\n%s: scanning potential routines\n", prog);
+
+    while ((entry = FindNextEntryType(NULL, ~0, RTN_POTENTIAL)))
+    {
+        address = entry->address;
+        DeleteEntry(entry);
+
+        if (!ScanPotential(address))
+        {
+            while ((entry = FindNextEntryType(NULL, ~RTN_B_TEMPORARY, RTN_SUSPECTED)))
+            {
+                entry->type |= RTN_B_PROCESSED;
+
+                if (ScanPotential(entry->address) && (Options & M_DATA_BLOCKS) != O_DBL_IGNORE)
+                {
+                    DeleteSuspectedParents(entry->address);
+                    SetMemType(address, MEM_DATA);
+                }
+            }
 
-  if ((Options & M_DATA_BLOCKS) == O_DBL_NOSCAN) {
-    for (address = StartAddress; address != EndAddress; address++)
-      if (GetMemType (address) == MEM_UNPROCESSED)
-        SetMemType (address, MEM_DATA);
+            if (GetMemType(address) != MEM_DATA)
+            {
+                PutLabel(address);
+                PutLowByte(address);
+                PutHighByte(address);
+            }
+
+            entry = NULL;
+
+            while ((entry = FindNextEntryType(entry, ~0, RTN_B_TEMPORARY | RTN_SUSPECTED | RTN_B_PROCESSED)))
+                DeleteEntry(entry);
+
+            entry = NULL;
 
-    return;
-  }
+            while ((entry = FindNextEntryType(entry, ~0, RTN_SUSPECTED | RTN_B_PROCESSED)))
+            {
+                PutLabel(entry->address);
+                PutReference(entry->address);
+                PutLowByte(entry->address);
+                PutHighByte(entry->address);
+                DeleteEntry(entry);
+            }
 
-  if (fVerbose)
-    fprintf (stderr, "%s: scanning the remaining bytes for routines\n", prog);
+            entry = NULL;
+
+            while ((entry = FindNextEntryType(entry, ~0, RTN_SUSP_POT)))
+                entry->type = RTN_POTENTIAL;
 
-  for (address = StartAddress; address != EndAddress; address++) {
-    if (GetMemType (address) || GetMemFlag (address))
-      continue; /* scan only unprocessed bytes */
+            entry = NULL;
+
+            while ((entry = FindNextEntryType(entry, MASK_ANY | WRN_B_TEMPORARY, WRN_ANY | WRN_B_TEMPORARY)))
+            {
+                switch (entry->type & ~WRN_B_TEMPORARY)
+                {
+                case WRN_PARAM_WRITTEN_TO:
+                    if (GetMemType(entry->address) == MEM_DATA)
+                        SetMemType(entry->address, MEM_PARAMETER);
+                    entry->type &= ~WRN_B_TEMPORARY;
+                    break;
+
+                case WRN_INSTR_WRITTEN_TO:
+                    if (GetMemType(entry->address) == MEM_DATA)
+                        SetMemType(entry->address, MEM_INSTRUCTION);
+                    entry->type &= ~WRN_B_TEMPORARY;
+                    break;
 
-    if (Options & B_RSC_STRICT)
-      switch (opset[Memory[address]].mnemonic) {
-      case S_RTI:
-      case S_RTS:
-      case S_BRK:
-      case S_STP:
-        continue;
+                case WRN_I_ACCESSED:
+                    SetMemType(entry->address, MEM_DATA);
+                    /* fall through */
+                case WRN_I_LABEL_NEEDED:
+                    PutLabel(entry->address);
+                    PutReference(entry->address);
+                    PutLowByte(entry->address);
+                    PutHighByte(entry->address);
+                    DeleteEntry(entry);
+                    break;
 
-      case S_BRA:
-        break;
+                default:
+                    entry->type &= ~WRN_B_TEMPORARY;
+                }
+            }
+        }
+        else
+        {
+            DeleteSuspectedParents(address);
+            SetMemType(address, MEM_DATA);
+        }
+    }
+}
 
-      default:
-        if (opset[Memory[address]].admode == rel &&
-            GetMemType (address + sizes[rel]) != MEM_INSTRUCTION)
-          AddEntry (address + sizes[rel], address,
-                    RTN_SUSPECTED | RTN_B_TEMPORARY);
-      }
+void ScanTheRest(void)
+{
+    ADDR_T address;
+    table *entry;
+    unsigned int fPotentials;
+
+    if ((Options & M_DATA_BLOCKS) == O_DBL_NOSCAN)
+    {
+        for (address = StartAddress; address != EndAddress; address++)
+            if (GetMemType(address) == MEM_UNPROCESSED)
+                SetMemType(address, MEM_DATA);
+
+        return;
+    }
 
     if (fVerbose)
-      fprintf (stderr, "\n%s: scanning at $%04x", prog, address);
+        fprintf(stderr, "%s: scanning the remaining bytes for routines\n", prog);
 
-    if (!ScanPotential (address)) {
-      while ((entry = FindNextEntryType (NULL, ~RTN_B_TEMPORARY,
-                                         RTN_SUSPECTED))) {
-        entry->type |= RTN_B_PROCESSED;
+    for (address = StartAddress; address != EndAddress; address++)
+    {
+        if (GetMemType(address) || GetMemFlag(address))
+            continue; /* scan only unprocessed bytes */
 
-        if (ScanPotential (entry->address) &&
-            (Options & M_DATA_BLOCKS) != O_DBL_IGNORE) {
-          DeleteSuspectedParents (entry->address);
-          SetMemType (address, MEM_DATA);
-        }
-      }
+        if (Options & B_RSC_STRICT)
+            switch (opset[Memory[address]].mnemonic)
+            {
+            case S_RTI:
+            case S_RTS:
+            case S_BRK:
+            case S_STP:
+                continue;
 
-      if (GetMemType (address) != MEM_DATA) {
-        PutLabel (address);
-        PutReference (address);
-        PutLowByte (address);
-        PutHighByte (address);
-      }
+            case S_BRA:
+                break;
 
-      fPotentials = FALSE;
-      entry = NULL;
+            default:
+                if (opset[Memory[address]].admode == rel && GetMemType(address + sizes[rel]) != MEM_INSTRUCTION)
+                    AddEntry(address + sizes[rel], address, RTN_SUSPECTED | RTN_B_TEMPORARY);
+            }
+
+        if (fVerbose)
+            fprintf(stderr, "\n%s: scanning at $%04x", prog, address);
 
-      while ((entry = FindNextEntryType (entry, ~0, RTN_SUSP_POT))) {
-        fPotentials = TRUE;
-        entry->type = RTN_POTENTIAL;
-      }
+        if (!ScanPotential(address))
+        {
+            while ((entry = FindNextEntryType(NULL, ~RTN_B_TEMPORARY, RTN_SUSPECTED)))
+            {
+                entry->type |= RTN_B_PROCESSED;
 
-      entry = NULL;
-
-      while ((entry = FindNextEntryType (entry, ~0, RTN_B_TEMPORARY |
-                                         RTN_SUSPECTED | RTN_B_PROCESSED)))
-        DeleteEntry (entry);
+                if (ScanPotential(entry->address) && (Options & M_DATA_BLOCKS) != O_DBL_IGNORE)
+                {
+                    DeleteSuspectedParents(entry->address);
+                    SetMemType(address, MEM_DATA);
+                }
+            }
 
-      entry = NULL;
+            if (GetMemType(address) != MEM_DATA)
+            {
+                PutLabel(address);
+                PutReference(address);
+                PutLowByte(address);
+                PutHighByte(address);
+            }
+
+            fPotentials = FALSE;
+            entry = NULL;
 
-      while ((entry = FindNextEntryType (entry, ~0,
-                                         RTN_SUSPECTED | RTN_B_PROCESSED))) {
-        PutLabel (entry->address);
-        PutReference (entry->address);
-        PutLowByte (entry->address);
-        PutHighByte (entry->address);
-        DeleteEntry (entry);
-      }
+            while ((entry = FindNextEntryType(entry, ~0, RTN_SUSP_POT)))
+            {
+                fPotentials = TRUE;
+                entry->type = RTN_POTENTIAL;
+            }
 
-      entry = NULL;
+            entry = NULL;
+
+            while ((entry = FindNextEntryType(entry, ~0, RTN_B_TEMPORARY | RTN_SUSPECTED | RTN_B_PROCESSED)))
+                DeleteEntry(entry);
+
+            entry = NULL;
 
-      while ((entry = FindNextEntryType (entry, MASK_ANY | WRN_B_TEMPORARY,
-                                         WRN_ANY | WRN_B_TEMPORARY))) {
-        switch (entry->type & ~WRN_B_TEMPORARY) {
-        case WRN_PARAM_WRITTEN_TO:
-          if (GetMemType (entry->address) == MEM_DATA)
-            SetMemType (entry->address, MEM_PARAMETER);
-          entry->type &= ~WRN_B_TEMPORARY;
-          break;
+            while ((entry = FindNextEntryType(entry, ~0, RTN_SUSPECTED | RTN_B_PROCESSED)))
+            {
+                PutLabel(entry->address);
+                PutReference(entry->address);
+                PutLowByte(entry->address);
+                PutHighByte(entry->address);
+                DeleteEntry(entry);
+            }
+
+            entry = NULL;
 
-        case WRN_INSTR_WRITTEN_TO:
-          if (GetMemType (entry->address) == MEM_DATA)
-            SetMemType (entry->address, MEM_INSTRUCTION);
-          entry->type &= ~WRN_B_TEMPORARY;
-          break;
+            while ((entry = FindNextEntryType(entry, MASK_ANY | WRN_B_TEMPORARY, WRN_ANY | WRN_B_TEMPORARY)))
+            {
+                switch (entry->type & ~WRN_B_TEMPORARY)
+                {
+                case WRN_PARAM_WRITTEN_TO:
+                    if (GetMemType(entry->address) == MEM_DATA)
+                        SetMemType(entry->address, MEM_PARAMETER);
+                    entry->type &= ~WRN_B_TEMPORARY;
+                    break;
+
+                case WRN_INSTR_WRITTEN_TO:
+                    if (GetMemType(entry->address) == MEM_DATA)
+                        SetMemType(entry->address, MEM_INSTRUCTION);
+                    entry->type &= ~WRN_B_TEMPORARY;
+                    break;
 
-        case WRN_I_ACCESSED:
-          SetMemType (entry->address, MEM_DATA);
-          /* fall through */
-        case WRN_I_LABEL_NEEDED:
-          PutLabel (entry->address);
-          PutReference (entry->address);
-          PutLowByte (entry->address);
-          PutHighByte (entry->address);
-          DeleteEntry (entry);
-          break;
+                case WRN_I_ACCESSED:
+                    SetMemType(entry->address, MEM_DATA);
+                    /* fall through */
+                case WRN_I_LABEL_NEEDED:
+                    PutLabel(entry->address);
+                    PutReference(entry->address);
+                    PutLowByte(entry->address);
+                    PutHighByte(entry->address);
+                    DeleteEntry(entry);
+                    break;
 
-        default:
-          entry->type &= ~WRN_B_TEMPORARY;
-        }
-      }
+                default:
+                    entry->type &= ~WRN_B_TEMPORARY;
+                }
+            }
 
-      if (fPotentials) ScanPotentials ();
+            if (fPotentials)
+                ScanPotentials();
+        }
+        else
+        {
+            DeleteSuspectedParents(address);
+            SetMemType(address, MEM_DATA);
+        }
     }
-    else {
-      DeleteSuspectedParents (address);
-      SetMemType (address, MEM_DATA);
-    }
-  }
 
-  if (fVerbose)
-    fprintf (stderr, "\n");
+    if (fVerbose)
+        fprintf(stderr, "\n");
 
-  for (address = StartAddress; address != EndAddress; address++)
-    if (GetMemType (address) == MEM_UNPROCESSED) {
-      fPotentials = GetMemFlag (address) ? MEM_PARAMETER : MEM_DATA;
-      SetMemType (address, fPotentials);
-    }
+    for (address = StartAddress; address != EndAddress; address++)
+        if (GetMemType(address) == MEM_UNPROCESSED)
+        {
+            fPotentials = GetMemFlag(address) ? MEM_PARAMETER : MEM_DATA;
+            SetMemType(address, fPotentials);
+        }
 }
--- a/structures.h	Thu Oct 14 01:40:24 2021 +0300
+++ b/structures.h	Thu Oct 14 01:53:20 2021 +0300
@@ -68,12 +68,10 @@
 
 /* The table consists of bit pairs with the following values: */
 
-#define MEM_UNPROCESSED 0 /* the memory place has not been processed yet */
-#define MEM_INSTRUCTION 1 /* a machine language instruction starts at
-                             this memory place */
-#define MEM_DATA        2 /* the memory place contains data */
-#define MEM_PARAMETER   3 /* a parameter of a machine language
-                             instruction is at this place */
+#define MEM_UNPROCESSED  0 /* the memory place has not been processed yet */
+#define MEM_INSTRUCTION  1 /* a machine language instruction starts at this memory place */
+#define MEM_DATA         2 /* the memory place contains data */
+#define MEM_PARAMETER    3 /* a parameter of a machine language instruction is at this place */
 
 /*************************\
 * Memory place flag table *
@@ -115,24 +113,24 @@
 
 static inline void DOPutLabel(unsigned int address, const char *name, const int line)
 {
-  (void) name;
-  (void) line;
+    (void)name;
+    (void)line;
 
-  MemLabel[((ADDR_T)address) / (8 * sizeof *MemLabel)] |= (1 << (address % (8 * sizeof *MemLabel)));
+    MemLabel[((ADDR_T)address) / (8 * sizeof *MemLabel)] |= (1 << (address % (8 * sizeof *MemLabel)));
 }
 
 static inline unsigned char IsReferenced(unsigned int address)
 {
-  return MemReferenced[address];
+    return MemReferenced[address];
 }
 
 
 static inline void DOPutReference(unsigned int address, const char *name, const int line)
 {
-  (void) name;
-  (void) line;
+    (void)name;
+    (void)line;
 
-  MemReferenced[address]++;
+    MemReferenced[address]++;
 }
 
 #define PutReference(address) DOPutReference(address, __func__, __LINE__)
@@ -166,9 +164,9 @@
 
 typedef struct table
 {
-  ADDR_T address;
-  ADDR_T parent;
-  unsigned char type;
+    ADDR_T address;
+    ADDR_T parent;
+    unsigned char type;
 } table;
 
 /* The table.type byte has the following format: */
@@ -226,9 +224,9 @@
 
 typedef struct label
 {
-  int is_range;
-  ADDR_T address, len;
-  char *name;
+    int is_range;
+    ADDR_T address, len;
+    char *name;
 } label;
 
 /********************\
@@ -237,7 +235,7 @@
 
 typedef struct words
 {
-  ADDR_T start, end;
+    ADDR_T start, end;
 } words;
 
 #ifndef _MAIN_C_
--- a/table.c	Thu Oct 14 01:40:24 2021 +0300
+++ b/table.c	Thu Oct 14 01:53:20 2021 +0300
@@ -32,96 +32,88 @@
 /* table.c */
 #define _TABLE_C_
 
+#include "proto.h"
 #include <stdlib.h>
-#include "proto.h"
 
 static unsigned int firstunused = 0;
 
-
-table *FindNextEntryType (table *entry, unsigned char andmask,
-                          unsigned char eormask)
+table *FindNextEntryType(table *entry, unsigned char andmask, unsigned char eormask)
 {
-  if (!scantable) return NULL;
+    if (!scantable)
+        return NULL;
 
-  if (!entry || entry >= &scantable[entrycount])
-    entry = scantable;
-  else if (++entry >= &scantable[entrycount])
-    return NULL;
+    if (!entry || entry >= &scantable[entrycount])
+        entry = scantable;
+    else if (++entry >= &scantable[entrycount])
+        return NULL;
 
-  for (; entry < &scantable[entrycount]; entry++)
-    if (entry->type && !((entry->type & andmask) ^ eormask))
-      return entry;
+    for (; entry < &scantable[entrycount]; entry++)
+        if (entry->type && !((entry->type & andmask) ^ eormask))
+            return entry;
 
-  return NULL;
+    return NULL;
 }
 
-
-table *FindNextEntryTypeParent (table *entry, ADDR_T parent,
-                            unsigned char andmask, unsigned char eormask)
+table *FindNextEntryTypeParent(table *entry, ADDR_T parent, unsigned char andmask, unsigned char eormask)
 {
-  if (!scantable) return NULL;
-
+    if (!scantable)
+        return NULL;
 
-  if (!entry || entry >= &scantable[entrycount])
-    entry = scantable;
-  else if (++entry >= &scantable[entrycount])
-    return NULL;
+    if (!entry || entry >= &scantable[entrycount])
+        entry = scantable;
+    else if (++entry >= &scantable[entrycount])
+        return NULL;
 
-  for (; entry < &scantable[entrycount]; entry++)
-    if (entry->parent == parent && entry->type &&
-        !((entry->type & andmask) ^ eormask))
-      return entry;
+    for (; entry < &scantable[entrycount]; entry++)
+        if (entry->parent == parent && entry->type && !((entry->type & andmask) ^ eormask))
+            return entry;
 
-  return NULL;
+    return NULL;
 }
 
-
-table *FindNextEntry (table *entry, ADDR_T address,
-                      unsigned char andmask, unsigned char eormask)
+table *FindNextEntry(table *entry, ADDR_T address, unsigned char andmask, unsigned char eormask)
 {
-  if (!scantable) return NULL;
+    if (!scantable)
+        return NULL;
 
-  if (!entry || entry >= &scantable[entrycount])
-    entry = scantable;
-  else if (++entry >= &scantable[entrycount])
-    return NULL;
+    if (!entry || entry >= &scantable[entrycount])
+        entry = scantable;
+    else if (++entry >= &scantable[entrycount])
+        return NULL;
 
-  for (; entry < &scantable[entrycount]; entry++)
-    if (entry->address == address && entry->type &&
-        !((entry->type & andmask) ^ eormask))
-      return entry;
+    for (; entry < &scantable[entrycount]; entry++)
+        if (entry->address == address && entry->type && !((entry->type & andmask) ^ eormask))
+            return entry;
 
-  return NULL;
+    return NULL;
 }
 
-
-void AddEntry (ADDR_T address, ADDR_T parent, unsigned char type)
+void AddEntry(ADDR_T address, ADDR_T parent, unsigned char type)
 {
-  if (firstunused < entrycount) {
-    scantable[firstunused].address = address;
-    scantable[firstunused].parent = parent;
-    scantable[firstunused].type = type;
+    if (firstunused < entrycount)
+    {
+        scantable[firstunused].address = address;
+        scantable[firstunused].parent = parent;
+        scantable[firstunused].type = type;
 
-    while (++firstunused < entrycount && scantable[firstunused].type);
-  }
-  else {
-    scantable = scantable ?
-      realloc (scantable, (entrycount + 1) * sizeof *scantable) :
-      malloc (sizeof *scantable);
+        while (++firstunused < entrycount && scantable[firstunused].type);
+    }
+    else
+    {
+        scantable = scantable ? realloc(scantable, (entrycount + 1) * sizeof *scantable) : malloc(sizeof *scantable);
 
-    scantable[entrycount].address = address;
-    scantable[entrycount].parent = parent;
-    scantable[entrycount].type = type;
+        scantable[entrycount].address = address;
+        scantable[entrycount].parent = parent;
+        scantable[entrycount].type = type;
 
-    firstunused = ++entrycount;
-  }
+        firstunused = ++entrycount;
+    }
 }
 
-
-void DeleteEntry (table *entry)
+void DeleteEntry(table *entry)
 {
-  entry -> type = TBL_DELETED;
+    entry->type = TBL_DELETED;
 
-  if (firstunused > entry - scantable)
-    firstunused = entry - scantable;
+    if (firstunused > entry - scantable)
+        firstunused = entry - scantable;
 }
--- a/vector.c	Thu Oct 14 01:40:24 2021 +0300
+++ b/vector.c	Thu Oct 14 01:53:20 2021 +0300
@@ -34,76 +34,76 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "options.h"
 #include "proto.h"
-#include "options.h"
 
 unsigned WordCount = 0;
 words *WordTable = NULL;
 
+void AddWordEntry(ADDR_T start, ADDR_T end)
+{
+    words *entry;
 
-void AddWordEntry (ADDR_T start, ADDR_T end)
-{
-  words *entry;
+    entry = WordCount ? realloc(WordTable, (WordCount + 1) * sizeof *entry) : malloc(sizeof *entry);
 
-  entry = WordCount ?
-    realloc (WordTable, (WordCount + 1) * sizeof *entry) :
-    malloc (sizeof *entry);
+    if (!entry)
+        return;
 
-  if (!entry) return;
-
-  WordTable = entry;
-  entry += WordCount++;
-  entry->start = start;
-  entry->end = end;
+    WordTable = entry;
+    entry += WordCount++;
+    entry->start = start;
+    entry->end = end;
 }
 
-
-ADDR_T WordTableEnd (ADDR_T start)
+ADDR_T WordTableEnd(ADDR_T start)
 {
-  words *entry;
+    words *entry;
+
+    if (!((entry = &WordTable[WordCount])))
+        return start;
 
-  if (!((entry = &WordTable[WordCount])))
+    while (entry-- > WordTable)
+        if (entry->start == start)
+            return entry->end;
+
     return start;
-
-  while (entry-- > WordTable)
-    if (entry->start == start)
-      return entry->end;
-
-  return start;
 }
 
-
-void SearchVectors (void)
+void SearchVectors(void)
 {
-  ADDR_T start, end, address;
+    ADDR_T start, end, address;
 
-  if ((Options & M_ADR_TABLES) == O_TBL_IGNORE) return;
+    if ((Options & M_ADR_TABLES) == O_TBL_IGNORE)
+        return;
 
-  if (fVerbose)
-    fprintf (stderr, "%s: Searching for address tables.\n", prog);
+    if (fVerbose)
+        fprintf(stderr, "%s: Searching for address tables.\n", prog);
 
-  for (start = StartAddress; start != EndAddress; start++) {
-    if (GetMemType (start) != MEM_DATA || !IsLowByte (Memory[start]))
-      continue;
-
-    for (end = start; (end | 1) != (1 | EndAddress); end += 2) {
-      if (GetMemType (end) != MEM_DATA || GetMemType (end + 1) != MEM_DATA)
-        break;
+    for (start = StartAddress; start != EndAddress; start++)
+    {
+        if (GetMemType(start) != MEM_DATA || !IsLowByte(Memory[start]))
+            continue;
 
-      address = Memory[end] | (Memory[(ADDR_T)(end + 1)] << 8);
+        for (end = start; (end | 1) != (1 | EndAddress); end += 2)
+        {
+            if (GetMemType(end) != MEM_DATA || GetMemType(end + 1) != MEM_DATA)
+                break;
 
-      if (!IsLabeled (address))
-        break;
+            address = Memory[end] | (Memory[(ADDR_T)(end + 1)] << 8);
+
+            if (!IsLabeled(address))
+                break;
 
-      if ((Options & M_ADR_TABLES) == O_TBL_NOEXT &&
-          (ADDR_T)(address - StartAddress) >=
-          (ADDR_T)(EndAddress - StartAddress))
-        break;
-    }
+            if ((Options & M_ADR_TABLES) == O_TBL_NOEXT &&
+                (ADDR_T)(address - StartAddress) >= (ADDR_T)(EndAddress - StartAddress))
+                break;
+        }
 
-    if ((ADDR_T)(end - start) > 2) {
-      AddWordEntry (start, end);
-      if (EndAddress == (start = end)) break;
+        if ((ADDR_T)(end - start) > 2)
+        {
+            AddWordEntry(start, end);
+            if (EndAddress == (start = end))
+                break;
+        }
     }
-  }
 }