+--------------------------------+----------+----------------------------------+ | Word | Stack | Description | +================================+==========+==================================+ | . | '- | Read and discard the next 62 | | | | characters. This is used in | | | | blocks to provide line width | | | | comments. | | 0 | '- | Parse to end of line. Insert | | | | into text line 0 | | 1 | '- | Parse to end of line. Insert | | | | into text line 1 | | 2 | '- | Parse to end of line. Insert | | | | into text line 2 | | 3 | '- | Parse to end of line. Insert | | | | into text line 3 | | 4 | '- | Parse to end of line. Insert | | | | into text line 4 | | 5 | '- | Parse to end of line. Insert | | | | into text line 5 | | 6 | '- | Parse to end of line. Insert | | | | into text line 6 | | 7 | '- | Parse to end of line. Insert | | | | into text line 7 | | 8 | '- | Parse to end of line. Insert | | | | into text line 8 | | 9 | '- | Parse to end of line. Insert | | | | into text line 9 | | 10 | '- | Parse to end of line. Insert | | | | into text line 10 | | 11 | '- | Parse to end of line. Insert | | | | into text line 11 | | 12 | '- | Parse to end of line. Insert | | | | into text line 12 | | 13 | '- | Parse to end of line. Insert | | | | into text line 13 | | 14 | '- | Parse to end of line. Insert | | | | into text line 14 | | 15 | '- | Parse to end of line. Insert | | | | into text line 15 | | {{ | - | Begin a lexical scoped area. | | | | Starts the private portion. | | ---reveal--- | - | Within lexical scoped area, | | | | switch to global scope area. | | }} | - | Close off lexical scoped area. | | | | Hides words in the private area. | | ) | - | Ending for comments or visual | | | | grouping. Provided for | | | | readability purposes | | -eq? | nn-f | Compare values for inequality | | -if | fp- | Execute p if flag is zero | | ; | - | End a definition | | ?jump | fp- | Internal. If flag is non-zero, | | | | branch to p. | | Compiler | - | Data. Tracks compiler state | | Dictionary | - | Data. Pointer to most recent | | | | header in dictionary | | Free | - | Data. Pointer to next free addr | | I | -n | Access the loop index for the | | | | current loop. (For loops made | | | | using indexed-times) | | J | -n | Access the parent loop index for | | | | the current loop. (For loops | | | | made using indexed-times) | | K | -n | Access the grandparent loop | | | | index for the current loop. (For | | | | loops made using indexed-times) | | Sigils | - | Data. Table of sigil handlers | | [ | -p | Begin a quotation | | ] | p-p | End a quotation | | a:append | aa-a | Create a new array with the | | | | contents of a1 followed by a2 | | a:behead | a-a | Remove first item from an array | | a:chop | a-a | Remove last item from an array | | a:contains? | an-f | True if array contains n. False | | | | otherwise | | a:copy | ap- | Copy array a to memory starting | | | | at pointer p | | a:dup | a-a | Make a copy of an array | | a:eq? | aa-f | Compare two arrays for equality | | a:-eq? | aa-f | Compare two arrays for | | | | inequality | | a:fetch | an-v | Fetch value stored at index n in | | | | array | | a:filter | ap-a | Run p once for each value in a. | | | | If it returns true, copy value | | | | new array | | a:first | a-n | Return the first value in an | | | | array | | a:for-each | ap- | Run p once for each value in the | | | | array. Pushes each value prior | | | | to calling p | | a:hash | a-n | Return the hash of an array | | a:indices | av-a | Return array of indices for v in | | | | source array | | a:index | av-n | Return first index of n in a | | a:last | a-n | Return the last value in an | | | | array | | a:left | an-a | Return left n values from array | | a:length | a-n | Return the length of an array | | a:make | ...n-a | Create a new permanent array | | | | from the provided values | | a:make/temp | ...n-a | Create a new temporary array | | | | from the provided values | | a:map | ap-a | Run p once for each value in the | | | | array. Takes the returned value | | | | and creates a new array | | a:middle | afl-a | Return new array from f to l, | | | | inclusive | | a:prepend | aa-a | Create a new array with the | | | | contents of a2 followed by a1 | | a:reduce | anp-n | Takes an array, a starting | | | | value, and a quote. This will | | | | apply the quote to each item in | | | | the array; the quote should | | | | consume two values and return | | | | one | | a:reverse | a-a | Reverse the order of items in an | | | | array | | a:right | an-a | Return right n values from array | | a:store | van- | Store value v into array at | | | | index n | | a:temp | a-a | Make a copy of the array in the | | | | temporary string/array space | | a:th | an-p | Return the address of a specific | | | | index into the array | | allot | n- | Allocate n cells of memory | | and | nn-n | Perform a bitwise AND | | bi | xpp-? | Execute p1 against x, then p2 | | | | against a copy of x | | bi* | xypp- | Execute p1 against x and p2 | | | | against y | | bi@ | xyp- | Execute p against x, execute p | | | | against y | | block:load | np- | Read 1024 cells in block n to p | | block:save | np- | Save 1024 cells at p to block n | | block:buffer | -p | Return a pointer to the start of | | | | the block buffer | | bye | - | Exit RetroForth/ilo | | c:get | -c | Read a character from the | | | | keyboard | | c:lowercase? | c-f | Return true if character is | | | | lowercase or false if not | | c:put | c- | Display a single character | | c:to-lower | c-c | Convert character to lowercase | | c:to-s | c-s | Convert a character to a string | | c:to-upper | c-c | Convert character to uppercase | | c:uppercase? | c-f | Return true if character is | | | | uppercase or false if not | | call | p- | Call a function | | choose | fpp- | Execute p1 if flag is non-zero | | | | or p2 if zero. | | comma | n- | Inline a value to here and | | | | increment Free | | compare | sdn-f | Compare n cells of memory | | | | startng at s to memory starting | | | | at d. Return true if all match | | | | or false otherwise | | compiling? | -f | True if Compiler is set, False | | | | otherwise | | compile:lit | n- | Internal. Compile an ilo li | | | | instruction | | compile:call | p- | Internal. Compile an ilo lica | | | | instruction | | compile:jump | p- | Internal. Compile an ilo liju | | | | instruction | | copy | sdc- | Copy c cells starting at s to | | | | memory starting at d. Does not | | | | support overlapping regions | | curry | vp-p | Create a new quote pushing the | | | | value, then calling p1 | | d:address | d-p | Given a dictionary header, | | | | return a pointer to the address | | | | field | | d:create | s- | Create a new header | | d:exists? | s-f | Given a dictionary header, | | | | return a flag indicating whether | | | | or not the word exists | | d:flags | d-p | Given a dictionary header, | | | | return a pointer to the flags | | | | field | | d:hash | d-p | Given a dictionary header, | | | | return a pointer to the hash | | | | field | | d:link | d-p | Given a dictionary header, | | | | return a pointer to the link | | | | field | | d:lookup | s-d | Lookup a word in the dictionary. | | | | Returns zero if not found or the | | | | dictionary header address | | depths | -nm | Return depths of data and | | | | address stacks | | depth/data | -n | Return the depth of the data | | | | stack | | depth/address | -n | Return the depth of the address | | | | stack | | dip | np-n | Push n to address stack, call p. | | | | then restore n to data stack | | drop | n- | Discard top value on stack | | drop-pair | nn- | Discard top two values on stack | | dtc | - | Internal. Data following is a | | | | direct threaded address list | | dup | n-nn | Duplicate top value on stack | | dup-pair | nm-nmnm | Duplicate top two values | | e:Display | - | Data. Holds a pointer to a block | | | | display word. Called by edit. | | e:erase/line | n- | Erase line n in the block buffer | | e:insert | n'- | Erase line n, parse to end of | | | | line, insert into line n | | e:insert-at | lc'- | Parse to end of line. Insert | | | | text into line l at column c | | e:line | n- | Display a single line from the | | | | current block | | e:replace | ls- | Insert text s into line l | | e:replace-at | lcs- | Insert text s into line l at | | | | column c | | e:to-line | n-p | Return pointer to start of line | | | | in the block buffer | | edit | n- | Set Block to n. Load and display | | | | block | | eq? | nn-f | Compare values for equality | | fetch | p-n | Fetch a value stored at address | | fetch-next | a-an | Fetch a value stored at address | | | | Also returns the next address | | fill | vpn- | Fill n cells of memory starting | | | | at p with value v | | forever | p- | Run p repeatedly, in an unending | | | | loop | | gc | p- | Run function at pointer p. Saves | | | | and restores Free to recover any | | | | memory allocated during run | | gt? | nn-f | Compare values for n1 greater | | | | than n2 | | gteq? | nn-f | Compare two values for greater | | | | than or equality | | here | -a | Return the next free memory | | | | address | | if | fp- | Execute p if flag is non-zero | | indexed-times | np- | Run a quote the specified number | | | | of times, tracking the loop | | | | index in I | | internal:lit | -n | Internal. Push next value in | | | | memory to the stack | | internal:quote | -p | Internal. Skip over quote. Push | | | | address of quote to stack. | | interpret | s- | Interpret token | | io | ...n- | Trigger an I/O operation | | jump | p- | Internal. Jump to an address | | list* | - | Display the text in the block | | list# | - | Display the block with line | | | | numbers | | list | - | Display the block with line | | | | numbers and rules | | load | - | (re)Load the current block | | lt? | nn-f | Compare values for n1 less than | | | | n2 | | lteq? | nn-f | Compare two values for less than | | | | or equality | | n:abs | n-n | Return the absolute value of n | | n:add | nn-n | Add n1 to n2, returning n3 | | n:between? | nlu-f | True if n is between l and u, | | | | inclusive | | n:dec | n-n | Decrement n by 1 | | n:div | nn-n | Divine n1 by n2; get result | | n:divmod | nn-nn | Divide n1 by n2 and return the | | | | result and remainder | | n:inc | n-n | Increment n by 1 | | n:limit | nlu-n | Constrain n to between l and u, | | | | inclusive | | n:max | nn-n | Return the greater of two values | | n:min | nn-n | Return the lower of two values | | n:mod | nn-n | Divide n1 by n2; get remainder | | n:mul | nn-n | Multiply n1 by n2, returning n3 | | n:negate | n-n | Invert the sign of n | | n:put | n- | Display a number | | n:sub | nn-n | Subtract n2 from n1 | | n:to-s | n-s | Convert number to a temp string | | n:zero? | n-f | Compare n to zero. True if zero, | | | | false otherwise | | n:-zero? | n-f | Compare n to zero. True if not | | | | zero, false otherwise | | needs | s- | Run any blocks (in order found) | | | | with a title starting with s | | new | - | Erase the contents of the | | | | current block | | next | - | Switch to and load next block | | nip | xy-y | Discard second item on stack | | nl | - | Display a newline | | not | n-n | Perform a logical NOT operation | | or | nn-n | Perform a bitwise OR | | over | nm-nmn | Put a copy of NOS on top of | | | | stack | | pop | -n | Move top value on address stack | | | | to data stack | | prelude | - | Load & run blocks 1 & 2 if they | | | | appear to be code. Called by | | | | default `startup`. | | prev | - | Switch to and load previous | | | | block | | process-data | n-? | Internal. If compiling, compile | | | | value as a literal into the | | | | word. If interpreting, leave on | | | | the stack | | push | n- | Move TOS to the address stack | | restart | - | Reload the image and empty | | | | stacks | | rom:save | - | Save the current memory to disk | | | | (ilo.rom) | | rot | xyz-yzx | Rotate the top three values | | run | - | Run code in the currently loaded | | | | block | | s:append | ss-s | Append s2 to s1, returning new | | | | temporary string | | s:behead | s-s | Remove first item from a string | | s:chop | s-s | Remove last item from a string | | s:contains? | sc-f | True if string contains c. False | | | | otherwise | | s:copy | sd- | Copy string s to memory at d | | s:dup | s-s | Make a copy of string | | s:eq? | ss-f | Compare two strings for equality | | s:-eq? | ss-f | Compare two strings for | | | | inequality | | s:evaluate | s-? | Interpret each token in a string | | s:fetch | sn-c | Return character at index n in | | | | the string | | s:filter | sp-s | Run p once for each value in s | | | | If it returns true, copy value | | | | new string | | s:first | s-c | Return the first character in a | | | | string | | s:for-each | sp- | Run p once for each character in | | | | s. Pushes each character to the | | | | stack before calling p | | s:get/line | '-s | Read a line of input until enter | | | | is encountered. Return input as | | | | string | | s:get/token | -s | Read a string from the keyboard | | | | ending when a whitespace is | | | | encountered | | s:hash | s-n | Return the hash of the string | | s:index/c | sc-f | True if string contains c, false | | | | otherwise | | s:keep | s-s | Move string to here, allocating | | | | space and returning a pointer | | s:last | s-c | Return the last character in a | | | | string | | s:left | sn-s | Return left n characters of | | | | string | | s:length | s-n | Return the length of a string | | s:map | sp-s | Run p once for each value in the | | | | string. Takes the returned value | | | | and creates a new string | | s:middle | sfl-s | Return substring from f to l, | | | | inclusive | | s:prepend | ss-s | Create a new string with the | | | | contents of s2 followed by s1 | | s:put | s- | Display a string | | s:reverse | s-s | Reverse the order of values in | | | | the string. Returns a pointer to | | | | the new string | | s:rewrite | s-s | Replace underscores in string | | | | with spaces | | s:right | sn-s | Return right n characters of | | | | string | | s:store | csn- | Store character into string at | | | | index n | | s:temp | s-s | Put a copy of a string in the | | | | temporary buffers. Return a | | | | pointer to it | | s:th | sn-a | Given a string and index, return | | | | the address | | s:to-lower | s-s | Make all characters in string | | | | lowercase | | s:to-n | s-n | Convert a string to a number | | s:to-upper | s-s | Make all characters in a string | | | | uppercase | | s:trim | s-s | Trim both leading and trailing | | | | whitespace from a string | | s:trim-right | s-s | Trim trailing whitespace from a | | | | string | | s:trim-left | s-s | Trim leading whitespace from a | | | | string | | shift-left | nn-n | Shift n1 left by n2 bits | | shift-right | nn-n | Shift n1 right by n2 bits | | sigil:( | - | Sigil. Token is a comment | | sigil:# | s-n | Sigil. Token is a number | | sigil:& | s-a | Sigil. Token is a named pointer | | sigil:' | s-s | Sigil. Token is a string. | | sigil:: | s- | Sigil. Token is name of a new | | | | word to define | | sigil:$ | s-c | Sigil. Return first character of | | | | token | | sigil:get | c-p | Return the address of a sigil | | | | handler for character c | | sigil:set | pc- | Assign word at address to the | | | | sigil handler for character c | | sigil:@ | s-n | Sigil. Use to fetch value from a | | | | named variable | | sigil:! | ns- | Sigil. Use to store value into a | | | | named variable | | sigil:\ | as- | Sigil. Bind name s to function a | | sip | np-n | Push a copy of n to address then | | | | call p. Afterwards, restore to | | | | the data stack | | save | - | Save the current block | | set | n- | Set Block to n. Does not load or | | | | save the block | | sp | - | Display a space | | startup | - | Called on startup to prepare the | | | | system. You can replace this to | | | | have ilo start your application | | store | na- | Store n into address a | | store-next | na-a | Store n int address a, return | | | | address a + 1 | | swap | xy-yx | Exchange the top two stack items | | sys:buffers/block | - | Data. Points to the start of the | | | | block buffer. | | sys:buffers/loops | - | Data. Holds loop indices. | | sys:buffers/numeric-conversion | - | Data. Used by s:to-n. | | sys:buffers/scope | - | Data. Holds dictionary pointers | | | | for {{ ---reveal--- }} | | sys:buffers/needs | - | Data. Used by needs | | sys:buffers/reserved | - | Data. Reserved for future use. | | sys:buffers/strings+arrays | - | Data. Start of the temporary | | | | string & array pool. | | sys:buffers/input | - | Data. Holds the current input | | | | token. | | sys:info | - | Display system information | | tab | - | Display a tab | | times | np- | For n iterations, execute p | | titles | - | Display the block title lines. | | | | The output is paginated every 16 | | | | lines | | tri | xppp-? | Apply p1 against x, then p2 | | | | against a copy of x, and finally | | | | p3 against another copy of x | | tri* | xyzppp-? | Apply p1 against x, p2 against | | | | y, and p3 against z | | tri@ | xyzp-? | Apply p against x, then against | | | | y, and finally against z | | tuck | xy-yxy | Put a copy of TOS under NOS | | until | p- | Run a quote in a loop repeatedly | | | | The loop must return a flag. End | | | | loop when flag is not zero | | use | n- | Load and run a specific block | | | | numbered n | | using | nn- | Load and run blocks n1 thru n2 | | v:dec | a- | Decrement the value stored at | | | | address | | v:inc | a- | Increment the value stored at | | | | address | | var | s- | Create a variable with a value | | | | of zero | | var-n | ns- | Create a variable with a value | | | | of n | | while | p- | Run a quote in a loop repeatedly | | | | The loop must return a flag. End | | | | loop when flag is zero | | xor | nn-n | Perform a bitwise XOR | +--------------------------------+----------+----------------------------------+