From 41d439376d113d9152a7abf7a0a0b0aa3ddedb8c Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 22 May 2020 14:03:12 -0400 Subject: [PATCH] Add word NIP --- blk/046 | 4 ++-- blk/047 | 3 ++- blk/108 | 2 +- blk/125 | 2 +- blk/364 | 1 + blk/366 | 2 +- blk/369 | 2 +- blk/370 | 3 +-- blk/569 | 2 +- blk/604 | 2 +- blk/634 | 2 +- emul/forth.bin | Bin 5916 -> 5923 bytes 12 files changed, 13 insertions(+), 12 deletions(-) diff --git a/blk/046 b/blk/046 index 9285ef2..e9b66cf 100644 --- a/blk/046 +++ b/blk/046 @@ -3,6 +3,7 @@ Parameter Stack DROP a -- DUP a -- a a ?DUP DUP if a is nonzero +NIP a b -- b OVER a b -- a b a ROT a b c -- b c a SWAP a b -- b a @@ -12,5 +13,4 @@ SWAP a b -- b a 2SWAP a b c d -- c d a b 'S Returns current stack pointer, not counting the push it's making right now. -S0 Returns address of PSP TOS. When PSP is empty, - 'S == S0 (cont.) + (cont.) diff --git a/blk/047 b/blk/047 index a3e7fa8..704b33e 100644 --- a/blk/047 +++ b/blk/047 @@ -1,4 +1,5 @@ -(cont.) +S0 Returns address of PSP TOS. When PSP is empty, + 'S == S0 PICK Pick nth item from stack. "0 PICK" = DUP, "1 PICK" = OVER. ROLL Rotate PSP over n items. "1 ROLL" = SWAP, diff --git a/blk/108 b/blk/108 index 32c3a85..d012920 100644 --- a/blk/108 +++ b/blk/108 @@ -7,7 +7,7 @@ SWAP OVER - ( ilen chars-to-move ) SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen ) 3 PICK MOVE- ( ctm ilen ) - SWAP DROP ( ilen ) + NIP ( ilen ) ELSE DROP ( ilen becomes rbuffsize ) THEN DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen ) diff --git a/blk/125 b/blk/125 index 7a2e7d2..04605b9 100644 --- a/blk/125 +++ b/blk/125 @@ -7,7 +7,7 @@ THEN ROT ( o a n ol ) < IF ( under limit, do nothing ) - SWAP DROP ( a ) + NIP ( a ) ELSE ( o a ) SWAP OVER @ ( a o n ) -^ ( a n-o ) diff --git a/blk/364 b/blk/364 index 865da53..a757bf8 100644 --- a/blk/364 +++ b/blk/364 @@ -12,3 +12,4 @@ IF OVER C@ OR ELSE 0xff XOR OVER C@ AND THEN ( addr flg ) SWAP C! ; +: NIP SWAP DROP ; diff --git a/blk/366 b/blk/366 index 39b5ee7..784528c 100644 --- a/blk/366 +++ b/blk/366 @@ -9,5 +9,5 @@ OVER ! 1+ C< ( a c ) OVER 0x2d ( 2e-1 for NULL ) RAM+ = OVER WS? OR UNTIL ( a c ) - SWAP DROP 0x0e RAM+ ( ws a ) + NIP 0x0e RAM+ ( ws a ) SWAP EOT? IF 4 OVER ! THEN ; diff --git a/blk/369 b/blk/369 index fa4735a..f6f6872 100644 --- a/blk/369 +++ b/blk/369 @@ -7,7 +7,7 @@ : IMMED? 1- C@ 0x80 AND ; : +! SWAP OVER @ + SWAP ! ; : -^ SWAP - ; -: / /MOD SWAP DROP ; +: / /MOD NIP ; : MOD /MOD DROP ; : ALLOT HERE +! ; : CREATE (entry) 11 ( 11 == cellWord ) C, ; diff --git a/blk/370 b/blk/370 index 9792015..2aad0d2 100644 --- a/blk/370 +++ b/blk/370 @@ -7,7 +7,6 @@ ?DUP NOT IF EXIT THEN 1+ DUP PICK ( n val ) SWAP 2 * (roll) ( val ) - SWAP DROP -; + NIP ; : 2OVER 3 PICK 3 PICK ; : 2SWAP 3 ROLL 3 ROLL ; diff --git a/blk/569 b/blk/569 index c629f23..dea7c07 100644 --- a/blk/569 +++ b/blk/569 @@ -8,5 +8,5 @@ ( gid dmask ) 0xff XOR ( dpos ) 0 ( dindex ) BEGIN 1+ 2DUP RSHIFT NOT UNTIL 1- - ( gid dpos dindex ) SWAP DROP + ( gid dpos dindex ) NIP ( gid dindex ) SWAP 8 * + ; diff --git a/blk/604 b/blk/604 index 5d7d0b8..95c82f8 100644 --- a/blk/604 +++ b/blk/604 @@ -8,7 +8,7 @@ 0 ( cnt ) BEGIN _idle - DUP 0xff = IF DROP ELSE SWAP DROP EXIT THEN + DUP 0xff = IF DROP ELSE NIP EXIT THEN 1+ DUP 20 = UNTIL DROP 0xff diff --git a/blk/634 b/blk/634 index a399ba9..1fc3e5d 100644 --- a/blk/634 +++ b/blk/634 @@ -4,5 +4,5 @@ CREATE _ '0' C, ':' C, 'A' C, '[' C, 'a' C, 0xff C, : _nxtcls _sel @ _ BEGIN ( c a ) C@+ 2 PICK > UNTIL ( c a ) - 1- C@ SWAP DROP _sel ! + 1- C@ NIP _sel ! ; diff --git a/emul/forth.bin b/emul/forth.bin index 44c1bea58e885c0dc37c3b5de1392ba1efb39372..5e93703422c4fe1cbc99b52087983a76d31b00d5 100644 GIT binary patch delta 1532 zcmX|BZ%kWN6hD3U7TfpQ`}+E5-88UAsr)Hg+!AXbDDc`Mw1t+oV>E;;I46GuW<(Q2 z5^ymZiJPxn!RUuM!8k`WOBS+E;<>NH5AWukbM86! zob&sgb0d5!?A%gpTXi;ozrS|=>ePC=GA{yQ5h)~@a3R+!^9RmX98a7+(kVG)9+v%O zA(@Kbgj`ws#Q8uPhChxUIt^ejWRIX>7-TSjLZ?(DCgh@-LNC82*V$J1ZMlXdVXVT001V_i<2{2wr39~Xzh_(E%kDFCW6CLc zgU+~%WRH&EX@Z$bRy~JqBkonwkKewnWH+HBbw1a53Uio2wTSwY+q&MS;q^yuDhZcB z*)WuWXuFV$@X8j9f~E%mK4pFB=?Dw>TqKkVbxF(u1r)$_zgsGhbPnu+pBy;eV!b$Bwtoz z)$8g86~Kf88eC<+s6jYn(1-Z#AG3e>ziOdwhwae>@p>r2&;-r@S0>Us#PnLj z2;C~_<#V1$W&lC)z$97p>@e|R`2N#YzF?aqYo0Za2^SeUh-l52G?msoNmX!cgRWz@ zR*3=PY6SIY;dZT|euvG&{o?|b6g%IY8Nvb$HG=*Qd?U26Izi7U{U}2RJ{-N6WS`7)dW(48A5tY#VxOz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