Home of Alex Thissen

All of the things I like to share

Hello World with 6809 assembler language

The first thing I did after finding the developer information is skim through the Introductionary Tutorial by Christopher L. Tumbler. I want to get a feel for the assembly language, and the way the games for the Vectrex are created. At first glance the code for the 6809 seems reasonably close to the 6502. There are 16-bit registers and instructions that make use of those. Branching is possible with the relative short jump (plus or minus 127 offsets), but also long jumps which take an additional byte.

The code for a typical Hello World program looks like this:

  ORG $0000

; Magic Init Block
  FCB $67,$20
  FCC "GCE XXXX"
  FCB $80
  FDB music
  FDB $f850
  FDB $30b8
  FCC "SIMPLE"
  FCB $80,$0

start:
  bra start

music:
  FDB $fee8
  FDB $feb6
  FCB $0,$80
  FCB $0,$80

Notice the magic initialization block that is needed for a Vectrex program. The program loops infinitely and plays no music.

I want to get this simple program to compile. So, I started searching for compilers:

I unpacked the AS09 1.42 compiler and copied the Simple.asm file (with the contents above) to the directory.
Compile the source with:

as09.exe simple.asm

As it seems the compiler has some issues with upper case mnemonics. Normally the –i switch should make the compiler case-insensitive, but this doesn’t seem to happen. I’ve contacted Frank Kingswood about this. Changing the ORG, FCB, FCC and FDB to lower-case does the trick for now.

The result of the compilation is a simple.bin binary file that you can run on an emulator like MESS. The syntax for running this is:

mess64.exe vectrex –cart roms\vectrex\simple.bin

where I have run this command from the command-line at the MESS root directory. My roms are stored in the subdirectory roms\vectrex. The required boot rom for Vectrex is also located in that folder.

I have also stumbled on the source code for VecThrust at the website of Ville. This will be interesting later on.


Posted 02-22-2012 18:25 by Alex Thissen
Powered by Community Server (Commercial Edition), by Telligent Systems