mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-17 10:08:05 +11:00
bd38d80f9c
and renamed it "Core words". Also, reworded the presentation.
17 lines
468 B
Plaintext
17 lines
468 B
Plaintext
: (parseb) ( a -- n f )
|
|
( '0': ASCII 0x30 'b': 0x62 0x6230: 25136 )
|
|
DUP @ 25136 = NOT IF 0 EXIT THEN ( a 0 )
|
|
( We have "0b" prefix )
|
|
2+
|
|
0 ( a r )
|
|
BEGIN
|
|
SWAP C@+ ( r a+1 c )
|
|
DUP NOT IF 2DROP 1 EXIT THEN ( r 1 )
|
|
_ ( r a n )
|
|
DUP 0< IF ROT 2DROP 0 EXIT THEN ( a 0 )
|
|
ROT 2 * + ( a r*2+n )
|
|
AGAIN
|
|
;
|
|
|
|
|