assembler/¶
p8xasm.py — the P8X two-pass assembler.
It shares its opcode table with the microcode generator: mnemonics and encodings
come straight from genucode.OPC, so the assembler and the hardware can never
disagree about what an opcode means. (Edit the instruction set in
../microcode/genucode.py, not here.)
Usage¶
python3 p8xasm.py src.asm [-o out.bin] [-l listing.txt] [--base ADDR] [-D NAME=VAL ...]
- No
--base→ an 8 KB ROM image (origin$0000,$0000–$1FFF), ready for the memory-card EEPROM. This is how the monitor (program ROM) is built. --base A→ a RAM-resident blob: labels resolve to run addressA, and only theA..highbytes are emitted. This is how P8X/OS and disk BASIC are assembled to load somewhere other than$0000.-D NAME=VAL→ define an assembly-time symbol (used to parameterize BASIC viaBASORG/BASRAM, for example).-l→ write a listing file (address + bytes + source per line).
Directives¶
.org,.byte,.word,.fill,.ascii,.asciiz,.equ.include "file"→ splice another source file at this point (recursively; path resolved relative to the including file; cycles are an error). Lets sources share a committed equates file — e.g. the generatedmemmap.inc— so a memory-map constant lives in one place instead of being copied into firmware, the OS, andp8xcc.
Notes¶
- Two passes: pass 1 builds the symbol table, pass 2 emits bytes.
;starts a comment even inside a quoted string — avoid;in.asciistrings.
See GLOSSARY.md for mnemonics and the programmer's guide for the full instruction set.