-
Notifications
You must be signed in to change notification settings - Fork 17
building code
- 6809 assembler. The "definitive" assembler, as9, can be found at http://home.hccnet.nl/a.w.m.van.der.horst/m6809.html -- as can its manual.
- 6809 disassembler. I use f9dasm; you can find various copies of it around but the original author has it on a repository at github here: https://github.com/Arakula/f9dasm
- Code conversion tools hex_addr_remap and hex2bin (referred to below) are PERL scripts that you can find in the bin/ directory of this github repository.
- (for NitrOS-9) toolshed (https://sourceforge.net/projects/toolshed/) includes a 6809 assembler/linker and utilities for creating and manipulating NitrOS-9 disk images
Different tools want code in different forms. These include:
- S19 file (S19 refers to file in "srecord" format) absolute (addresses in the file correspond to the absolute address in the target address space). The emulator can read files in this format.
- HEX file (HEX refers to a file in Intel Hex format) is a absolute (addresses in the file correspond to the absolute address in the target address space). The emulator can read files in this format.
- HEX file relative (addresses in the file correspond to offsets from eg the base address of the ROM, but any branches and other references in the file use the absolute address so that the image will execute correctly). The ROM images loaded into memory models for the Altera tools must be in this format.
- Binary file (no addressing information). The images used for the FLEX port, and any boot images loaded onto the SD card must be in this format.
A typical incantation for the assembler looks like this:
$ as9 myfile.asm -l s19 now
This generates a listing file myfile.lst and an image file myfile.s19, in srecord format.
I use a linux tool srec_cat to convert from srecord to hex:
$ srec_cat myfile.s19 -Output myfile.hex -Intel -Data-Only -address-length=2
There are numerous other tools around that can do this manipulation, else write your own in PERL (the formats are simple, line-based and described in detail on Wikipedia and elsewhere).
I use a PERL script to convert HEX files in absolute format to relative format (this requires changing the address field and recalculating the per-line checksum):
$ hex_addr_remap e000 myfile.hex > myfile.hex_remap
I use a PERL script to convert HEX files to binary:
$ hex2bin myfile.hex > myfile.bin
The disassembler has a number of lovely features including:
- It can disassemble files in FLEX binary format (aw well as Intel HEX, Motorola, binary)
- It "knows" the FLEX labels and can annotate them in to source without further assistable
- It can take an "infofile" and use this to annotate labels, defines etc. into the source that it generates