+++ /dev/null
- Math, memory & stack manipulation\r
- ---------------------------------\r
-\r
-\r
-off ( n -- ) writes 0 to given address, good for zeroing variable.\r
- ex: MyVariable off\r
-on ( n -- ) writes -1 (true flag) to given address.\r
- ex: MyVariable on\r
-\r
-2dup ( n1 n2 -- n1 n2 n1 n2 )\r
-2drop ( n1 n2 -- )\r
-nip ( n1 n2 -- n2 )\r
-neg ( n1 -- -n1 ) negotiate\r
-bit@ ( n bit -- result ) return specified bit from n.\r
- ex: 38 2 bit@ (result will be 1)\r
-to32bit ( n1 n2 n3 n4 -- n32 ) treat 4 last stack elements as bytes\r
- and unite them into 32 bit dword. Most significant byte\r
- on top.\r
- ex: 12 76 23 11 to32bit result: 186076172\r
-\r
-to8bit ( n32 -- n1 n2 n3 n4 ) break 32 bit number into 4 bytes.\r
- Useful if you need to send 32 bit numbers thru 8 bit COM\r
- port.\r
- ex: 186076172 to8bit result: 12 76 23 11\r
-\r
-mod ( n1 n2 -- reminder ) divide n1 by n2 and returns reminder.\r
- ex: 12 5 mod result: 2\r
-\r
-bound ( low n high -- n ) check if n is in given bounds,\r
- if not then incarease/decarease it to match bounds.\r
- ex: 5 80 15 bound result: 15\r
- 5 10 15 bound result: 10\r
- 5 -10 15 bound result: 5\r
-\r
-bound? ( low n high -- result ) returns true if n is in the\r
- given bounds.\r
-\r
-tab ( col -- spaces) calculate amount of spaces to add\r
- ta reach next tabulation from given column.\r
-\r
-count ( addr -- addr+1 n )\r
- Useful for returning bytes from constantly incareasing\r
- address. Module "type" is nice example.\r
-\r
-c, ( n -- )\r
- store one byte at memory specified by "h". And incarease\r
- "h" by 1.\r
-\r
-, ( n -- )\r
- store 32 bit number at memory specified by "h". And\r
- incarease "h" by 4.\r
-\r
-cmove ( addr1 addr2 n -- )\r
- copy "n" amount of bytes from memory at "addr1" to memory\r
- at "addr2".\r
-\r
-rnd ( limit -- result )\r
- generates random number in range 0 to "limit"-1.\r
-\r
-abs ( n -- |n| )\r
- returns absolute value of "n"\r