March 29, 2018

The Motorola MC6809

This is an old fossil of an 8 bit processor that my buddy AJ has me working on again. He has an ancient circuit and a code listing and he wants to get the thing running again. He wants to stick with "vintage accuracy", which is fine by me, although I did pitch the idea of redoing the whole project using an ARM, such as a blue pill board. Some people might say, "where's the fun in that?" and who can argue with them?

The first thing is to find some kind of free assembler, and there seems to be a myriad of choices. The writer of the following post raves about the "lwasm" assembler that is part of "lwtools", so I am going to start there.

Nicely enough, there is a fedora package for lwtools and I can just install it using DNF.
dnf install lwtools
( gives me lwtools-4.14-3.fc27.x86_64.rpm )
Now I have lwasm in /usr/bin/lwasm and it compiles the short bit of code the fellow gives in the blog above and yields the same messages. This was easy. No man page, but the --help option is helpful:
[tom@trona ~]$ lwasm --help
Usage: lwasm [OPTION...] INPUTFILE
lwasm, a HD6309 and MC6809 cross-assembler

  -3, --6309                  Set assembler to 6309 mode (default)
      --6800compat            Enable 6800 compatibility instructions,
                              equivalent to --pragma=6800compat
  -9, --6809                  Set assembler to 6809 only mode
  -d, --debug[=LEVEL]         Set debug mode
  -b, --decb                  Generate DECB .bin format output, equivalent of
                              --format=decb
  -D, --define=SYM[=VAL]      Automatically define SYM to be VAL (or 1)
      --depend                Output a dependency list to stdout; do not do
                              any actual output though assembly is completed
                              as usual
      --dependnoerr           Output a dependency list to stdout; do not do
                              any actual output though assembly is completed
                              as usual; don't bail on missing include files
  -f, --format=TYPE           Select output format: decb, basic, raw, obj, os9
  -I, --includedir=PATH       Add entry to include path
  -l, --list[=FILE]           Generate list [to FILE]
  -m, --map[=FILE]            Generate map [to FILE]
      --obj                   Generate proprietary object file format for
                              later linking, equivalent of --format=obj
  -o, --output=FILE           Output to FILE
  -p, --pragma=PRAGMA         Set an assembler pragma to any value understood
                              by the "pragma" pseudo op
  -P, --preprocess            Preprocess macros and conditionals and output
                              revised source to stdout
  -r, --raw                   Generate raw binary format output, equivalent of
                              --format=raw
  -s, --symbols               Generate symbol list in listing, no effect
                              without --list
      --symbols-nolocals      Same as --symbols but with local labels ignored
  -t, --tabs=WIDTH            Set tab spacing in listing (0=don't expand tabs)
      --unicorns              Add sooper sekrit sauce
  -?, --help                  give this help list
      --usage                 give a short usage message
  -V, --version               print program version
I start out using: lwasm -9bl -p cd -oNEW.BIN mycode.asm and using the sample code in the blog post by Glenn Parker and get his results, so it looks like this is the package I want. Amazing that fedora includes 6809 development tools in the available packages.

Interrupts and such

On the circuit I am working with, the IRQ input is driven by a 555 running at about 2Khz with high time .479 ms and low time .0069 ms.