1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-14 18:08:05 +11:00
collapseos/blk/355
Virgil Dupras bd38d80f9c Move Cross-compiled core from B390 to B350
and renamed it "Core words". Also, reworded the presentation.
2020-05-15 22:44:49 -04:00

15 lines
423 B
Plaintext

( r c -- r f )
( Parse digit c and accumulate into result r.
Flag f is 0 when c was a valid digit, 1 when c was WS,
-1 when c was an invalid digit. )
: _pdacc
DUP 0x21 < IF DROP 1 EXIT THEN
( parse char )
( if bad, return "r -1" )
'0' -
DUP 10 < NOT IF DROP -1 EXIT THEN
( good, add to running result )
SWAP 10 * + ( r*10+n )
0 ( good )
;