This page describes the ANSI Forth 65816 target assembler, which I wrote with the intention of using it to build the Kestrel's own Forth ROM and kernel ROM images. I was originally planning on writing them using ACME, but determined using Forth for this purpose is better due to the following reason: I'm that much closer to getting Kestrel Forth to compile itself. Otherwise, I'd have to spend the time to write the target assembler later on anyway, which would mean that I'd have to write all the guts of Forth twice! Doing the Forth-based assembler now will allow me to skip this step. (I otherwise highly recommend ACME -- it's one of my favorite assemblers!)
The file is so small that I'm not even going to bother putting it into a darcs repository. You can access it here. Example source files can be found towards the bottom of this page.
This assembler is an RPN assembler -- meaning that operands come before the operation. This is typical for most Forth assemblers. However, since I'm relying exclusively on the Forth parser and not writing my own, distinguishing $1234 as an absolute versus an immediate value needs to be explained, as it doesn't follow recommended Western Design Center syntax guidelines.
| Word | Addressing Mode |
|---|---|
| #b, | 8-bit Immediate |
| #w, | 16-bit Immediate |
| #, | Immediate; size is the same as the last #b, or #w, used. |
| dp, | Direct Page |
| dp,x, | Direct Page, Indexed by X |
| dp,y, | Direct Page, Indexed by Y (only for STX) |
| (dp), | Direct Page Indirect |
| (,x), | Direct Page Indexed Indirect |
| (),y, | Direct Page Indirect Indexed |
| [dp], | Direct Page Indirect Long |
| [],y, | Direct Page Indirect Indexed Long |
| $, | Absolute (16-bit pointer) |
| $,x, | Absolute Indexed (16-bit pointer) |
| $,y, | Absolute Indexed (16-bit pointer) |
| $l, | Long Absolute (24-bit pointer) |
| $l,x, | Long Absolute Indexed (24-bit pointer) |
| ,s, | Stack relative |
| (,s),y, | Stack relative Indirect Indexed (16-bit pointer) |
| Platform | Description | Format |
|---|---|---|
| Commodore 128 | Fill text screen with a given byte | TXT |
| Commodore 64 | Commodore 64 BASIC header | TXT |
| Kestrel 1r1 | Cold-boot and Vector Table | TXT |