-** Memory map: (average)
-| <loc> | <size> | <desc> |
-|---------+--------+-----------------------------|
-| 0 | ~4096 | core |
-| 1500000 | ~32000 | highlevel Fifth boot code |
-| 200000h | | core startup messages area |
-| 5200000 | | end of dynamic memory space |
-* Fifth source format
-Fifth uses a different character table and codes than ASCII (still
-almost similar). I call it FSCII (Fifth Standard Code for Information
-Interchange) for example space character is not 32 but 255 instead. I
-plan to use mainly HEX numbers, and create new characters to represent
-numeric values. So typical nemric characters "0123..." is treated
-like ordinary letters.
-** FSCII:
-
-| DEC | HEX | function |
-|--------+-------+----------------------------------------|
-| 0 - 15 | 0 - F | HEX numbers |
-| 252 | FC | backspace |
-| 253 | FD | tabulator (TAB) |
-| 254 | FE | carriage return (CR) |
-| 255 | FF | space |
-| else | | ordinary characters, same as in ASCII. |
+** 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
+
+KBD_@ ( -- code ) get scancodes for pressed keys from keyboard.
+KBD_down? ( key -- result ) check is key with specified scancode
+ currently pressed down.
+KBD_SC2FSCII ( code -- FSCII ) convert key scancode into FSCII code,
+ or in FSK (Fifth standard keycode).
+KBD_F@ ( -- FSCII ) read pressed key FSCII or FSK, returns -1 if no
+ keys are pressed.
+KBD_FW@ ( -- FSCII ) read pressed key FSCII or FSK, if no keys is
+ are pressed then waits until there is.
+
+ FSK
+ ---
+In HEX.
+
+FC backspace
+FD TAB
+FE enter
+FF space
+
+400 ESC
+401 ... F1 ...
+410 up
+411 right
+412 down
+413 left
+414 INS
+415 DEL
+416 home
+417 end
+418 PG/UP
+419 PG/DN
+#+END_VERSE
+** Mouse driver
+#+BEGIN_VERSE
+mousex var Mouse x coordinate.
+mousey var Mouse y coordinate.
+mousekeyl var Mouse left key.
+mousekeym var Mouse middle key.
+mousekeyr var Mouse right key.
+mousec var Display current mouse coordinates in top left part of screen,
+ if true. (good for debugging)
+mousepointer var Image buffer, holding current mouse pointer.
+mouseadd ( ModuleAddr x1 x2 y1 y2 -- ) Add specified area on screen,
+ into mause click buffer. If any mouse button is clicked on
+ that area, module at "ModuleAddr" will be executed.
+mousebe var Amount of buffer elements.
+mousedo ( -- ) Updates mouse coordinates and keys. Parse mouse
+ click buffer, and draw mouse cursor to "screen".
+#+END_VERSE
+** 2D graphic library
+
++ lineh ( color len x y imgbuf -- ) :: draws horisontal line from X,Y
+ coordinates to right, with specified length.
+
++ linev ( color len x y imgbuf -- ) :: draws vertical line down, from
+ coordinates X,Y, with specified length.
+
++ box ( color x2 x1 y2 y1 imgbuf -- ) :: draws rectangular box. x2
+ bust be >= x1, y2 must be >= y1.
+
+ #+begin_example
+ x1,y1-----------+
+ | |
+ | |
+ +-----------x2,y2
+ #+end_example
+
++ flipv ( imgbuf -- ) :: flip image vertically.
+
++ imgcoltrans ( ImgBuf Color ToColor -- ) :: Translate all pixels in
+ specified image with "Color" into "ToColor".
+
++ imgfill ( color x y imgbuf -- ) :: Fill image region starting at
+ 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.
+*** cos ( a -- result )
+Return cosinus from given angle. Parameters are like in [[id:9a66ca9c-eb5f-45aa-8116-71763081f2fb][sin]] function.