mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-05 20:20:55 +11:00
b062a9092a
As I wrote in my "Clarify signed-ness" commit, "0 <" is broken. Also, made this unit a bit more compact. The RC2014 stage1 can really use some breathing room...
43 lines
607 B
Forth
43 lines
607 B
Forth
( Words useful for complex comparison operations )
|
|
|
|
: >= < NOT ;
|
|
: <= > NOT ;
|
|
: 0>= 0< NOT ;
|
|
|
|
( n1 -- n1 true )
|
|
: <>{ 1 ;
|
|
|
|
( n1 f -- f )
|
|
: <>} SWAP DROP ;
|
|
|
|
|
|
: _|&
|
|
( n1 n2 cell )
|
|
>R >R DUP R> R> ( n1 n1 n2 cell )
|
|
@ EXECUTE ( n1 f )
|
|
;
|
|
|
|
( n1 f n2 -- n1 f )
|
|
: _|
|
|
CREATE , DOES>
|
|
( n1 f n2 cell )
|
|
ROT IF 2DROP 1 EXIT THEN ( n1 true )
|
|
_|&
|
|
;
|
|
|
|
: _&
|
|
CREATE , DOES>
|
|
( n1 f n2 cell )
|
|
ROT NOT IF 2DROP 0 EXIT THEN ( n1 true )
|
|
_|&
|
|
;
|
|
|
|
( All words below have this signature:
|
|
n1 f n2 -- n1 f )
|
|
' = _| |=
|
|
' = _& &=
|
|
' > _| |>
|
|
' > _& &>
|
|
' < _| |<
|
|
' < _& &<
|