dasm09 built for fuzix. 16k buffer.
authorBrett Gordon <beretta42@gmail.com>
Sat, 6 May 2017 00:40:21 +0000 (20:40 -0400)
committerBrett Gordon <beretta42@gmail.com>
Sat, 6 May 2017 00:40:21 +0000 (20:40 -0400)
Applications/dasm09/COPYING [new file with mode: 0644]
Applications/dasm09/Makefile.6809 [new file with mode: 0644]
Applications/dasm09/README [new file with mode: 0644]
Applications/dasm09/dasm09.c [new file with mode: 0755]
Applications/dasm09/dasm09.h [new file with mode: 0755]

diff --git a/Applications/dasm09/COPYING b/Applications/dasm09/COPYING
new file mode 100644 (file)
index 0000000..a43ea21
--- /dev/null
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+       Appendix: How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/Applications/dasm09/Makefile.6809 b/Applications/dasm09/Makefile.6809
new file mode 100644 (file)
index 0000000..d7dff44
--- /dev/null
@@ -0,0 +1,38 @@
+PLATFORM = 6809
+CC = m6809-unknown-gcc
+# These are wrappers for lwasm and lwar
+ASM = m6809-unknown-as
+AR = m6809-unknown-ar
+LINKER = lwlink
+CFLAGS = -I../../Library/include -I../../Library/include/6809
+CFLAGS += -O0 -msoft-reg-count=0 -mfar-stack-param -fomit-frame-pointer
+LINKER_OPT = --format=raw -L../../Library/libs -lc6809
+LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name))
+LINKER_OPT += -L$(LIBGCCDIR) -lgcc
+LINKER_OPT += --script=../util/$(TARGET).link
+ASM_OPT = -o
+CRT0 = ../../Library/libs/crt0_6809.o
+
+.SUFFIXES: .c .o
+
+SRCS  = dasm09.c
+
+OBJS = $(SRCS:.c=.o)
+
+APPS = dasm09
+
+all: $(APPS)
+
+
+dasm09: $(OBJS)
+       $(LINKER) $(LINKER_OPT) -o dasm09 $(CRT0) dasm09.o
+
+
+size.report: $(APPS)
+       ls -l $^ > $@
+
+clean:
+       rm -f $(OBJS) $(APPS) $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin size.report *~
+
+rmbak:
+       rm -f *~ core
diff --git a/Applications/dasm09/README b/Applications/dasm09/README
new file mode 100644 (file)
index 0000000..fdb069a
--- /dev/null
@@ -0,0 +1,42 @@
+
+dasm09: M6809/H6309/OS9 disassembler V0.1 © 2000 Arto Salmi
+Usage: dasm09 [options] <filename>
+Available options are:
+ -begin  - start disassembly address [offset]
+ -end    - end disassembly address  [auto]
+ -offset - address to load program [0]
+ -out    - output file [stdout]
+ -noaddr - no address dump
+ -nohex  - no hex dump
+ -x      - use 6309 opcodes
+ -os9    - patch swi2 (os9 call)
+All values should be entered in hexadecimal
+
+NOTE! os9 call table is not tested.
+
+see file COPYING for copying ;)
+
+Files
+dasm09/
+       COPYING   - Gnu Public Licence
+       README    - this file
+         dasm09.c  - dummy main
+       dasm09.h  - disassembler
+       test/
+         test.bin  - 6809 test file (binary)
+       test.asm  - 6809 test file (source)
+       test.out  - 6809 test file (output)
+       test2.bin - 6309 test file (binary)
+       test2.asm - 6309 test file (source)
+       test2.out - 6309 test file (output)
+
+test.asm is assembled using a09 by L.C. Benschop
+(AS09 has a bug in direct jump at least in amiga version)
+test2.asm is assembled using AS09 (V1.04 amiga) by Frank A. Vorstenbosch.
+
+dasm09 is tested on vbcc (V0.7 amiga), dice (V0.16 amiga)
+Borland C++ (V5.02 Win95) and lcc-win32 (V?.? 15.5.1998 Win95)
+(gcc V2.7 should work too)
+
+Latest version www.mbnet.fi/~atjs/mc6809/index.html
+email: asalmi@ratol.fi
diff --git a/Applications/dasm09/dasm09.c b/Applications/dasm09/dasm09.c
new file mode 100755 (executable)
index 0000000..4f1dc09
--- /dev/null
@@ -0,0 +1,182 @@
+/***************************************************************************
+ * dasm09 -- Portable M6809/H6309/OS9 Disassembler                         *
+ * Copyright (C) 2000  Arto Salmi                                          *
+ *                                                                         *
+ * This program is free software; you can redistribute it and/or modify    *
+ * it under the terms of the GNU General Public License as published by    *
+ * the Free Software Foundation; either version 2 of the License, or       *
+ * (at your option) any later version.                                     *
+ *                                                                         *
+ * This program is distributed in the hope that it will be useful,         *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
+ * GNU General Public License for more details.                            *
+ *                                                                         *
+ * You should have received a copy of the GNU General Public License       *
+ * along with this program; if not, write to the Free Software             *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               *
+ ***************************************************************************/
+
+/* NOTE! os9 call table is not tested. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef TYPES
+#define TYPES
+typedef unsigned char  byte;
+typedef unsigned short word;
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+byte *memory = NULL;
+
+#define OPCODE(address)  memory[address&0xffff]
+#define ARGBYTE(address) memory[address&0xffff]
+#define ARGWORD(address) (word)((memory[address&0xffff]<<8)|memory[(address+1)&0xffff])
+
+#include "dasm09.h"
+
+static char *Options[]=
+{
+ "begin","end","offset","out","noaddr","nohex","x","os9", NULL
+};
+
+void usage(void)
+{
+   printf("Usage: dasm09 [options] <filename>\n"
+          "Available options are:\n"
+          " -begin  - start disassembly address [offset]\n"
+          " -end    - end disassembly address  [auto]\n"
+          " -offset - address to load program [0]\n"
+          " -out    - output file [stdout]\n"
+          " -noaddr - no address dump\n"
+          " -nohex  - no hex dump\n"
+          " -x      - use 6309 opcodes\n"
+          " -os9    - patch swi2 (os9 call)\n"
+          "All values should be entered in hexadecimal\n");
+
+   exit(1);
+}
+
+
+int main(int argc, char *argv[])
+{
+   unsigned begin=0,end=0,offset=0,pc,add;
+   char *fname=NULL,*outname=NULL;
+   int showhex=TRUE,showaddr=TRUE;
+   int i,j,n;
+   char buf[30];
+   int off;
+   FILE *f;
+   FILE *out=stdout;
+
+   printf("dasm09: M6809/H6309/OS9 disassembler V0.1 © 2000 Arto Salmi\n");
+
+   for (i=1,n=0;i<argc;++i)
+   {
+      if (argv[i][0]!='-')
+      {
+         switch (++n)
+         {
+            case 1:  fname=argv[i];
+                     break;
+           default:  usage();
+         }
+      }
+      else
+      {
+         for (j=0;Options[j];++j)
+         if (!strcmp(argv[i]+1,Options[j])) break;
+         switch (j)
+         {
+         case 0:  ++i; if (i>argc) usage();
+                  begin=strtoul(argv[i],NULL,16);
+                  break;
+         case 1:  ++i; if (i>argc) usage();
+                  end=strtoul(argv[i],NULL,16);
+                  break;
+         case 2:  ++i; if (i>argc) usage();
+                  offset=strtoul(argv[i],NULL,16);
+                  break;
+         case 3:  ++i; if (i>argc) usage();
+                  outname=argv[i];
+                  break;
+         case 4:  showaddr=FALSE;break;
+         case 5:  showhex=FALSE;break;
+
+         case 6:  codes             = h6309_codes;
+                  codes10           = h6309_codes10;
+                  codes11           = h6309_codes11;
+                  exg_tfr           = h6309_exg_tfr;
+                  allow_6309_codes  = TRUE;
+                  break;
+
+           case 7: os9_patch = TRUE; break;
+
+         default: usage();
+         }
+      }
+   }
+
+   f=fopen(fname,"rb");
+   if(!f) usage();
+   if(!end)
+   {
+      fseek(f,0,SEEK_END);
+      off=ftell(f);
+      end=(offset+off)-1;
+      rewind(f);
+   }
+
+   if(!begin) if(offset) begin=offset;
+
+   if(outname)
+   {
+      out=fopen(outname,"w");
+      if(!out) printf("can't open %s \n",outname);
+   }
+
+   memory=(byte *)malloc(0x4000);
+   if(!memory) {printf("no mem buffer\n");goto exit;}
+   memset(memory,0x01,0x4000);
+   fread(&memory[offset&0xFFFF],sizeof(byte),0x4000-(offset&0xFFFF),f);
+
+   begin&=0xFFFF;
+   end&=0xFFFF;
+   pc=begin;
+
+   fprintf(out,"; org $%04X \n",pc);
+
+   do
+   {
+     if(showaddr) fprintf(out,"%04X: ",pc);
+     add=Dasm(buf,pc);
+
+     if(showhex)
+     {
+       for(i=0;i<5;i++)
+       {
+         if(add) {add--;fprintf(out,"%02X ",memory[(pc++)&0xFFFF]);}
+         else fprintf(out,"   ");
+       }
+     } else pc+=add;
+
+     if((!showaddr)&&(!showhex)) fprintf(out,"\t");
+
+     fprintf(out,"%s \n",buf);
+   } while( pc <= end);
+
+   printf("Done\n");
+
+   exit:
+   if(f)       fclose(f);
+   if(outname) if(out)    fclose(out);
+   if(memory)  free(memory);
+
+   return(0);
+}
diff --git a/Applications/dasm09/dasm09.h b/Applications/dasm09/dasm09.h
new file mode 100755 (executable)
index 0000000..dcdb565
--- /dev/null
@@ -0,0 +1,966 @@
+/***************************************************************************
+ * dasm09 -- Portable M6809/H6309/OS9 Disassembler                         *
+ * Copyright (C) 2000  Arto Salmi                                          *
+ *                                                                         *
+ * This program is free software; you can redistribute it and/or modify    *
+ * it under the terms of the GNU General Public License as published by    *
+ * the Free Software Foundation; either version 2 of the License, or       *
+ * (at your option) any later version.                                     *
+ *                                                                         *
+ * This program is distributed in the hope that it will be useful,         *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
+ * GNU General Public License for more details.                            *
+ *                                                                         *
+ * You should have received a copy of the GNU General Public License       *
+ * along with this program; if not, write to the Free Software             *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               *
+ ***************************************************************************/
+
+/***************************************************************************
+                                     NOTES
+                                     -----
+
+ You need following functions/macros:
+ OPCODE(address)    -    Fetch opcode
+ ARGBYTE(address)   -    Fetch opcode argument 8 bit
+ ARGWORD(address)   -    Fetch opcode argument 16 bit
+
+ If you use Dasm() directly (faster), make sure that
+ you use correct pointers.
+
+ OS9 support: set variable os9_patch = TRUE
+              os9 call table is not tested.
+
+ ***************************************************************************/
+
+#ifndef TYPES
+#define TYPES
+typedef unsigned char  byte;
+typedef unsigned short word;
+#endif
+
+#ifndef FALSE
+#define FALSE 0L
+#define TRUE  1L
+#endif
+
+unsigned Dasm6809(char *buffer, unsigned pc);
+unsigned Dasm6309(char *buffer, unsigned pc);
+
+enum addr_mode {
+_nom,     /* no mode                    */
+_imp,     /* inherent/implied           */
+_imb,     /* immediate byte             */
+_imw,     /* immediate word             */
+_dir,     /* direct                     */
+_ext,     /* extended                   */
+_ind,     /* indexed                    */
+_reb,     /* relative byte              */
+_rew,     /* relative word              */
+_r1 ,     /* tfr/exg mode               */
+_r2 ,     /* pul/psh system             */
+_r3 ,     /* pul/psh user               */
+_bd ,     /* Bit Manipulation direct    */
+_bi ,     /* Bit Manipulation index     */
+_be ,     /* Bit Manipulation extended  */
+_bt ,     /* Bit Transfers direct       */
+_t1 ,     /* Block Transfer r0+,r1+     */
+_t2 ,     /* Block Transfer r0-,r1-     */
+_t3 ,     /* Block Transfer r0+,r1      */
+_t4 ,     /* Block Transfer r0,r1+      */
+_iml      /* immediate 32-bit           */
+};
+
+enum opcodes {
+_ill=0,_abx,  _adca, _adcb, _adda, _addb, _addd, _anda, _andb,
+_andcc,_asla, _aslb, _asl,  _asra, _asrb, _asr,  _bcc,  _lbcc,
+_bcs,  _lbcs, _beq,  _lbeq, _bge,  _lbge, _bgt,  _lbgt, _bhi,
+_lbhi, _bita, _bitb, _ble,  _lble, _bls,  _lbls, _blt,  _lblt,
+_bmi,  _lbmi, _bne,  _lbne, _bpl,  _lbpl, _bra,  _lbra, _brn,
+_lbrn, _bsr,  _lbsr, _bvc,  _lbvc, _bvs,  _lbvs, _clra, _clrb,
+_clr,  _cmpa, _cmpb, _cmpd, _cmps, _cmpu, _cmpx, _cmpy, _coma,
+_comb, _com,  _cwai, _daa,  _deca, _decb, _dec,  _eora, _eorb,
+_exg,  _inca, _incb, _inc,  _jmp,  _jsr,  _lda,  _ldb,  _ldd,
+_lds,  _ldu,  _ldx,  _ldy,  _leas, _leau, _leax, _leay, _lsra,
+_lsrb, _lsr,  _mul,  _nega, _negb, _neg,  _nop,  _ora,  _orb,
+_orcc, _pshs, _pshu, _puls, _pulu, _rola, _rolb, _rol,  _rora,
+_rorb, _ror,  _rti,  _rts,  _sbca, _sbcb, _sex,  _sta,  _stb,
+_std,  _sts,  _stu,  _stx,  _sty,  _suba, _subb, _subd, _swi,
+_swi2, _swi3, _sync, _tfr,  _tsta, _tstb, _tst,  _reset,
+/* 6309 extra opcodes */
+_aim,  _eim,  _oim,  _tim,  _band, _biand,_bor,  _bior, _beor,
+_bieor,_ldbt, _stbt, _tfm,  _adcd, _adcr, _adde, _addf, _addw,
+_addr, _andd, _andr, _asld, _asrd, _bitd, _bitmd,_clrd, _clre,
+_clrf, _clrw, _cmpe, _cmpf, _cmpw, _cmpr, _comd, _come, _comf,
+_comw, _decd, _dece, _decf, _decw, _divd, _divq, _eord, _eorr,
+_incd, _ince, _incf, _incw, _lde,  _ldf,  _ldq,  _ldw,  _ldmd,
+_lsrd, _lsrw, _muld, _negd, _ord,  _orr,  _pshsw,_pshuw,_pulsw,
+_puluw,_rold, _rolw, _rord, _rorw, _sbcd, _sbcr, _sexw, _ste,
+_stf,  _stq,  _stw,  _sube, _subf, _subw, _subr, _tstd, _tste,
+_tstf, _tstw
+};
+
+char *mne[] = {
+"???",  "ABX",  "ADCA", "ADCB", "ADDA", "ADDB", "ADDD", "ANDA", "ANDB",
+"ANDCC","ASLA", "ASLB", "ASL",  "ASRA", "ASRB", "ASR",  "BCC",  "LBCC",
+"BCS",  "LBCS", "BEQ",  "LBEQ", "BGE",  "LBGE", "BGT",  "LBGT", "BHI",
+"LBHI", "BITA", "BITB", "BLE",  "LBLE", "BLS",  "LBLS", "BLT",  "LBLT",
+"BMI",  "LBMI", "BNE",  "LBNE", "BPL",  "LBPL", "BRA",  "LBRA", "BRN",
+"LBRN", "BSR",  "LBSR", "BVC",  "LBVC", "BVS",  "LBVS", "CLRA", "CLRB",
+"CLR",  "CMPA", "CMPB", "CMPD", "CMPS", "CMPU", "CMPX", "CMPY", "COMA",
+"COMB", "COM",  "CWAI", "DAA",  "DECA", "DECB", "DEC",  "EORA", "EORB",
+"EXG",  "INCA", "INCB", "INC",  "JMP",  "JSR",  "LDA",  "LDB",  "LDD",
+"LDS",  "LDU",  "LDX",  "LDY",  "LEAS", "LEAU", "LEAX", "LEAY", "LSRA",
+"LSRB", "LSR",  "MUL",  "NEGA", "NEGB", "NEG",  "NOP",  "ORA",  "ORB",
+"ORCC", "PSHS", "PSHU", "PULS", "PULU", "ROLA", "ROLB", "ROL",  "RORA",
+"RORB", "ROR",  "RTI",  "RTS",  "SBCA", "SBCB", "SEX",  "STA",  "STB",
+"STD",  "STS",  "STU",  "STX",  "STY",  "SUBA", "SUBB", "SUBD", "SWI",
+"SWI2", "SWI3", "SYNC", "TFR",  "TSTA", "TSTB", "TST",  "RESET",
+/* 6309 EXTRA OPCODES */
+"AIM",  "EIM",  "OIM",  "TIM",  "BAND", "BIAND","BOR",  "BIOR", "BEOR",
+"BIEOR","LDBT", "STBT", "TFM",  "ADCD", "ADCR", "ADDE", "ADDF", "ADDW",
+"ADDR", "ANDD", "ANDR", "ASLD", "ASRD", "BITD", "BITMD","CLRD", "CLRE",
+"CLRF", "CLRW", "CMPE", "CMPF", "CMPW", "CMPR", "COMD", "COME", "COMF",
+"COMW", "DECD", "DECE", "DECF", "DECW", "DIVD", "DIVQ", "EORD", "EORR",
+"INCD", "INCE", "INCF", "INCW", "LDE",  "LDF",  "LDQ",  "LDW",  "LDMD",
+"LSRD", "LSRW", "MULD", "NEGD", "ORD",  "ORR",  "PSHSW","PSHUW","PULSW",
+"PULUW","ROLD", "ROLW", "RORD", "RORW", "SBCD", "SBCR", "SEXW", "STE",
+"STF",  "STQ",  "STW",  "SUBE", "SUBF", "SUBW", "SUBR", "TSTD", "TSTE",
+"TSTF", "TSTW"
+};
+
+char *os9_codes[0x100] = {
+"F$Link",      "F$Load",      "F$UnLink",    "F$Fork",
+"F$Wait",      "F$Chain",     "F$Exit",      "F$Mem",
+"F$Send",      "F$Icpt",      "F$Sleep",     "F$SSpd",
+"F$ID",        "F$SPrior",    "F$SSWI",      "F$Perr",
+"F$PrsNam",    "F$CmpNam",    "F$SchBit",    "F$AllBit",
+"F$DelBit",    "F$Time",      "F$STime",     "F$CRC",
+"F$GPrDsc",    "F$GBlkMp",    "F$GModDr",    "F$CpyMem",
+"F$SUser",     "F$UnLoad",    "F$Alarm",     "F$",
+"F$",          "F$NMLink",    "F$NMLoad",    "F$Ctime",
+"F$Cstime",    "F$CTswi2",    "F$",          "F$VIRQ",
+"F$SRqMem",    "F$SRtMem",    "F$IRQ",       "F$IOQu",
+"F$AProc",     "F$NProc",     "F$VModul",    "F$Find64",
+"F$All64",     "F$Ret64",     "F$SSvc",      "F$IODel",
+"F$SLink",     "F$Boot",      "F$BtMem",     "F$GProcP",
+"F$Move",      "F$AllRAM",    "F$AllImg",    "F$DelImg",
+"F$SetImg",    "F$FreeLB",    "F$FreeHB",    "F$AllTsk",
+"F$DelTsk",    "F$SetTsk",    "F$ResTsk",    "F$RelTsk",
+"F$DATLog",    "F$DATTmp",    "F$LDAXY",     "F$LDAXYP",
+"F$LDDDXY",    "F$LDABX",     "F$STABX",     "F$AllPrc",
+"F$DelPrc",    "F$ELink",     "F$FModul",    "F$MapBlk",
+"F$ClrBlk",    "F$DelRAM",    "F$GCMDir",    "F$AlHRam",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"I$Attach",    "I$Detach",    "I$Dup",       "I$Create",
+"I$Open",      "I$MakDir",    "I$Chgdir",    "I$Delete",
+"I$Seek",      "I$Read",      "I$Write",     "I$ReadLn",
+"I$WritLn",    "I$GetStt",    "I$SetStt",    "I$Close",
+"I$DeletX",    "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$",
+"F$",          "F$",          "F$",          "F$"
+};
+
+byte h6309_codes[512] = {
+_neg  ,_dir,   _oim  ,_bd ,   _aim  ,_bd ,   _com  ,_dir,
+_lsr  ,_dir,   _eim  ,_bd ,   _ror  ,_dir,   _asr  ,_dir,
+_asl  ,_dir,   _rol  ,_dir,   _dec  ,_dir,   _tim  ,_bd ,
+_inc  ,_dir,   _tst  ,_dir,   _jmp  ,_dir,   _clr  ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _nop  ,_imp,   _sync ,_imp,
+_sexw ,_imp,   _ill  ,_nom,   _lbra ,_rew,   _lbsr ,_rew,
+_ill  ,_nom,   _daa  ,_imp,   _orcc ,_imb,   _ill  ,_nom,
+_andcc,_imb,   _sex  ,_imp,   _exg  ,_r1 ,   _tfr  ,_r1 ,
+_bra  ,_reb,   _brn  ,_reb,   _bhi  ,_reb,   _bls  ,_reb,
+_bcc  ,_reb,   _bcs  ,_reb,   _bne  ,_reb,   _beq  ,_reb,
+_bvc  ,_reb,   _bvs  ,_reb,   _bpl  ,_reb,   _bmi  ,_reb,
+_bge  ,_reb,   _blt  ,_reb,   _bgt  ,_reb,   _ble  ,_reb,
+_leax ,_ind,   _leay ,_ind,   _leas ,_ind,   _leau ,_ind,
+_pshs ,_r2 ,   _puls ,_r2 ,   _pshu ,_r3 ,   _pulu ,_r3 ,
+_ill  ,_nom,   _rts  ,_imp,   _abx  ,_imp,   _rti  ,_imp,
+_cwai ,_imb,   _mul  ,_imp,   _reset,_imp,   _swi  ,_imp,
+_nega ,_imp,   _ill  ,_nom,   _ill  ,_nom,   _coma ,_imp,
+_lsra ,_imp,   _ill  ,_nom,   _rora ,_imp,   _asra ,_imp,
+_asla ,_imp,   _rola ,_imp,   _deca ,_imp,   _ill  ,_nom,
+_inca ,_imp,   _tsta ,_imp,   _ill  ,_nom,   _clra ,_imp,
+_negb ,_imp,   _ill  ,_nom,   _ill  ,_nom,   _comb ,_imp,
+_lsrb ,_imp,   _ill  ,_nom,   _rorb ,_imp,   _asrb ,_imp,
+_aslb ,_imp,   _rolb ,_imp,   _decb ,_imp,   _ill  ,_nom,
+_incb ,_imp,   _tstb ,_imp,   _ill  ,_nom,   _clrb ,_imp,
+_neg  ,_ind,   _oim  ,_bi ,   _aim  ,_bi ,   _com  ,_ind,
+_lsr  ,_ind,   _eim  ,_bi ,   _ror  ,_ind,   _asr  ,_ind,
+_asl  ,_ind,   _rol  ,_ind,   _dec  ,_ind,   _tim  ,_bi ,
+_inc  ,_ind,   _tst  ,_ind,   _jmp  ,_ind,   _clr  ,_ind,
+_neg  ,_ext,   _oim  ,_be ,   _aim  ,_be ,   _com  ,_ext,
+_lsr  ,_ext,   _eim  ,_be ,   _ror  ,_ext,   _asr  ,_ext,
+_asl  ,_ext,   _rol  ,_ext,   _dec  ,_ext,   _tim  ,_be ,
+_inc  ,_ext,   _tst  ,_ext,   _jmp  ,_ext,   _clr  ,_ext,
+_suba ,_imb,   _cmpa ,_imb,   _sbca ,_imb,   _subd ,_imw,
+_anda ,_imb,   _bita ,_imb,   _lda  ,_imb,   _ill  ,_nom,
+_eora ,_imb,   _adca ,_imb,   _ora  ,_imb,   _adda ,_imb,
+_cmpx ,_imw,   _bsr  ,_reb,   _ldx  ,_imw,   _ill  ,_nom,
+_suba ,_dir,   _cmpa ,_dir,   _sbca ,_dir,   _subd ,_dir,
+_anda ,_dir,   _bita ,_dir,   _lda  ,_dir,   _sta  ,_dir,
+_eora ,_dir,   _adca ,_dir,   _ora  ,_dir,   _adda ,_dir,
+_cmpx ,_dir,   _jsr  ,_dir,   _ldx  ,_dir,   _stx  ,_dir,
+_suba ,_ind,   _cmpa ,_ind,   _sbca ,_ind,   _subd ,_ind,
+_anda ,_ind,   _bita ,_ind,   _lda  ,_ind,   _sta  ,_ind,
+_eora ,_ind,   _adca ,_ind,   _ora  ,_ind,   _adda ,_ind,
+_cmpx ,_ind,   _jsr  ,_ind,   _ldx  ,_ind,   _stx  ,_ind,
+_suba ,_ext,   _cmpa ,_ext,   _sbca ,_ext,   _subd ,_ext,
+_anda ,_ext,   _bita ,_ext,   _lda  ,_ext,   _sta  ,_ext,
+_eora ,_ext,   _adca ,_ext,   _ora  ,_ext,   _adda ,_ext,
+_cmpx ,_ext,   _jsr  ,_ext,   _ldx  ,_ext,   _stx  ,_ext,
+_subb ,_imb,   _cmpb ,_imb,   _sbcb ,_imb,   _addd ,_imw,
+_andb ,_imb,   _bitb ,_imb,   _ldb  ,_imb,   _ill  ,_nom,
+_eorb ,_imb,   _adcb ,_imb,   _orb  ,_imb,   _addb ,_imb,
+_ldd  ,_imw,   _ldq  ,_iml,   _ldu  ,_imw,   _ill  ,_nom,
+_subb ,_dir,   _cmpb ,_dir,   _sbcb ,_dir,   _addd ,_dir,
+_andb ,_dir,   _bitb ,_dir,   _ldb  ,_dir,   _stb  ,_dir,
+_eorb ,_dir,   _adcb ,_dir,   _orb  ,_dir,   _addb ,_dir,
+_ldd  ,_dir,   _std  ,_dir,   _ldu  ,_dir,   _stu  ,_dir,
+_subb ,_ind,   _cmpb ,_ind,   _sbcb ,_ind,   _addd ,_ind,
+_andb ,_ind,   _bitb ,_ind,   _ldb  ,_ind,   _stb  ,_ind,
+_eorb ,_ind,   _adcb ,_ind,   _orb  ,_ind,   _addb ,_ind,
+_ldd  ,_ind,   _std  ,_ind,   _ldu  ,_ind,   _stu  ,_ind,
+_subb ,_ext,   _cmpb ,_ext,   _sbcb ,_ext,   _addd ,_ext,
+_andb ,_ext,   _bitb ,_ext,   _ldb  ,_ext,   _stb  ,_ext,
+_eorb ,_ext,   _adcb ,_ext,   _orb  ,_ext,   _addb ,_ext,
+_ldd  ,_ext,   _std  ,_ext,   _ldu  ,_ext,   _stu  ,_ext,
+};
+
+byte m6809_codes[512] = {
+_neg  ,_dir,   _ill  ,_nom,   _ill  ,_nom,   _com  ,_dir,
+_lsr  ,_dir,   _ill  ,_nom,   _ror  ,_dir,   _asr  ,_dir,
+_asl  ,_dir,   _rol  ,_dir,   _dec  ,_dir,   _ill  ,_nom,
+_inc  ,_dir,   _tst  ,_dir,   _jmp  ,_dir,   _clr  ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _nop  ,_imp,   _sync ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _lbra ,_rew,   _lbsr ,_rew,
+_ill  ,_nom,   _daa  ,_imp,   _orcc ,_imb,   _ill  ,_nom,
+_andcc,_imb,   _sex  ,_imp,   _exg  ,_r1 ,   _tfr  ,_r1 ,
+_bra  ,_reb,   _brn  ,_reb,   _bhi  ,_reb,   _bls  ,_reb,
+_bcc  ,_reb,   _bcs  ,_reb,   _bne  ,_reb,   _beq  ,_reb,
+_bvc  ,_reb,   _bvs  ,_reb,   _bpl  ,_reb,   _bmi  ,_reb,
+_bge  ,_reb,   _blt  ,_reb,   _bgt  ,_reb,   _ble  ,_reb,
+_leax ,_ind,   _leay ,_ind,   _leas ,_ind,   _leau ,_ind,
+_pshs ,_r2 ,   _puls ,_r2 ,   _pshu ,_r3 ,   _pulu ,_r3 ,
+_ill  ,_nom,   _rts  ,_imp,   _abx  ,_imp,   _rti  ,_imp,
+_cwai ,_imb,   _mul  ,_imp,   _reset,_imp,   _swi  ,_imp,
+_nega ,_imp,   _ill  ,_nom,   _ill  ,_nom,   _coma ,_imp,
+_lsra ,_imp,   _ill  ,_nom,   _rora ,_imp,   _asra ,_imp,
+_asla ,_imp,   _rola ,_imp,   _deca ,_imp,   _ill  ,_nom,
+_inca ,_imp,   _tsta ,_imp,   _ill  ,_nom,   _clra ,_imp,
+_negb ,_imp,   _ill  ,_nom,   _ill  ,_nom,   _comb ,_imp,
+_lsrb ,_imp,   _ill  ,_nom,   _rorb ,_imp,   _asrb ,_imp,
+_aslb ,_imp,   _rolb ,_imp,   _decb ,_imp,   _ill  ,_nom,
+_incb ,_imp,   _tstb ,_imp,   _ill  ,_nom,   _clrb ,_imp,
+_neg  ,_ind,   _ill  ,_nom,   _ill  ,_nom,   _com  ,_ind,
+_lsr  ,_ind,   _ill  ,_nom,   _ror  ,_ind,   _asr  ,_ind,
+_asl  ,_ind,   _rol  ,_ind,   _dec  ,_ind,   _ill  ,_nom,
+_inc  ,_ind,   _tst  ,_ind,   _jmp  ,_ind,   _clr  ,_ind,
+_neg  ,_ext,   _ill  ,_nom,   _ill  ,_nom,   _com  ,_ext,
+_lsr  ,_ext,   _ill  ,_nom,   _ror  ,_ext,   _asr  ,_ext,
+_asl  ,_ext,   _rol  ,_ext,   _dec  ,_ext,   _ill  ,_nom,
+_inc  ,_ext,   _tst  ,_ext,   _jmp  ,_ext,   _clr  ,_ext,
+_suba ,_imb,   _cmpa ,_imb,   _sbca ,_imb,   _subd ,_imw,
+_anda ,_imb,   _bita ,_imb,   _lda  ,_imb,   _ill  ,_nom,
+_eora ,_imb,   _adca ,_imb,   _ora  ,_imb,   _adda ,_imb,
+_cmpx ,_imw,   _bsr  ,_reb,   _ldx  ,_imw,   _ill  ,_nom,
+_suba ,_dir,   _cmpa ,_dir,   _sbca ,_dir,   _subd ,_dir,
+_anda ,_dir,   _bita ,_dir,   _lda  ,_dir,   _sta  ,_dir,
+_eora ,_dir,   _adca ,_dir,   _ora  ,_dir,   _adda ,_dir,
+_cmpx ,_dir,   _jsr  ,_dir,   _ldx  ,_dir,   _stx  ,_dir,
+_suba ,_ind,   _cmpa ,_ind,   _sbca ,_ind,   _subd ,_ind,
+_anda ,_ind,   _bita ,_ind,   _lda  ,_ind,   _sta  ,_ind,
+_eora ,_ind,   _adca ,_ind,   _ora  ,_ind,   _adda ,_ind,
+_cmpx ,_ind,   _jsr  ,_ind,   _ldx  ,_ind,   _stx  ,_ind,
+_suba ,_ext,   _cmpa ,_ext,   _sbca ,_ext,   _subd ,_ext,
+_anda ,_ext,   _bita ,_ext,   _lda  ,_ext,   _sta  ,_ext,
+_eora ,_ext,   _adca ,_ext,   _ora  ,_ext,   _adda ,_ext,
+_cmpx ,_ext,   _jsr  ,_ext,   _ldx  ,_ext,   _stx  ,_ext,
+_subb ,_imb,   _cmpb ,_imb,   _sbcb ,_imb,   _addd ,_imw,
+_andb ,_imb,   _bitb ,_imb,   _ldb  ,_imb,   _ill  ,_nom,
+_eorb ,_imb,   _adcb ,_imb,   _orb  ,_imb,   _addb ,_imb,
+_ldd  ,_imw,   _ill  ,_nom,   _ldu  ,_imw,   _ill  ,_nom,
+_subb ,_dir,   _cmpb ,_dir,   _sbcb ,_dir,   _addd ,_dir,
+_andb ,_dir,   _bitb ,_dir,   _ldb  ,_dir,   _stb  ,_dir,
+_eorb ,_dir,   _adcb ,_dir,   _orb  ,_dir,   _addb ,_dir,
+_ldd  ,_dir,   _std  ,_dir,   _ldu  ,_dir,   _stu  ,_dir,
+_subb ,_ind,   _cmpb ,_ind,   _sbcb ,_ind,   _addd ,_ind,
+_andb ,_ind,   _bitb ,_ind,   _ldb  ,_ind,   _stb  ,_ind,
+_eorb ,_ind,   _adcb ,_ind,   _orb  ,_ind,   _addb ,_ind,
+_ldd  ,_ind,   _std  ,_ind,   _ldu  ,_ind,   _stu  ,_ind,
+_subb ,_ext,   _cmpb ,_ext,   _sbcb ,_ext,   _addd ,_ext,
+_andb ,_ext,   _bitb ,_ext,   _ldb  ,_ext,   _stb  ,_ext,
+_eorb ,_ext,   _adcb ,_ext,   _orb  ,_ext,   _addb ,_ext,
+_ldd  ,_ext,   _std  ,_ext,   _ldu  ,_ext,   _stu  ,_ext,
+};
+
+byte h6309_codes10[512] = {
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _lbrn ,_rew,   _lbhi ,_rew,   _lbls ,_rew,
+_lbcc ,_rew,   _lbcs ,_rew,   _lbne ,_rew,   _lbeq ,_rew,
+_lbvc ,_rew,   _lbvs ,_rew,   _lbpl ,_rew,   _lbmi ,_rew,
+_lbge ,_rew,   _lblt ,_rew,   _lbgt ,_rew,   _lble ,_rew,
+_addr ,_r1 ,   _adcr ,_r1 ,   _subr ,_r1 ,   _sbcr ,_r1 ,
+_andr ,_r1 ,   _orr  ,_r1 ,   _eorr ,_r1 ,   _cmpr ,_r1 ,
+_pshsw,_imp,   _pulsw,_imp,   _pshuw,_imp,   _puluw,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _swi2 ,_imp,
+_negd ,_imp,   _ill  ,_nom,   _ill  ,_nom,   _comd ,_imp,
+_lsrd ,_imp,   _ill  ,_nom,   _rord ,_imp,   _asrd ,_imp,
+_asld ,_imp,   _rold ,_imp,   _decd ,_imp,   _ill  ,_nom,
+_incd ,_imp,   _tstd ,_imp,   _ill  ,_nom,   _clrd ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _comw ,_imp,
+_lsrw ,_imp,   _ill  ,_nom,   _rorw ,_imp,   _ill  ,_nom,
+_ill  ,_nom,   _rolw ,_imp,   _decw ,_imp,   _ill  ,_nom,
+_incw ,_imp,   _tstw ,_imp,   _ill  ,_nom,   _clrw ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_subw ,_imw,   _cmpw ,_imw,   _sbcd ,_imw,   _cmpd ,_imw,
+_andd ,_imw,   _bitd ,_imw,   _ldw  ,_imw,   _ill  ,_nom,
+_eord ,_imw,   _adcd ,_imw,   _ord  ,_imw,   _addw ,_imw,
+_cmpy ,_imw,   _ill  ,_nom,   _ldy  ,_imw,   _ill  ,_nom,
+_subw ,_dir,   _cmpw ,_dir,   _sbcd ,_dir,   _cmpd ,_dir,
+_andd ,_dir,   _bitd ,_dir,   _ldw  ,_dir,   _stw  ,_dir,
+_eord ,_dir,   _adcd ,_dir,   _ord  ,_dir,   _addw ,_dir,
+_cmpy ,_dir,   _ill  ,_nom,   _ldy  ,_dir,   _sty  ,_dir,
+_subw ,_ind,   _cmpw ,_ind,   _sbcd ,_ind,   _cmpd ,_ind,
+_andd ,_ind,   _bitd ,_ind,   _ldw  ,_ind,   _stw  ,_ind,
+_eord ,_ind,   _adcd ,_ind,   _ord  ,_ind,   _addw ,_ind,
+_cmpy ,_ind,   _ill  ,_nom,   _ldy  ,_ind,   _sty  ,_ind,
+_subw ,_ext,   _cmpw ,_ext,   _sbcd ,_ext,   _cmpd ,_ext,
+_andd ,_ext,   _bitd ,_ext,   _ldw  ,_ext,   _stw  ,_ext,
+_eord ,_ext,   _adcd ,_ext,   _ord  ,_ext,   _addw ,_ext,
+_cmpy ,_ext,   _ill  ,_nom,   _ldy  ,_ext,   _sty  ,_ext,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _lds  ,_imw,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ldq  ,_dir,   _stq  ,_dir,   _lds  ,_dir,   _sts  ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ldq  ,_ind,   _stq  ,_ind,   _lds  ,_ind,   _sts  ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ldq  ,_ext,   _stq  ,_ext,   _lds  ,_ext,   _sts  ,_ext,
+};
+
+byte m6809_codes10[512] = {
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _lbrn ,_rew,   _lbhi ,_rew,   _lbls ,_rew,
+_lbcc ,_rew,   _lbcs ,_rew,   _lbne ,_rew,   _lbeq ,_rew,
+_lbvc ,_rew,   _lbvs ,_rew,   _lbpl ,_rew,   _lbmi ,_rew,
+_lbge ,_rew,   _lblt ,_rew,   _lbgt ,_rew,   _lble ,_rew,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _swi2 ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _cmpd ,_imw,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_cmpy ,_imw,   _ill  ,_nom,   _ldy  ,_imw,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _cmpd ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_cmpy ,_dir,   _ill  ,_nom,   _ldy  ,_dir,   _sty  ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _cmpd ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_cmpy ,_ind,   _ill  ,_nom,   _ldy  ,_ind,   _sty  ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _cmpd ,_ext,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_cmpy ,_ext,   _ill  ,_nom,   _ldy  ,_ext,   _sty  ,_ext,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _lds  ,_imw,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _lds  ,_dir,   _sts  ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _lds  ,_ind,   _sts  ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _lds  ,_ext,   _sts  ,_ext,
+};
+
+byte h6309_codes11[512] = {
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_band ,_bt ,   _biand,_bt ,   _bor  ,_bt ,   _bior ,_bt ,
+_beor ,_bt ,   _bieor,_bt ,   _ldbt ,_bt ,   _stbt ,_bt ,
+_tfm  ,_t1 ,   _tfm  ,_t2 ,   _tfm  ,_t3 ,   _tfm  ,_t4 ,
+_bitmd,_imb,   _ldmd ,_imb,   _ill  ,_nom,   _swi3 ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _come ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _dece ,_imp,   _ill  ,_nom,
+_ince ,_imp,   _tste ,_imp,   _ill  ,_nom,   _clre ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _comf ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _decf ,_imp,   _ill  ,_nom,
+_incf ,_imp,   _tstf ,_imp,   _ill  ,_nom,   _clrf ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_sube ,_imb,   _cmpe ,_imb,   _ill  ,_nom,   _cmpu ,_imw,
+_ill  ,_nom,   _ill  ,_nom,   _lde  ,_imb,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _adde ,_imb,
+_cmps ,_imw,   _divd ,_imb,   _divq ,_imw,   _muld ,_imw,
+_sube ,_dir,   _cmpe ,_dir,   _ill  ,_nom,   _cmpu ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _lde  ,_dir,   _ste  ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _adde ,_dir,
+_cmps ,_dir,   _divd ,_dir,   _divq ,_dir,   _muld ,_dir,
+_sube ,_ind,   _cmpe ,_ind,   _ill  ,_nom,   _cmpu ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _lde  ,_ind,   _ste  ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _adde ,_ind,
+_cmps ,_ind,   _divd ,_ind,   _divq ,_ind,   _muld ,_ind,
+_sube ,_ext,   _cmpe ,_ext,   _ill  ,_nom,   _cmpu ,_ext,
+_ill  ,_nom,   _ill  ,_nom,   _lde  ,_ext,   _ste  ,_ext,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _adde ,_ext,
+_cmps ,_ext,   _divd ,_ext,   _divq ,_ext,   _muld ,_ext,
+_subf ,_imb,   _cmpf ,_imb,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ldf  ,_imb,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _addf ,_imb,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_subf ,_dir,   _cmpf ,_dir,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ldf  ,_dir,   _stf  ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _addf ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_subf ,_ind,   _cmpf ,_ind,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ldf  ,_ind,   _stf  ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _addf ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_subf ,_ext,   _cmpf ,_ext,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ldf  ,_ext,   _stf  ,_ext,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _addf ,_ext,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+};
+
+byte m6809_codes11[512] = {
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _swi3 ,_imp,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _cmpu ,_imw,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_cmps ,_imw,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _cmpu ,_dir,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_cmps ,_dir,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _cmpu ,_ind,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_cmps ,_ind,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _cmpu ,_ext,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_cmps ,_ext,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+_ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,   _ill  ,_nom,
+};
+
+char *h6309_exg_tfr[] =
+{
+ "D", "X", "Y", "U", "S", "PC","W" ,"V",
+ "A", "B", "CC","DP","0", "0", "E", "F"
+};
+
+char *m6809_exg_tfr[] =
+{
+ "D", "X", "Y", "U", "S", "PC","??","??",
+ "A", "B", "CC","DP","??","??","??","??"
+};
+
+char *bit_r[] = {"CC","A","B","??"};
+
+char *block_r[] =
+{
+ "D","X","Y","U","S","?","?","?","?","?","?","?","?","?","?","?"
+};
+
+char *off4[] =
+{
+  "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
+  "8",  "9", "10", "11", "12", "13", "14", "15",
+"-16","-15","-14","-13","-12","-11","-10", "-9",
+ "-8", "-7", "-6", "-5", "-4", "-3", "-2", "-1"
+};
+
+char reg[] = { 'X','Y','U','S' };
+
+byte *codes            = m6809_codes;
+byte *codes10          = m6809_codes10;
+byte *codes11          = m6809_codes11;
+char **exg_tfr         = m6809_exg_tfr;
+int  allow_6309_codes  = FALSE;
+int  os9_patch         = FALSE;
+
+unsigned index_string(char *buffer, unsigned pc)
+{
+  byte T;
+  word W;
+  char R;
+  char buf[30];
+  unsigned PC = pc;
+
+  T = ARGBYTE(PC); PC++;
+  R = reg[(T>>5)&0x03];
+
+  if(T&0x80)
+  {
+    switch(T&0x1F)
+    {
+      case 0x00: sprintf(buf,",%c+",R);break;
+
+      case 0x01: sprintf(buf,",%c++",R);break;
+
+      case 0x02: sprintf(buf,",-%c",R);break;
+
+      case 0x03: sprintf(buf,",--%c",R);break;
+
+      case 0x04: sprintf(buf,",%c",R);break;
+
+      case 0x05: sprintf(buf,"B,%c",R);break;
+
+      case 0x06: sprintf(buf,"A,%c",R);break;
+
+      case 0x08: T = ARGBYTE(PC); PC++;
+                 sprintf(buf,"$%02X,%c",T,R);
+                 break;
+
+      case 0x09: W = ARGWORD(PC); PC+=2;
+                 sprintf(buf,"$%04X,%c",W,R);
+                 break;
+
+      case 0x0B: sprintf(buf,"D,%c",R);break;
+
+      case 0x0C: T = ARGBYTE(PC); PC++;
+                 sprintf(buf,"$%02X,PC",T);
+                 break;
+
+      case 0x0D: W = ARGWORD(PC); PC+=2;
+                 sprintf(buf,"$%04X,PC",W);
+                 break;
+
+      case 0x11: sprintf(buf,"[,%c++]",R);break;
+
+      case 0x13: sprintf(buf,"[,--%c]",R);break;
+
+      case 0x14: sprintf(buf,"[,%c]",R);break;
+
+      case 0x15: sprintf(buf,"[B,%c]",R);break;
+
+      case 0x16: sprintf(buf,"[A,%c]",R);break;
+
+      case 0x18: T = ARGBYTE(PC); PC++;
+                 sprintf(buf,"[$%02X,%c]",T,R);
+                 break;
+
+      case 0x19: W = ARGWORD(PC); PC+=2;
+                 sprintf(buf,"[$%04X,%c]",W,R);
+                 break;
+
+      case 0x1B: sprintf(buf,"[D,%c]",R);break;
+
+      case 0x1C: T = ARGBYTE(PC); PC++;
+                 sprintf(buf,"[$%02X,PC]",T);
+                 break;
+
+      case 0x1D: W = ARGWORD(PC); PC+=2;
+                 sprintf(buf,"[$%04X,PC]",W);
+                 break;
+
+      case 0x07: if(allow_6309_codes)
+                 {
+                   sprintf(buf,"E,%c",R);
+                   break;
+                 } else goto index_error;
+
+      case 0x17: if(allow_6309_codes)
+                 {
+                   sprintf(buf,"[E,%c]",R);
+                   break;
+                 } else goto index_error;
+
+      case 0x0A: if(allow_6309_codes)
+                 {
+                   sprintf(buf,"F,%c",R);
+                   break;
+                 } else goto index_error;
+
+      case 0x1A: if(allow_6309_codes)
+                 {
+                   sprintf(buf,"[F,%c]",R);
+                   break;
+                 } else goto index_error;
+
+      case 0x0E: if(allow_6309_codes)
+                 {
+                   sprintf(buf,"W,%c",R);
+                   break;
+                 } else goto index_error;
+
+      case 0x1E: if(allow_6309_codes)
+                 {
+                   sprintf(buf,"[W,%c]",R);
+                   break;
+                 } else goto index_error;
+
+      index_error: sprintf(buf,"???"); break;
+
+      default:   if(T==0x9F)
+                 {
+                   W = ARGWORD(PC); PC+=2;
+                   sprintf(buf,"[$%04X]",W);
+                 }
+                 else if(allow_6309_codes)
+                 {
+                   switch(T)
+                   {
+                     case 0x8F: sprintf(buf,",W");break;
+                     case 0x90: sprintf(buf,"[,W]");break;
+
+                     case 0xAF: W = ARGWORD(PC); PC+=2;
+                                sprintf(buf,"$%04X,W",W);break;
+
+                     case 0xB0: W = ARGWORD(PC); PC+=2;
+                                sprintf(buf,"[$%04X,W]",W);break;
+
+                     case 0xCF: sprintf(buf,",W++");break;
+
+                     case 0xD0: sprintf(buf,"[,W++]");break;
+
+                     case 0xEF: sprintf(buf,",--W");break;
+
+                     case 0xF0: sprintf(buf,"[,--W]");break;
+
+                     default:   sprintf(buf,"???"); break;
+                   }
+                 }
+                 else sprintf(buf,"???");
+                 break;
+    }
+
+  } else sprintf(buf,"%s,%c",off4[T&0x1F],R);
+
+  strcat(buffer,buf);
+  return(PC);
+}
+
+unsigned Dasm(char *buffer, unsigned pc)
+{
+  byte T,M;
+  word W;
+  char *I;
+  char buf[30];
+  unsigned PC = pc;
+
+  T = OPCODE(PC); PC++;
+
+  if(T==0x10)
+  {
+    T = OPCODE(PC); PC++;
+    W = (word)(T*2);
+    T = codes10[W++];
+    I = (char *)mne[T];
+    M = codes10[W];
+
+    if( (T==_swi2) && (os9_patch==TRUE) )
+    {
+      T = OPCODE(PC); PC++;
+      sprintf(buffer,"OS9 %s",os9_codes[T]);
+      return(PC-pc);
+    }
+
+  }
+  else if(T==0x11)
+  {
+    T = OPCODE(PC); PC++;
+    W = (word)(T*2);
+    T = codes11[W++];
+    I = (char *)mne[T];
+    M = codes11[W];
+  }
+  else
+  {
+    W = (word)(T*2);
+    T = codes[W++];
+    I = (char *)mne[T];
+    M = codes[W];
+  }
+
+  switch(M)
+  {
+    case _nom: sprintf(buffer,"Invalid");break;
+
+    case _imp: sprintf(buffer,"%s", I);break;
+
+    case _imb: T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s #$%02X", I, T);
+               break;
+
+    case _imw: W = ARGWORD(PC); PC+=2;
+               sprintf(buffer,"%s #$%04X",I,W);
+               break;
+
+    case _dir: T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s <$%02X",I,T);
+               break;
+
+    case _ext: W = ARGWORD(PC); PC+=2;
+               sprintf(buffer,"%s $%04X",I,W);
+               break;
+
+    case _ind: sprintf(buffer,"%s ",I);
+               PC = index_string(buffer,PC);
+               break;
+
+    case _reb: T = ARGBYTE(PC); PC++;
+               W = (word)(PC + (signed char)T);
+               sprintf(buffer,"%s $%04X",I,W);
+               break;
+
+    case _rew: W = ARGWORD(PC); PC+=2;
+               W += (word)PC;
+               sprintf(buffer,"%s $%04X",I,W);
+               break;
+
+    case _r1:  T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s %s,%s",I,exg_tfr[T>>4],exg_tfr[T&0xF]);
+               break;
+
+    case _r2:
+    case _r3:  buf[0] = '\0';
+               T = ARGBYTE(PC); PC++;
+               if(T&0x80) strcat(buf,"PC,");
+               if(T&0x40)
+               {
+                 if(M==_r2) strcat(buf,"U,");
+                 if(M==_r3) strcat(buf,"S,");
+               }
+               if(T&0x20) strcat(buf,"Y,");
+               if(T&0x10) strcat(buf,"X,");
+               if(T&0x08) strcat(buf,"DP,");
+               if(T&0x04) strcat(buf,"B,");
+               if(T&0x02) strcat(buf,"A,");
+               if(T&0x01) strcat(buf,"CC,");
+               if(buf[0]!='\0') buf[strlen(buf)-1]='\0';
+               sprintf(buffer,"%s %s",I,buf);
+               break;
+
+    case _bd:  M = ARGBYTE(PC); PC++;
+               T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s #$%02X,<$%02X",I,M,T);
+               break;
+
+    case _be:  T = ARGBYTE(PC); PC++;
+               W = ARGWORD(PC); PC+=2;
+               sprintf(buffer,"%s #$%02X,$%04X",I,T,W);
+               break;
+
+    case _bt:  M = ARGBYTE(PC); PC++;
+               T = ARGBYTE(PC); PC++;
+#if 1
+               sprintf(buffer,"%s %s.%01d,<$%02X.%01d",
+               I,bit_r[M>>6],M&7,T,(M>>3)&7);
+#else
+               sprintf(buffer,"%s %s,%01d,%01d,$%02X",
+               I,bit_r[M>>6],(M>>3)&7,M&7,T);
+#endif
+               break;
+
+    case _t1:  T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s %s+,%s+",I,block_r[T>>4],block_r[T&0xF]);
+               break;
+
+    case _t2:  T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s %s-,%s-",I,block_r[T>>4],block_r[T&0xF]);
+               break;
+
+    case _t3:  T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s %s+,%s",I,block_r[T>>4],block_r[T&0xF]);
+               break;
+
+    case _t4:  T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s %s,%s+",I,block_r[T>>4],block_r[T&0xF]);
+               break;
+
+    case _iml: W = ARGWORD(PC); PC+=2;
+               T = ARGBYTE(PC); PC++;
+               M = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s #$%04X%02X%02X",I,W,T,M);
+               break;
+
+    case _bi:  T = ARGBYTE(PC); PC++;
+               sprintf(buffer,"%s #$%02X,",I,T);
+               PC = index_string(buffer,PC);
+               break;
+
+    default:   sprintf(buffer,"%s ERROR",I);
+
+  }
+
+  return(PC-pc);
+}
+
+unsigned Dasm6809(char *buffer, unsigned pc)
+{
+  codes             = m6809_codes;
+  codes10           = m6809_codes10;
+  codes11           = m6809_codes11;
+  exg_tfr           = m6809_exg_tfr;
+  allow_6309_codes  = FALSE;
+
+  return( Dasm(buffer, pc) );
+}
+
+unsigned Dasm6309(char *buffer, unsigned pc)
+{
+  codes             = h6309_codes;
+  codes10           = h6309_codes10;
+  codes11           = h6309_codes11;
+  exg_tfr           = h6309_exg_tfr;
+  allow_6309_codes  = TRUE;
+
+  return( Dasm(buffer, pc) );
+}