Tokens are generally split by whitespace.
A token has a type, or ‘colour’ based on its first character.
Char | Description |
---|---|
{ |
Comment. All text until the next
} is ignored. |
" |
String literal. This is included in the resultant binary literally. (e.g. “meow” puts the string “meow” in the output binary) |
# |
Hexadecimal literal. The amount of bytes included in the output binary is either 1, 2, or 4 based on length. Numbers are big-endian. (e.g. #00 outputs a byte, #0000 half a word, and #00000000 a full word) |
: |
Label definition |
@ |
32-bit reference to label
(e.g. pw @label ju would jump to the label defined
by :label ) |
^ |
8-bit relative reference to label
(e.g. pr ^label ju would jump to the label defined
by :label) |
! |
Macro definition. words that follow
are included in macro until ;
(e.g. !meow #0000 ; ) |
` |
Macro reference.
(e.g. meow (from above) will now output 2 bytes of
0s ) |
- |
Assembler built-in. these can take some amount of arguments. |
Without colour, it is treated as an instruction. See kmx20 for ISA documentation. Instructions can additionally have the following prefixes, which may affect the resulting opcode.
~
F flag (flip stack manipulations from data
<-> return stacks)$
K flag (keep lhs on rhs)-org #
Sets the origin for labels. The first -org
is the entry point of the output file. Output ROMs are inserted at
#100 in the CPU’s memory, so you should generally start a program
off with -org #0100.-res #
Reserves some bytes in the output binary.
Basically same as -org but relative to current address.-emb "
Embed a file into the output binary.-inc "
Include a file literally. Gets assembled
into the output binary.