mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-05 17:50:54 +11:00
705d68deec
With KEY and EMIT being switch words, most of the high layer can be defined before drivers. In addition to this change, I've compacted core blocks which were becoming quite sparse.
17 lines
385 B
Plaintext
17 lines
385 B
Plaintext
: _
|
|
999 SWAP ( stop indicator )
|
|
BEGIN
|
|
?DUP NOT IF EXIT THEN
|
|
10 /MOD ( r q )
|
|
SWAP '0' + SWAP ( d q )
|
|
AGAIN ;
|
|
: . ( n -- )
|
|
?DUP NOT IF '0' EMIT EXIT THEN ( 0 is a special case )
|
|
( handle negative )
|
|
DUP 0< IF '-' EMIT -1 * THEN
|
|
_
|
|
BEGIN
|
|
DUP '9' > IF DROP EXIT THEN ( stop indicator )
|
|
EMIT
|
|
AGAIN ;
|