1 Math, memory & stack manipulation
\r
2 ---------------------------------
\r
5 off ( n -- ) writes 0 to given address, good for zeroing variable.
\r
7 on ( n -- ) writes -1 (true flag) to given address.
\r
10 2dup ( n1 n2 -- n1 n2 n1 n2 )
\r
13 neg ( n1 -- -n1 ) negotiate
\r
14 bit@ ( n bit -- result ) return specified bit from n.
\r
15 ex: 38 2 bit@ (result will be 1)
\r
16 to32bit ( n1 n2 n3 n4 -- n32 ) treat 4 last stack elements as bytes
\r
17 and unite them into 32 bit dword. Most significant byte
\r
19 ex: 12 76 23 11 to32bit result: 186076172
\r
21 to8bit ( n32 -- n1 n2 n3 n4 ) break 32 bit number into 4 bytes.
\r
22 Useful if you need to send 32 bit numbers thru 8 bit COM
\r
24 ex: 186076172 to8bit result: 12 76 23 11
\r
26 mod ( n1 n2 -- reminder ) divide n1 by n2 and returns reminder.
\r
27 ex: 12 5 mod result: 2
\r
29 bound ( low n high -- n ) check if n is in given bounds,
\r
30 if not then incarease/decarease it to match bounds.
\r
31 ex: 5 80 15 bound result: 15
\r
32 5 10 15 bound result: 10
\r
33 5 -10 15 bound result: 5
\r
35 bound? ( low n high -- result ) returns true if n is in the
\r
38 tab ( col -- spaces) calculate amount of spaces to add
\r
39 ta reach next tabulation from given column.
\r
41 count ( addr -- addr+1 n )
\r
42 Useful for returning bytes from constantly incareasing
\r
43 address. Module "type" is nice example.
\r
46 store one byte at memory specified by "h". And incarease
\r
50 store 32 bit number at memory specified by "h". And
\r
53 cmove ( addr1 addr2 n -- )
\r
54 copy "n" amount of bytes from memory at "addr1" to memory
\r
57 rnd ( limit -- result )
\r
58 generates random number in range 0 to "limit"-1.
\r
61 returns absolute value of "n"
\r