Updated the readme regarding the new mechanics

This commit is contained in:
Luxferre
2025-04-30 11:09:34 +03:00
parent c4af5dec42
commit a35163c433
+3 -4
View File
@@ -472,10 +472,9 @@ are using it in case the target platform allows them to.
### How to do simple addition and simple multiplication, given only the FMA? ### How to do simple addition and simple multiplication, given only the FMA?
It might seem inconvenient at first, but the FMA operation is quite capable. It might seem inconvenient at first, but the FMA operation is quite capable.
First off, you already have a constant 0 always stored in 0, but it's advisable Remember that you already have a constant 0 always stored at the location 0 and
to store a constant 1 into some unused location, like 99. You can do this e.g. a constant 1 stored at the location 127. This will allow you to do any addition
with the `set 1 0 99` operation. Then, let's go with three cases (assuming we and multiplication combo separately even without the shortcut mnemonics:
have stored 1 into the data memory location 99):
1. Incrementing a memory location is as easy as `fma 127 127 [loc]`. 1. Incrementing a memory location is as easy as `fma 127 127 [loc]`.
2. Adding two numbers at loc1 and loc2 into loc2: `fma [loc1] 127 [loc2]`. 2. Adding two numbers at loc1 and loc2 into loc2: `fma [loc1] 127 [loc2]`.