diff --git a/blk/409 b/blk/409 new file mode 100644 index 0000000..abb2c23 --- /dev/null +++ b/blk/409 @@ -0,0 +1,16 @@ +( Words here until the end of the low part, unlike words + preceeding them, aren't immediately needed for boot. But its + better to have as many words as possible in the xcomp part. ) +: H@ HERE @ ; +: IMMEDIATE + CURRENT @ 1- + DUP C@ 128 OR SWAP C! ; +: IMMED? 1- C@ 0x80 AND ; +: +! SWAP OVER @ + SWAP ! ; +: -^ SWAP - ; +: / /MOD SWAP DROP ; +: MOD /MOD DROP ; +: ALLOT HERE +! ; +: CREATE (entry) 11 ( 11 == cellWord ) C, ; +: VARIABLE CREATE 2 ALLOT ; +: LEAVE R> R> DROP I 1- >R >R ; diff --git a/blk/410 b/blk/410 new file mode 100644 index 0000000..6e8981c --- /dev/null +++ b/blk/410 @@ -0,0 +1,13 @@ +: '? WORD (find) ; +: ' + '? (?br) [ 4 , ] EXIT + LIT< (wnf) (find) DROP EXECUTE +; +: ROLL + DUP NOT IF EXIT THEN + 1+ DUP PICK ( n val ) + SWAP 2 * (roll) ( val ) + SWAP DROP +; +: 2OVER 3 PICK 3 PICK ; +: 2SWAP 3 ROLL 3 ROLL ; diff --git a/blk/414 b/blk/411 similarity index 100% rename from blk/414 rename to blk/411 diff --git a/blk/412 b/blk/412 index abb2c23..3cb48b4 100644 --- a/blk/412 +++ b/blk/412 @@ -1,16 +1,13 @@ -( Words here until the end of the low part, unlike words - preceeding them, aren't immediately needed for boot. But its - better to have as many words as possible in the xcomp part. ) -: H@ HERE @ ; -: IMMEDIATE - CURRENT @ 1- - DUP C@ 128 OR SWAP C! ; -: IMMED? 1- C@ 0x80 AND ; -: +! SWAP OVER @ + SWAP ! ; -: -^ SWAP - ; -: / /MOD SWAP DROP ; -: MOD /MOD DROP ; -: ALLOT HERE +! ; -: CREATE (entry) 11 ( 11 == cellWord ) C, ; -: VARIABLE CREATE 2 ALLOT ; -: LEAVE R> R> DROP I 1- >R >R ; +: WORD( + DUP 1- C@ ( name len field ) + 127 AND ( 0x7f. remove IMMEDIATE flag ) + 3 + ( fixed header len ) + - +; +: FORGET + ' DUP ( w w ) + ( HERE must be at the end of prev's word, that is, at the + beginning of w. ) + WORD( HERE ! ( w ) + PREV CURRENT ! +; diff --git a/blk/413 b/blk/413 index 6e8981c..6bad060 100644 --- a/blk/413 +++ b/blk/413 @@ -1,13 +1,15 @@ -: '? WORD (find) ; -: ' - '? (?br) [ 4 , ] EXIT - LIT< (wnf) (find) DROP EXECUTE +: DOES> + ( Overwrite cellWord in CURRENT ) + ( 43 == doesWord ) + 43 CURRENT @ C! + ( When we have a DOES>, we forcefully place HERE to 4 + bytes after CURRENT. This allows a DOES word to use "," + and "C," without messing everything up. ) + CURRENT @ 3 + HERE ! + ( HERE points to where we should write R> ) + R> , + ( We're done. Because we've popped RS, we'll exit parent + definition ) ; -: ROLL - DUP NOT IF EXIT THEN - 1+ DUP PICK ( n val ) - SWAP 2 * (roll) ( val ) - SWAP DROP -; -: 2OVER 3 PICK 3 PICK ; -: 2SWAP 3 ROLL 3 ROLL ; +: CONSTANT CREATE , DOES> @ ; + diff --git a/blk/415 b/blk/415 deleted file mode 100644 index 3cb48b4..0000000 --- a/blk/415 +++ /dev/null @@ -1,13 +0,0 @@ -: WORD( - DUP 1- C@ ( name len field ) - 127 AND ( 0x7f. remove IMMEDIATE flag ) - 3 + ( fixed header len ) - - -; -: FORGET - ' DUP ( w w ) - ( HERE must be at the end of prev's word, that is, at the - beginning of w. ) - WORD( HERE ! ( w ) - PREV CURRENT ! -; diff --git a/blk/444 b/blk/444 deleted file mode 100644 index 6bad060..0000000 --- a/blk/444 +++ /dev/null @@ -1,15 +0,0 @@ -: DOES> - ( Overwrite cellWord in CURRENT ) - ( 43 == doesWord ) - 43 CURRENT @ C! - ( When we have a DOES>, we forcefully place HERE to 4 - bytes after CURRENT. This allows a DOES word to use "," - and "C," without messing everything up. ) - CURRENT @ 3 + HERE ! - ( HERE points to where we should write R> ) - R> , - ( We're done. Because we've popped RS, we'll exit parent - definition ) -; -: CONSTANT CREATE , DOES> @ ; - diff --git a/emul/forth.bin b/emul/forth.bin index 15ab266..5c34ad7 100644 Binary files a/emul/forth.bin and b/emul/forth.bin differ