1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 05:08:05 +11:00

Forth-ify 2DUP 2OVER 2SWAP

2DROP was left in boot.z80 because it's used in icore.
This commit is contained in:
Virgil Dupras 2020-04-20 23:18:57 -04:00
parent 0438cb92fe
commit e569e40665
3 changed files with 11 additions and 48 deletions

Binary file not shown.

View File

@ -424,17 +424,6 @@ CODE (roll)
LDDR,
;CODE
( a b -- a b a b )
CODE 2DUP
HL POPqq, ( B )
DE POPqq, ( A )
chkPS,
DE PUSHqq, ( A )
HL PUSHqq, ( B )
DE PUSHqq, ( A )
HL PUSHqq, ( B )
;CODE
( a b -- )
CODE 2DROP
HL POPqq,
@ -442,36 +431,6 @@ CODE 2DROP
chkPS,
;CODE
( a b c d -- a b c d a b )
CODE 2OVER
HL POPqq, ( D )
DE POPqq, ( C )
BC POPqq, ( B )
EXX, HL POPqq, EXX, ( A )
chkPS,
EXX, HL PUSHqq, EXX, ( A )
BC PUSHqq, ( B )
DE PUSHqq, ( C )
HL PUSHqq, ( D )
EXX, HL PUSHqq, EXX, ( A )
BC PUSHqq, ( B )
;CODE
( a b c d -- c d a b )
CODE 2SWAP
HL POPqq, ( D )
DE POPqq, ( C )
BC POPqq, ( B )
EXX, HL POPqq, EXX, ( A )
chkPS,
DE PUSHqq, ( C )
HL PUSHqq, ( D )
EXX, HL PUSHqq, EXX, ( A )
BC PUSHqq, ( B )
;CODE
CODE AND
HL POPqq,
DE POPqq,

View File

@ -55,13 +55,6 @@
H@ 2- ( push a. -2 for allot offset )
; IMMEDIATE
: ROLL
DUP NOT IF EXIT THEN
1+ DUP PICK ( n val )
SWAP 2 * (roll) ( val )
SWAP DROP
;
( During a CASE, the stack grows by 1 at each ENDOF so that
we can fill all those ENDOF branching addrs. So that we
know when to stop, we put a 0 on PSP. That's our stopgap. )
@ -143,6 +136,17 @@
: LEAVE R> R> DROP I 1- >R >R ;
: ROLL
DUP NOT IF EXIT THEN
1+ DUP PICK ( n val )
SWAP 2 * (roll) ( val )
SWAP DROP
;
: 2DUP OVER OVER ;
: 2OVER 3 PICK 3 PICK ;
: 2SWAP 3 ROLL 3 ROLL ;
( a1 a2 u -- )
: MOVE
( u ) 0 DO