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

Remove cmp

Not worth the complexity and space.
This commit is contained in:
Virgil Dupras 2020-05-02 19:57:56 -04:00
parent 0b3a328e65
commit 931c812394
11 changed files with 7 additions and 78 deletions

View File

@ -8,8 +8,8 @@ reference.
Contents Contents
4 DOES> 6 Compilation vs meta-comp. 4 DOES> 6 Compilation vs meta-comp.
8 I/O 11 Chained comparisons 8 I/O 14 Addressed devices
14 Addressed devices 18 Signed-ness 18 Signed-ness

16
blk/011
View File

@ -1,16 +0,0 @@
Chained comparisons
The unit "cmp.fs" contains words to facilitate chained
comparisons with a single reference number. This allows, for
example, to easily express "a == b or a == c" or "a > b and a <
c".
The way those chained comparison words work is that, unlike
single comparison operators, they don't have a "n1 n2 -- f"
signature, but rather a "n1 f n2 -- n1 f" signature. That is,
each operator "carries over" the reference number in addition
to the latest flag.
(cont.)

16
blk/012
View File

@ -1,16 +0,0 @@
(cont.) You open a chain with "<>{" and you close a chain with
"<>}". Then, in between those words, you can chain operators.
For example, to check whether A == B or A == C, you would
write:
A <>{ B &= C |= <>}
The first operator must be of the "&" type because the chain
starts with its flag to true. For example, "<>{ <>}" yields
true.
To check whether A is in between B and C inclusively, you would
write:
A <>{ B 1 - &> C 1 + &< <>}

View File

@ -2,7 +2,7 @@
: ASKIP ( a -- a+n ) : ASKIP ( a -- a+n )
DUP @ ( a n ) DUP @ ( a n )
( ?br or br or NUMBER ) ( ?br or br or NUMBER )
DUP <>{ 0x67 &= 0x53 |= 0x20 |= 0x24 |= <>} DUP 0x67 = OVER 0x53 = OR OVER 0x20 = OR OVER 0x24 = OR
IF DROP 4 + EXIT THEN IF DROP 4 + EXIT THEN
( regular word ) ( regular word )
0x22 = NOT IF 2+ EXIT THEN 0x22 = NOT IF 2+ EXIT THEN

View File

@ -1,7 +1,7 @@
: RLWORD ( ol o a1 a2 -- ) : RLWORD ( ol o a1 a2 -- )
SWAP DUP C@ ( ol o a2 a1 n ) SWAP DUP C@ ( ol o a2 a1 n )
DUP <>{ 0x0e &= 0x2b |= <>} NOT IF ( unwind all args ) DUP 0x0e = OVER 0x2b = OR NOT IF
2DROP 2DROP EXIT THEN ( unwind all args ) 2DROP 2DROP EXIT THEN
0x2b = IF 2+ THEN ( ol o a2 a1 ) 0x2b = IF 2+ THEN ( ol o a2 a1 )
1+ ( ol o a2 a1+1 ) 1+ ( ol o a2 a1+1 )
BEGIN ( ol o a2 a1 ) BEGIN ( ol o a2 a1 )

10
blk/438
View File

@ -1,13 +1,3 @@
( Words useful for complex comparison operations )
: >= < NOT ; : >= < NOT ;
: <= > NOT ; : <= > NOT ;
: 0>= 0< NOT ; : 0>= 0< NOT ;
( n1 -- n1 true )
: <>{ 1 ;
( n1 f -- f )
: <>} SWAP DROP ;

14
blk/439
View File

@ -1,15 +1 @@
: _|&
( 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 )
_|&
;

15
blk/440
View File

@ -1,15 +0,0 @@
: _&
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 )
' = _| |=
' = _& &=
' > _| |>
' > _& &>
' < _| |<
' < _& &<

View File

@ -8,7 +8,7 @@
DROP DROP
8 0 DO 8 0 DO
C@+ C@+
DUP <>{ 0x20 &< 0x7e |> <>} DUP 0x20 < OVER 0x7e > OR
IF DROP '.' THEN IF DROP '.' THEN
EMIT EMIT
LOOP LOOP

Binary file not shown.

View File

@ -23,7 +23,7 @@ H@ 256 /MOD 2 PC! 2 PC!
(entry) _ (entry) _
( Update LATEST ) ( Update LATEST )
PC ORG @ 8 + ! PC ORG @ 8 + !
422 441 XPACKR ( core cmp ) 422 441 XPACKR ( core )
446 452 XPACKR ( parse ) 446 452 XPACKR ( parse )
358 360 XPACKR ( acia.fs ) 358 360 XPACKR ( acia.fs )
442 445 XPACKR ( print ) 442 445 XPACKR ( print )