diff options
Diffstat (limited to 'core.fth')
-rw-r--r-- | core.fth | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -1,10 +1,5 @@ - : ['] ' postpone literal ; immediate -: if ['] _jmp0 , here 0 , ; immediate -: then here swap ! ; immediate -: else ['] _jmp , here 0 , swap here swap ! ; immediate - \ : postpone _parse _get \ dup cell+ @ 256 and if \ >xt , else ['] _lit , >xt , ['] , , then ; immediate @@ -19,8 +14,8 @@ : begin 0 here ; immediate : while swap 1+ swap postpone if -rot ; immediate -: repeat ['] _jmp , , if postpone then then ; immediate -: until ['] _jmp0 , , drop ; immediate +: repeat _jmp , , if postpone then then ; immediate +: until _jmp0 , , drop ; immediate : do ['] literal , here 0 , ['] >r , postpone 2>r here ; immediate : unloop postpone 2r> ['] 2drop , ['] r> , ['] drop , ; immediate @@ -29,10 +24,10 @@ postpone r@ ['] swap , ['] >r , ['] - , ['] 2dup , ['] + , ['] over , ['] xor , ['] rot , ['] rot , ['] xor , ['] and , ['] literal , 0 , - ['] < , ['] _jmp0 , , + ['] < , _jmp0 , , postpone unloop here 1 cells - swap ! ; immediate : loop postpone 2r> ['] 1+ , ['] 2dup , - postpone 2>r ['] = , ['] _jmp0 , , + postpone 2>r ['] = , _jmp0 , , postpone unloop here 1 cells - swap ! ; immediate : i postpone r@ ; immediate : j postpone 2r> ['] r> , postpone r@ ['] swap , @@ -42,7 +37,7 @@ : >body [ 2 cells ] literal + @ ; : _does> latest dup cell+ @ [ 5 cells ] literal + + - ['] _jmp over ! cell+ ! ; + _jmp over ! cell+ ! ; : does> here 4 cells + postpone literal ['] _does> , 0 , ; immediate @@ -64,7 +59,7 @@ : char 0 here char+ c! bl word char+ c@ ; : [char] char postpone literal ; immediate -: s" state @ if ['] _jmp , here 0 , then +: s" state @ if _jmp , here 0 , then [char] " word count state @ 0<> if dup cell+ allot @@ -75,7 +70,7 @@ : ( begin [char] ) key = until ; immediate -: execute [ here 3 cells + ] literal ! [ ' _jmp , 0 , ] ; +: execute [ here 3 cells + ] literal ! [ _jmp , 0 , ] ; : move dup 0 <= if drop 2drop exit then >r 2dup < r> swap if @@ -87,7 +82,7 @@ >r 2dup c! char+ r> 1- repeat 2drop drop ; -: source tib 0 begin 2dup + c@ while 1+ repeat ; +: source tib @ 0 begin 2dup + c@ while 1+ repeat ; : find dup count _get dup if nip dup >xt swap cell+ @ 256 and if 1 else -1 then then ; |