From a643903a4befdb8091e2c4c57b3fb519c4d06745 Mon Sep 17 00:00:00 2001 From: WeebDataHoarder <57538841+weebdatahoarder@users.noreply.github.com> Date: Wed, 4 Aug 2021 01:49:40 +0200 Subject: [PATCH] Update README to include extra features --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e767491..33361e3 100644 --- a/README.md +++ b/README.md @@ -13,18 +13,51 @@ NOTE: **This is a Work In Progress project** * `$ mkdir build && cd build` * `$ cmake ../ && make` * An executable named `./rrc-as` should now exist. +* Feel free to move the executable to your desired installation directory, resources have been embedded. ## rrc-as -Assembler and linker, kind-of 2-Pass. Quite loose token syntax defined in [Token.h](src/Token.h). +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 [N=1] / PUSH , [..., Vn]`, `POP [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 `, `FASTCALL [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 , , `: Now registers allowed in all operands, with offsets. + * `MOV , , [...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 , `: implemented via `a ^ b = a + b - (a & b) - (a & b)` in four native instructions. TODO: handle offsets. + * `NOT , `: 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 `: Multiply two integers. Implemented with shift + add multiplication. + * `std_divide `: 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. + * `.bitfield REGISTER.Field [bitSize]` ### Usage -* `$ ./rrc-as code.asm [code2.asm ...] output.bin` +* `$ rrc-as version` +* `$ rrc-as code.asm [code2.asm ...] output.bin` * The function named `entrypoint` will be called by init asm * Multiple asm files can be specified. They are interpreted from first in arguments to last. -* You can call functions across files, as they will be linked together. +* You can call functions across files, as they will be linked together when used. * Directive resolution occurs at parsing time, so while you can override values it does not affect previously parsed files. -* Directives like `.constant` are passed to the next files. +* Directives like `.constant`, `.reserve`, `.bitfield`, etc. are passed to the next files. * These files will be automatically included in front every time: * *[asm/registers.asm](asm/registers.asm)*: Base named registers for platform. * *[asm/config.asm](asm/config.asm)*: Contains user-configurable parameters. @@ -32,6 +65,9 @@ Assembler and linker, kind-of 2-Pass. Quite loose token syntax defined in [Token * *[asm/stdlib.asm](asm/stdlib.asm)*: Standard library and other miscellaneous utilities. * *[asm/init.asm](asm/init.asm)*: Sets up some required registers and other config. +### Usage example +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. + ## License * BSD-3-Clause * See [COPYING](COPYING) for the full license.