Update README to include extra features
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone Build is passing

This commit is contained in:
DataHoarder 2021-08-04 01:49:40 +02:00
parent bee4b1ce70
commit a643903a4b

View file

@ -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 <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.
* `.bitfield REGISTER.Field <bitShift> [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.