From bb190f96655903ab4115e96303f4a865c662056b Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 22 May 2020 14:17:38 -0400 Subject: [PATCH] Add word TUCK --- blk/046 | 4 ++-- blk/107 | 2 +- blk/108 | 2 +- blk/125 | 2 +- blk/144 | 2 +- blk/354 | 5 +++-- blk/364 | 1 - blk/369 | 2 +- blk/371 | 2 +- emul/forth.bin | Bin 5923 -> 5929 bytes 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/blk/046 b/blk/046 index e9b66cf..8903d97 100644 --- a/blk/046 +++ b/blk/046 @@ -7,10 +7,10 @@ NIP a b -- b OVER a b -- a b a ROT a b c -- b c a SWAP a b -- b a +TUCK a b -- b a b 2DROP a a -- 2DUP a b -- a b a b 2OVER a b c d -- a b c d a b 2SWAP a b c d -- c d a b 'S Returns current stack pointer, not counting the - push it's making right now. - (cont.) + push it's making right now. (cont.) diff --git a/blk/107 b/blk/107 index a099d36..5b1d157 100644 --- a/blk/107 +++ b/blk/107 @@ -3,7 +3,7 @@ BEGIN C@+ ROT ( a2+1 c2 a1 ) C@+ ROT ( a2+1 a1+1 c1 c2 ) = NOT IF DROP FBUF THEN - SWAP OVER C@ 0xd = ( a1 a2 f1 ) + TUCK C@ 0xd = ( a1 a2 f1 ) OVER BLK) = OR ( a1 a2 f1|f2 ) UNTIL DUP BLK) < IF BLK( - FBUF + -^ EDPOS ! THEN diff --git a/blk/108 b/blk/108 index d012920..c6b50f7 100644 --- a/blk/108 +++ b/blk/108 @@ -4,7 +4,7 @@ EDPOS @ 64 MOD 63 -^ ; : _I IBUF _type _rbufsz IBUF _blen 2DUP > IF - SWAP OVER - ( ilen chars-to-move ) + TUCK - ( ilen chars-to-move ) SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen ) 3 PICK MOVE- ( ctm ilen ) NIP ( ilen ) diff --git a/blk/125 b/blk/125 index 04605b9..645b2b9 100644 --- a/blk/125 +++ b/blk/125 @@ -9,7 +9,7 @@ < IF ( under limit, do nothing ) NIP ( a ) ELSE ( o a ) - SWAP OVER @ ( a o n ) + TUCK @ ( a o n ) -^ ( a n-o ) OVER ! ( a ) THEN diff --git a/blk/144 b/blk/144 index 87dfb5c..d633ed7 100644 --- a/blk/144 +++ b/blk/144 @@ -3,7 +3,7 @@ : AMOVE ( u ) 0 DO SWAP DUP I + A@ ( dst src x ) - ROT SWAP OVER I + ( src dst x dst ) + ROT TUCK I + ( src dst x dst ) A! ( src dst ) LOOP 2DROP diff --git a/blk/354 b/blk/354 index 99faa9c..b08e2fc 100644 --- a/blk/354 +++ b/blk/354 @@ -6,7 +6,8 @@ : =><= 2 PICK >= ( n l f ) ROT ROT >= AND ; : MIN ( n n - n ) 2DUP > IF SWAP THEN DROP ; : MAX ( n n - n ) 2DUP < IF SWAP THEN DROP ; +: NIP SWAP DROP ; : TUCK SWAP OVER ; : C@+ ( a -- a+1 c ) DUP C@ SWAP 1+ SWAP ; -: C!+ ( c a -- a+1 ) SWAP OVER C! 1+ ; +: C!+ ( c a -- a+1 ) TUCK C! 1+ ; : C@- ( a -- a-1 c ) DUP C@ SWAP 1- SWAP ; -: C!- ( c a -- a-1 ) SWAP OVER C! 1- ; +: C!- ( c a -- a-1 ) TUCK C! 1- ; diff --git a/blk/364 b/blk/364 index a757bf8..865da53 100644 --- a/blk/364 +++ b/blk/364 @@ -12,4 +12,3 @@ IF OVER C@ OR ELSE 0xff XOR OVER C@ AND THEN ( addr flg ) SWAP C! ; -: NIP SWAP DROP ; diff --git a/blk/369 b/blk/369 index f6f6872..70e7d75 100644 --- a/blk/369 +++ b/blk/369 @@ -5,7 +5,7 @@ CURRENT @ 1- DUP C@ 128 OR SWAP C! ; : IMMED? 1- C@ 0x80 AND ; -: +! SWAP OVER @ + SWAP ! ; +: +! TUCK @ + SWAP ! ; : -^ SWAP - ; : / /MOD NIP ; : MOD /MOD DROP ; diff --git a/blk/371 b/blk/371 index 0523223..7180b9b 100644 --- a/blk/371 +++ b/blk/371 @@ -4,7 +4,7 @@ ROT C!+ ( a1+1 a2+1 ) LOOP 2DROP ; : MOVE- ( a1 a2 u -- ) - SWAP OVER + 1- ( a1 u a2+u-1 ) + TUCK + 1- ( a1 u a2+u-1 ) ROT 2 PICK + 1- ( u a2+u-1 a1+u-1 ) ROT ( u ) 0 DO ( a2 a1 ) C@- ( a2 a1-1 x ) diff --git a/emul/forth.bin b/emul/forth.bin index 5e93703422c4fe1cbc99b52087983a76d31b00d5..ed9b81420c95d18e0f4a8f4ca456d7b36d1becc6 100644 GIT binary patch delta 2167 zcmZ8iTTB#J82)F@>}7U#XLfd33bo*}AeTk3Hg=Pxq?LgspbN`hfHqVqq7qtM4cG^t zSZKBBL$iisn!eOD&_qm=Hcd$r9}E$brWR8kC5^Rd1GE}rqEOm2CiMSjL=zuo=A8e2 z{br{Aa=mmxMfu zqfMM*hWTEVvT~akggWGh>}_a)bl0|)?Uqi&)Nnx%gR->J&0TLLeQ0z$emkaRzzqM| zRT!Ri&DkPil+D>@ZPP5u^74#KXL474EPHzNOieX7)Qsx}f8a8Xui2+r7;8rCy2BcX z*qtbz_c%dNvuxRpbx5>Oqq2;gG{xhIj2mp~ge|IIi&C+sOw5A?*l-0w0V+yQQ>wkm zh{yckR40`nh%m}OQ$p^HYr$qf6&b$9e^8?0vYiX=%D3;M41@beo@R68Q#wnA4b)>FsNx*L?6iX?vN zp1=}(!hdpy19=RxInkNUG<9aG%pmjfZ(R123K?GQd0#lsFM4*4k18S8yp;1yv1KWX zZv%|@!LnT#Ue+_s4&$>TSbPIow-8~ODGm^Rm_{qyfvq+o9D?b-s-`q_Gy)x0qL%0>TM9GYl$bd5}}2k)ONE+ zYLZ{nUP{tL2O$K{LZ6Y-a1R~E+cTk^@F8l3ATQ5r^AfebKBU8>`ny&Ek5sC1laWYe zkakY}8)^U9@?7zztC!Se=>RM8lIVX-cf~ zQoXolNzK6@Tm4v)mhO(O0W46Z7BOW=lUlkek-dBT9sQNqq#nk3s2o zaZI0L=9&#>kBrp>kUp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