SkillAgentSearch skills...

F9dasm

6800/6801/6809/6309 Disassembler

Install / Use

/learn @Arakula/F9dasm
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

F9DASM - 6800/6801/6802/6803/6808/6809 / 6301/6303/6309 Disassembler

Copyright (c) 2000 Arto Salmi
Parts Copyright (c) 2001-2022 Hermann Seib
Parts Copyright (c) 2013 Colin Bourassa
Parts Copyright (c) 2014-2015 Rainer Buchty

Based on Arto Salmi's C core that can be found somewhere on the 'net (last address known to me was http://koti.mbnet.fi/~atjs/mc6809/Disassembler/dasm09.TGZ), I built a complete 6800/6809/6309 disassembler that can handle input files in a variety of formats (Intel Hex / Motorola S09 / Flex9 Binary / Binary). Since disassembly without guidance produces measly results, it can load information files with quite a lot of directives, too.

I taylored the original to my taste by working through the source code; since F9DASM has reached a level of complexity that doesn't really lend itself to following the "Use the Source, Luke!" principle if you just want to disassemble a little 6809 program, I've added this documentation. Have fun!

Hermann Seib, 2022

Included programs

f9dasm is the disassembler itself.

Also included are some little utilities:

hex2bin can be used to convert Intel Hex-formatted files to binary files.

mot2bin can be used to convert Motorola S-formatted files to binary files.

cmd2mot can be used to convert FLEX9 binaries to Motorola S-formatted files.

f9dasm doesn't need these utilities, it can handle all four input formats.

Building

f9dasm, hex2bin, mot2bin, and cmd2mot are command line tools written in fairly generic C that should compile on a wide range of systems.

For Microsoft Visual Studio, .dsp, .dsw (Visual Studio 6), .sln, and .vcproj files are provided.

A Makefile is provided for Linux systems; this may also work on other systems using GNU Make. You'll need to make sure you have the appropriate development packages (make, gcc, etc.) installed. This was tested on Debian 9.

Syntax

f9dasm [-option]* [filename]

Command Line Options

<dl> <dt><b>-offset <i>address</i></b></dt> <dd>When disassembling a binary file, the default load address is 0, since the binary file does not contain any clues; using this option forces F9DASM to load the file at the specified address.</dd> <dt><b>-begin <i>address</i></b></dt> <dd>start disassembly address (<i>address</i> has to be given in hex format)<br> Default is the first referenced address in the file.</dd> <dt><b>-end <i>address</i></b></dt> <dd>end disassembly address (<i>address</i> has to be given in hex format)<br> Normally, this is defined either through the file size or its contents, if it has an embedded END address. This option allows to override the implicit end address.</dd> <dt><b>-out <i>filename</i></b></dt> <dd>normally, f9dasm streams to standard output; this option forces it to write to the specified file instead.</dd> <dt><b>-[no]addr</b></dt> <dd>if disabled, suppresses the address field output for clean assembler source files (default is enabled)</dd> <dt><b>-[no]hex</b></dt> <dd>disables or enables hex dump output (default is enabled).<br> While analyzing a file, the hex dump can be quite helpful; if you want to generate a clean assembler source file, you can disable it.</dd> <dt><b>-x</b>, <b>-6309</b></dt> <dd>puts disassembler in 6309 mode (default is 6809).</dd> <dt><b>-6800</b>, <b>-6802</b>, <b>-6808</b> </dt> <dd>puts disassembler in 6800/6802/6808 mode (default is 6809).</dd> <dt><b>-6801</b>, <b>-6803</b></dt> <dd>puts disassembler in 6801/6803 mode (default is 6809).</dd> <dt><b>-6301</b>, <b>-6303</b></dt> <dd>puts disassembler in 6301/6303 mode (default is 6809).</dd> <dt><b>-os9</b></dt> <dd>using this flag, the disassembler tries to convert swi2 to the corresponding OS/9 calls.</dd> <dt><b>-info <i>filename</i></b></dt> <dd><i>filename</i> gives an information file which contains additional hints for the disassembler. See the <b>Info File</b> section below.<br> Passing the file name <i>help</i> displays help for the information file.</dd> <dt><b>-cchar <i>char</i></b></dt> <dd><i>char</i> is the character to be used as comment delimiter.<br> Default is <b>;</b>, but not all assemblers can use this.<br> <b>-cchar *</b> would switch the comment delimiter to <b>*</b>, for example, which might be better if a TSC-compatible assembler is used.</dd> <dt><b>-[no]flex</b></dt> <dd>using this flag, the disassembler uses the standardized FLEX labels for a defined range of addresses.</dd> <dt><b>-[no]conv</b></dt> <dd>using this flag, the disassembler outputs various "convenience" mnemonics (like, for example, <b>CLRD</b> instead of <b>CLRA</b> followed by <b>CLRB</b>).<br> Default is on, but not all assemblers support this, so f9dasm can be forced to stick to the base set of mnemonics.<br> f9dasm's companion, <a href="https://github.com/Arakula/A09">A09</a>, can of course handle them :-)</dd> <dt><b>-[no]dec</b></dt> <dd>can be used to output values in decimal notation (by default it's hexadecimal).</dd> <dt><b>-[no]comment</b></dt> <dd>can be used to enable or disable the output of comments (which can be provided in an info file, see below).<br> Normally, comments are enabled.</dd> <dt><b>-[no]asc</b></dt> <dd>can be used to enable or disable output of the ASCII equivalent to code/data.<br> Default is to output ASCII</dd> <dt><b>-[no]fcc</b></dt> <dd>can be used to enable or disable the use of FCC to define data (instead of FCB or FDB)<br> Default is to use FCC</dd> <dt><b>-omitzero</b></dt> <dd>omit indexed-mode operands of $00 (default)</dd> <dt><b>-showzero</b></dt> <dd>do not omit indexed-mode operands of $00<br> This only works for 6800-based code; in 6809-based code, omitting the zero is encoded differently.</dd> <dt><b>-[no]forced</b></dt> <dd>using this flag, the assembler outputs <i>forced direct (&lt;) or extended (&gt;) addressing markers</i> where this is necessary to ensure an exact reproduction.<br> This is based on the TSC Assembler's syntax, which is not necessarily universal, so it can be turned off.</dd> <dt><b>-ldchar <i>char</i></b></dt> <dd><i>char</i> is the character to be used as label delimiter.<br> Default is nothing, but not all assemblers can use this; some need a colon, for example.<br> <b>-ldchar :</b> can be used to switch the label delimiter to <b>:</b> in this case.</dd> <dt><b>-help</b></dt> <dd>outputs an abbreviated version of this documentation.</dd> </dl>

