From 31dd2ee7c8ccc4153e12a6cf3a5430736daf815f Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 4 Jan 2025 08:15:19 -0500 Subject: literal, postpone to forth and more --- core.fth | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core.fth') diff --git a/core.fth b/core.fth index c996d39..512334d 100644 --- a/core.fth +++ b/core.fth @@ -1,8 +1,7 @@ -: ['] ' postpone literal ; immediate - -\ : postpone _parse _get -\ dup cell+ @ 256 and if -\ >xt , else ['] _lit , >xt , ['] , , then ; immediate +: literal [ ' _lit dup , , ] , , ; immediate +: ['] ' [ ' literal , ] ; immediate +: postpone _parse _get dup cell+ @ 256 and if + >xt , else ['] _lit , >xt , ['] , , then ; immediate : _msb [ 1 cell 8 * 1- lshift ] literal ; : 2/ dup 1 rshift swap 0< if _msb or then ; @@ -17,13 +16,13 @@ : repeat _jmp , , if postpone then then ; immediate : until _jmp0 , , drop ; immediate -: do ['] literal , here 0 , ['] >r , postpone 2>r here ; immediate +: do ['] _lit , here 0 , ['] >r , postpone 2>r here ; immediate : unloop postpone 2r> ['] 2drop , ['] r> , ['] drop , ; immediate : leave postpone 2r> ['] 2drop , postpone exit ; immediate : +loop ['] r> , ['] 2dup , ['] + , postpone r@ ['] swap , ['] >r , ['] - , ['] 2dup , ['] + , ['] over , ['] xor , - ['] rot , ['] rot , ['] xor , ['] and , ['] literal , 0 , + ['] rot , ['] rot , ['] xor , ['] and , ['] _lit , 0 , ['] < , _jmp0 , , postpone unloop here 1 cells - swap ! ; immediate : loop postpone 2r> ['] 1+ , ['] 2dup , @@ -48,6 +47,7 @@ : space bl emit ; : spaces begin dup 0 > while space 1- repeat drop ; +: key >in @ 0< if 0 else tib @ >in @ + c@ 1 >in +! then ; : word 0 here c! begin \ bl key 2dup <> \ bl key <> over 0<> and while \ bl key -- cgit v1.2.3