1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 18:08:06 +11:00

forth: add word "2DROP"

This commit is contained in:
Virgil Dupras 2020-03-30 13:54:46 -04:00
parent 8186511727
commit 49994f09ce
4 changed files with 9 additions and 2 deletions

Binary file not shown.

View File

@ -100,6 +100,7 @@ DUP a -- a a
OVER a b -- a b a OVER a b -- a b a
ROT a b c -- b c a ROT a b c -- b c a
SWAP a b -- b a SWAP a b -- b a
2DROP a a --
2DUP a b -- a b a b 2DUP a b -- a b a b
2OVER a b c d -- a b c d a b 2OVER a b c d -- a b c d a b
2SWAP a b c d -- c d a b 2SWAP a b c d -- c d a b

View File

@ -74,7 +74,7 @@
_c DUP ( a a ) _c DUP ( a a )
_c C@ ( a c ) _c C@ ( a c )
( exit if null ) ( exit if null )
_c DUP NOT IF DROP DROP EXIT THEN _c DUP NOT IF _c 2DROP EXIT THEN
_c EMIT ( a ) _c EMIT ( a )
1 _c + ( a+1 ) 1 _c + ( a+1 )
AGAIN AGAIN
@ -121,7 +121,7 @@
UNTIL UNTIL
( a this point, PS is: a WS ) ( a this point, PS is: a WS )
( null-termination is already written ) ( null-termination is already written )
DROP DROP _c 2DROP
[ JTBL 30 + @ LITN ] [ JTBL 30 + @ LITN ]
; ;

View File

@ -69,6 +69,12 @@ CODE 2DUP
HL PUSHqq, ( B ) HL PUSHqq, ( B )
;CODE ;CODE
( a b -- )
CODE 2DROP
HL POPqq,
HL POPqq,
;CODE
( a b c d -- a b c d a b ) ( a b c d -- a b c d a b )
CODE 2OVER CODE 2OVER