Info File

Using the <b>-info <i>filename</i></b> option, you can give f9dasm additional information about the layout of the processed file.

Normally, f9dasm will try to interpret everything as <i>code</i>; it doesn't try to find out which areas contain code and which areas contain data, or the format of the data. Using an info file, you can give it detailed instructions how to process the file, add comments, insert additional stuff, and so on.

The info file is a simple text file, which contains one instruction per line.
The instructions are case-insensitive.
Addresses need to be given in <i>hexadecimal</i> notation. Anything following an asterisk (<b>*</b>) is interpreted as a comment.

The info file can contain the following instructions:

<dl> <dt><b>file <i>filename [baseaddr]</i></b></dt> <dd>This instructs f9dasm to load the given file at the given address.<br> Can be used instead of the command line parameter for the file name; this can, for example, be useful if you want to generate a listing for a bunch of small EPROMs that cover a continuous memory area.</dd> <dt><b>option <i>option [value]</i></b></dt> <dd><i>option</i> is one of the options listed above, just without the leading hyphen (-).</dd> <dt><b>code <i>addr[-addr]</i></b></dt> <dd>defines the given address (range) as containing code.</dd> <dt><b>data <i>addr[-addr]</i></b></dt> <dd>defines the given address (range) as containing data instead of code.<br> f9dasm will try to decipher ASCII strings in the area and display them in the best possible format.</dd> <dt><b>bin[ary] <i>addr[-addr]</i></b><br /> <b>char <i>addr[-addr]</i></b><br /> <b>dec[imal] <i>addr[-addr]</i></b><br /> <b>hex[adecimal] <i>addr[-addr]</i></b></dt> <dd>defines the output format used for the given data range.<br> This can also be used for constants in the <i>code</i> area; if, for example, f9dasm outputs the following line of code:<br> <pre> LDA #$D6 *C115: 86 D6</pre> and you know pretty well that this is a binary bit mask, you can force it to display the data in a nicer format by giving the instruction <b>bin c116</b> (note that the address of the constant byte is given, <i>not</i> the address of the instruction!). This results in the modified output <pre> LDA #%11010110 *C115: 86 D6</pre> which may be easier to read (depending on your mental approach to assembler programming :-).<br> Note that <b>char</b> and <b>bin</b> can not be used for word areas (see below).</dd> <dt><b>word <i>addr[-addr]</i></b></dt> <dd>defines that the area consists of <i>words</i> (i.e., 2-byte entities, high byte first) instead of single bytes.</dd> <dt><b>const <i>addr[-addr]</i></b></dt> <dd>defines the data in the given range as <i>constants</i>.<br> Normally, if f9dasm can interpret the data as addresses, it will; and if there's a label defined for this address, it will display the label instead of the original value.</dd> <dt><b>unused <i>addr[-ad
View on GitHub
GitHub Stars82
CategoryDevelopment
Updated17d ago
Forks33

Languages

C

Security Score

95/100

Audited on Mar 15, 2026

No findings