1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-05 19:30:56 +11:00
collapseos/blk/432
Virgil Dupras f54b1dc504 Add 2>R and 2R>
This allows us to make DO..LOOP more compact.
2020-05-06 09:55:05 -04:00

17 lines
430 B
Plaintext

( Increase loop counter and returns whether we should loop. )
: _
R> ( IP, keep for later )
R> 1+ ( ip i+1 )
DUP >R ( ip i )
I' = ( ip f )
SWAP >R ( f )
;
( One could think that we should have a sub word to avoid all
these COMPILE, but we can't because otherwise it messes with
the RS )
: LOOP
COMPILE _ COMPILE (?br)
H@ - ,
COMPILE 2R> COMPILE 2DROP
; IMMEDIATE