CORE words: String, Console and Numeric conversion


Strings

Name Stack Effect Summary Token
CHAR+  ( x -- x+1 ) add chararacter size to TOS xt = 0x6E
."  ( <string> -- ) compile a string to type xt = 0xF7
IMMEDIATE
S"  ( <string> -- ) compile string, returns a,len xt = 0xF9
IMMEDIATE
C"  ( <string> -- ) compile string, returns addr xt = 0xF8
IMMEDIATE
,"  ( -- ) copy string to dictionary xt = 0xCF
Lay a counted incoming string to the dictionary.
FILL  ( a n c -- ) fill array a with n chars of c xt = 0xA1
BLANK  ( a n -- ) fill array with blanks xt = 0xBB
ERASE  ( a n -- ) fill array with zeros xt = 0xBA
COUNT  ( a -- a' c ) get length of a counted string xt = 0x70
/STRING  ( addr len n -- addr' len' ) index into the string by n xt = 0xA2
Returns addr+n and len-n, n>=0
MOVE  ( asrc adest n -- ) move string of n chars xt = 0xA0
CHARS  ( x1 -- x2 ) multiply by character size xt = 0x6F
-SCAN  ( a n1 c -- a n2 ) remove trailing characters xt = 0xB5
SCAN  ( a1 n1 c1 -- a2 n2 ) scan string for character xt = 0xB7
SKIP  ( a1 n1 c -- a2 n2 ) skip leading characters until c xt = 0xB8
COMP  ( a1 a2 n1 -- f1 ) string compare a1 a2 len xt = 0xB6

Console output

Name Stack Effect Summary Token
CLS  ( -- ) clear screen xt = 0x1BB
_CLS  ( -- ) clears virtual console screen xt = 0x1B6
( x -- ) display signed to output device xt = 0xD4
SPACE  ( -- ) emit a blank xt = 0xCC
SPACES  ( x -- ) emit blanks xt = 0xCD
CR  ( -- ) new line on the console xt = 0xC3
EMIT  ( char -- ) output a character xt = 0xC0
$TYPE  ( $addr -- ) output a counted string xt = 0x1BF
TYPE  ( addr len -- ) output a string xt = 0xC1
EMITS  ( n char -- ) output repeated characters xt = 0xC2
_EMIT  ( c -- ) output to the virtual console xt = 0x1B7
CON$  ( -- a ) raw buffer for virtual console xt = 0x1B5
[string]
PAD$  ( -- a ) scratchpad/conversion area xt = 0x1BE
[string] 84-byte minimum
TYPE.  ( addr len -- ) type string and space xt = 0xCE
VCON$  ( -- a len ) virtual console output data xt = 0x1BD

Numeric conversion

Name Stack Effect Summary Token
NUMPAD  ( -- addr ) -> numeric conversion area xt = 0xC4
PAD  ( -- addr ) address of scratchpad area xt = 0xC5
(UD.)  ( ud -- a len ) convert unsigned double to string xt = 0xD2
DIGIT  ( char base -- n f ) convert ASCII to digit xt = 0x1A4
>DIGIT  ( n -- c ) convert digit to ASCII xt = 0x19C
( ud1 -- ud2 ) convert one digit xt = 0xC8
#S  ( ud -- 0 ) convert remaining digits xt = 0xC9
(D.)  ( d -- a len ) convert signed double to string xt = 0xD3
(.)  ( n -- a len ) convert signed to string xt = 0xD1
>NUMBER  ( ud addr len -- ud' addr' len' ) convert string to a number xt = 0x1C9
(U.)  ( u -- a len ) convert unsigned to string xt = 0xD0
#>  ( ud -- addr len ) finish pictured numeric output xt = 0xCB
HOLD  ( char -- ) insert character into number xt = 0xC7
SIGN  ( x -- ) insert minus sign if n<0 xt = 0xCA
HLD  ( -- a ) pointer for numeric conversion xt = 0x1B9
[cell]
BASE  ( -- a ) radix for number conversion xt = 0x1B8
[cell] 2..36 is valid
(.R)  ( n width -- a len ) signed to string right justify xt = 0x1C0
<#  ( -- ) start pictured numeric output xt = 0xC6
(U.R)  ( n width -- a len ) unsigned to string rt justify xt = 0x1C1
DECIMAL  ( -- ) use base 10 for numeric output xt = 0x1C7
HEX  ( -- ) use base 16 for numeric output xt = 0x1C6