diff options
Diffstat (limited to 'forth')
-rw-r--r-- | forth/core.fth | 11 | ||||
-rw-r--r-- | forth/tools.fth | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/forth/core.fth b/forth/core.fth index d198583..ff4c18f 100644 --- a/forth/core.fth +++ b/forth/core.fth @@ -99,10 +99,6 @@ : j postpone 2r> ['] r> , postpone r@ ['] swap , ['] >r , ['] -rot , postpone 2>r ; imm -: aligned dup [ 1 cells 1- ] literal swap over & if [ 1 cells ] literal - swap - + else drop then ; -: align here dup aligned swap - allot ; - : and & ; : or | ; : xor ^ ; @@ -114,6 +110,9 @@ : _msb [ 1 1 cells 8 * 1- << ] literal ; : 2/ dup 1 >> swap 0< if _msb or then ; +: aligned [ 1 cells 1- ] literal swap over + swap invert and ; +: align here dup aligned swap - allot ; + : /mod 2dup % -rot / ; : */ >r m* r> _/ ; : sm/rem >r 2dup r@ _% -rot r> _/ ; @@ -221,8 +220,8 @@ dup _isdigit - _uma r> char+ r> 1- repeat ; -: <# 40 here c! ; -: #> 2drop here dup c@ + 40 here c@ - ; +: <# [ 20 cells ] literal here c! ; +: #> 2drop here dup c@ + [ 20 cells ] literal here c@ - ; : hold -1 here +! here dup c@ + c! ; : # base @ >r 0 i um/mod r> swap >r um/mod r> diff --git a/forth/tools.fth b/forth/tools.fth index b27955d..3cee2bf 100644 --- a/forth/tools.fth +++ b/forth/tools.fth @@ -6,8 +6,8 @@ : words _latest @ begin dup @ dup 31 & 2 pick cell+ \ lt l len ws - 2 pick 6 >> 1023 < if \ lt l len ws - rot 6 >> else \ lt len ws adv + 2 pick 7 >> 1023 < if \ lt l len ws + rot 7 >> else \ lt len ws adv >r cell+ rot drop r> @ then -rot swap type space \ lt adv over _begin <> while - repeat 2drop ; |