Assembler and linker, kind-of 2-Pass. Quite loose token syntax defined in [Token.h](src/Token.h). A quite-more-than-working educational implementation.
Contains extensions to original FM10000 Instruction set. Here are some of them:
* **Automatic selection of Immediate/Register instructions**: No need to hardcode them, best pick will be selected.
* **Call Stack, Frame & Stack pointers**: You have full access to a stack, POP/PUSH/GET/PUT and more!
*`PUSH <R> [N=1] / PUSH <V>, [..., Vn]`, `POP <R> [N=1]`, `POPI [N=1]`, `POPP (to be deprecated)`: Add/remove from stack.
*`GET`, `PUT`: In-place stack data handling.
* Uses `BSM_ADDR_OFFSET[2]` as frame pointer.
* Uses `BSM_ADDR_OFFSET[3]` as stack pointer.
* **Call/FastCall system**: For easy calling of other functions, and passing/returning values.
*`CALL <LOC>`, `FASTCALL <LOC> [P1, P2, ..., Pn]`
*`RET [V]`
* Uses stack system.
* **Scratch reservation system**: Statically allocate scratch space and assert other code does not use it.
* **Aliases / Offsets / shifts in-place**: Stop hardcoding all your parameters!
* **Shorthand aliases for instructions**: For directly using AND / ADD / BEQ / BNE and more.
*`ADD`, `OR`, `AND`, `SUB`, `SHL`, `SHR`, `SAR`
*`BNE`, `BEQ`, `PNE`, `PEQ`
* **Extended instructions virtually**: Some instructions did not allow registers on them.
*`SET <R>, <V>, <M>`: Now registers allowed in all operands, with offsets.
*`MOV <R>, <V>, [...Vn]`: Automatically select between WRITE and COPY depending on operands. Allows multi-word.
* TODO: branch instructions to allow registers.
* **New virtual instructions**: Several new mathematical and bitwise operations added:
*`XOR <R>, <A, <B>`: implemented via `a ^ b = a + b - (a & b) - (a & b)` in four native instructions. TODO: handle offsets.
*`NOT <R>, <A>`: implemented via `~a = 0xFFFFFFFF - a` in one or three native instructions, depending on offsets.
* **Basic stdlib functions**: Adds some must-have complex operations, and other quality of life ones.
*`std_multiply <A> <B>`: Multiply two integers. Implemented with shift + add multiplication.
*`std_divide <A> <B>`: Divide two integers, get quotient and remainder. Implemented with shift + add division.
* Definition of standard value return registers.
* Definition of standard ephemeral registers.
* **Bitfield creation**: Parametrized bitfield shifts and mask creation.
Check out the [rrc-open-firmware](https://git.gammaspectra.live/FM10K/rrc-open-firmware) project for an in-depth look at the assembly and usage. Do note it uses its own rrcc tagged version.