implemented spec change: now cell 127 always return 1

This commit is contained in:
Luxferre
2025-04-30 11:04:43 +03:00
parent 0a3361f8ab
commit c4af5dec42
7 changed files with 37 additions and 30 deletions
+7 -5
View File
@@ -14,8 +14,8 @@ programs and data. The only available data type is a floating point number,
although some implementations may use fixed point numbers instead.
Unlike 808UL, mu808 strictly defines support of up to 16384 data cells and
up to 16383 program steps, with the program step 0 being unavailable and the
data cell 0 always returning 0.
up to 16383 program steps, with the program step 0 being unavailable, the
data cell 0 always returning 0 and the data cell 127 always returning 1.
On the machine start, both memory areas are initialized with zeroes and the
interactive mode is entered which accepts instructions from the platform's
@@ -27,7 +27,8 @@ standard input.
* ability to enter integer commands (positive and negative) into program memory;
* ability to enter floating (or fixed) point numbers (positive and negative) at
program runtime;
* immutability of the data address 0 (must always return 0 when accessed).
* immutability of the data address 0 (must always return 0 when accessed);
* immutability of the data address 127 (must always return 1 when accessed).
The following things are implementation-dependent:
@@ -191,6 +192,7 @@ The shortcut mnemonics for other operations are as follows:
* `dca` is a shortcut to `cpy 0` (direct constant assignment)
* `dva` is a shortcut to `cpy 1` (direct value assignment)
* `iva` is a shortcut to `cpy 2` (indirect value assignment)
* `inc` is a shortcut to `fma 127 127` (increment)
* `mul` is a shortcut to `fma 0` (multiplication)
* `exp` is a shortcut to `nel 0` (natural exponent)
* `log` is a shortcut to `nel 1` (natural logarithm)
@@ -475,8 +477,8 @@ to store a constant 1 into some unused location, like 99. You can do this e.g.
with the `set 1 0 99` operation. Then, let's go with three cases (assuming we
have stored 1 into the data memory location 99):
1. Incrementing a memory location is as easy as `fma 99 99 [loc]`.
2. Adding two numbers at loc1 and loc2 into loc2: `fma [loc1] 99 [loc2]`.
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]`.
3. Multiplying two numbers at loc1 and loc2 into loc2: `fma 0 [loc1] [loc2]`.
The only inconvenience with the FMA operation is that you need to sacrifice one