mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 12:18:07 +11:00
Add word NIP
This commit is contained in:
parent
f75b1c8864
commit
41d439376d
4
blk/046
4
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.)
|
||||
|
3
blk/047
3
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,
|
||||
|
2
blk/108
2
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 )
|
||||
|
2
blk/125
2
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 )
|
||||
|
1
blk/364
1
blk/364
@ -12,3 +12,4 @@
|
||||
IF OVER C@ OR
|
||||
ELSE 0xff XOR OVER C@ AND THEN ( addr flg )
|
||||
SWAP C! ;
|
||||
: NIP SWAP DROP ;
|
||||
|
2
blk/366
2
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 ;
|
||||
|
2
blk/369
2
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, ;
|
||||
|
3
blk/370
3
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 ;
|
||||
|
2
blk/569
2
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 * + ;
|
||||
|
2
blk/604
2
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
|
||||
|
2
blk/634
2
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 !
|
||||
;
|
||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user