area. Directory is just a file that list other files.
* Core architecture
+
Fifth core is simply some amount of already compiled into machine code
and linked together modules (entries in other words). In compilation
process modules is compiled one by one and simply stored on top of
modules, variables etc. and they locations in core. Constants use
dictionary space only. Random word can be removed from dictionary at
any time. Currently dictionary can contain at most 1000 entries.
+
** Dictionary entry format
| offset | length | description |
|--------+--------+-----------------------|
Core headers as linked list of module names make up something like
dictionary. When some entry address is needed compiler can quickly
run through headers backwards and find needed entry.
+
** Possible module types
+
| type | description | "execute" action |
|------+----------------+----------------------------|
| 0 | data | compile "num" instruction |
| | | with address to module |
|------+----------------+----------------------------|
| 2 | imm. submodule | immediately call to module |
+
** Memory map
+
| location | size | description |
|----------+--------+-----------------------------|
| 0 | ~4096 | core |
| 1500000 | ~32000 | highlevel Fifth boot code |
| 200000h | | core startup messages area |
| 5200000 | | end of dynamic memory space |
+
* Dynamically loadable modules
** Keyboard driver
#+BEGIN_VERSE
location X & Y with specified color.
** Trigonometry functions
+
+
*** sin ( a -- result )
:PROPERTIES:
:ID: 9a66ca9c-eb5f-45aa-8116-71763081f2fb
:END:
-Return sinus from given angle "a", 360ø is 2000. So 1000 represents
-180ø angle. Result will be in range -10'000 to 10'000, instead of ñ1.
+
+Return sine of angle "a", where the:
+
+- Input is scaled such that: 360 degrees = 2000 units (i.e., 1 unit =
+ 0.18 degrees).
+
+- The output is scaled to a 16-bit integer range of -10000 to 10000,
+ where ±10000 represents ±1.0 in floating-point terms.
+
+This fixed-point representation allows efficient computation using
+precomputed lookup tables, avoiding floating-point operations which
+are not supported by the virtual CPU's integer-only instruction
+set. The lookup table provides fast, sine values within the system's
+precision.
+
*** cos ( a -- result )
-Return cosinus from given angle. Parameters are like in [[id:9a66ca9c-eb5f-45aa-8116-71763081f2fb][sin]] function.
+
+Return cosine of angle "a", using the same scaling and fixed-point
+representation as the [[id:9a66ca9c-eb5f-45aa-8116-71763081f2fb][sin]] function. Input angles are scaled (360° =
+2000 units), and outputs range from -10000 to 10000. Precomputed
+values in a lookup table ensure high performance for trigonometric
+calculations.