REPL character substitution now working again.
[forth.jl.git] / src / lib_10_misc.4th
1 \ Miscellaneous undefined core words
2
3 : ROLL ( x_u x_u-1... x_0 u -- x_u-1 ... x_0 x_u )
4         1+ DUP PICK SWAP    ( x_u x_u-1 ... x_0 x_u u+1 )
5         PSP@ 1- SWAP - PSP@ 2- SWAP
6         DO
7             i 1+ @ i !
8         LOOP
9         SWAP DROP
10 ;
11
12 ( Compute absolute value. )
13 : ABS           ( n -- |n| )
14         dup 0< if
15                 negate
16         then
17 ;
18
19 : MAX           ( n m -- max )
20         2dup - 0< if
21                 swap drop
22         else
23                 drop
24         then
25 ;
26
27 ( Stractch pad. )
28 : PAD           ( -- addr )
29         HERE 340 + ;
30
31 : UNUSED  ( -- cells )
32         MEMSIZE HERE - ;