|
||
ALPHANUMERIC WORD DEFINITIONS- SYNTAX: : cccc . ; COMPILING: Used in a form called a colon-definition. Creates a dictionary entry defining cccc as equivalent to the following sequence of Forth word definitions "." until the next ; or ;CODE . The compiling process is done by the text interpreter as long as STATE is non-zero. Other details are that the CONTEXT vocabulary is set to the CURRENT vocabulary and that words with the precedence bit set are executed rather than being compiled. - Terminate a colon definition and stop further compilation. Compiles the run-time word ;S .
- SYNTAX: COMPILING: Stop compilation and terminate a new defining word cccc by compiling ;CODE . Assemble to machine code the following mnemonics. EXECUTING: When cccc later executes in the form: cccc nnnn . the word nnnn will be created with its execution procedure given by the machine code following cccc . That is, when nnnn is executed, it does so by jumping to the code after nnnn . An existing defining word such as CREATE must exist in cccc prior to ;CODE .
- Stop interpretation of a screen. ;S is also the run-time word compiled at the end of a colon definition which returns execution to the calling procedure (same as Brodie's EXIT ). n1 n2 - f Leave a true flag if n1 is less than n2 ; otherwise leave a false flag.
- Set up for pictured numeric output formatting using the words <# # #S SIGN #> . The conversion is done on a double number producing text in memory just below PAD .
- b Waits for a byte to be received on serial input SIN1 at pin a25. At power-up (KEY) is vectored to execute <(KEY)> . See (KEY) KEY 'KEY and EMIT .
n1 n2 - f Flag f is 1 if n1 and n2 are unequal, and 0 otherwise. Opposite of = .
- f Checks whether the last character received on serial port SIN1 was ctrl+C (03) or not. If it was then f=1, otherwise f=0. The same happens on serial data overrun, or if a framing error occurs, so that the BREAK key of a dumb terminal will work. At power-up the action of ?TERMINAL is to execute <?TERMINAL> . See EMIT .
- SYNTAX: COMPILING: Used within a colon definition. EXECUTING: Each time cccc is executed, <BUILDS defines a new word with a high level execution procedure. Executing cccc in the form cccc nnnn uses <BUILDS to create a dictionary entry for nnnn with a call to the DOES> part for nnnn. When nnnn is later executed, it has the address of its parameter area on the stack and executes the words after DOES> in cccc . <BUILDS and DOES> allow run-time procedures to be written in high level rather than in assembler code (as required by ;CODE ).
b - Send byte to serial output SOUT1 at pin c25. At power-up EMIT is vectored to execute this word. See EMIT .
addr count - Transfer characters from the terminal to memory area starting at addr until a return or the count of characters have been received. Backspaces are handled. Three nulls are added at the end of the text. Serial Port 1 is the default input at power-up but this can be re-vectored using '(KEY) . <EXPECT> is the default action of EXPECT . Since EXPECT is vectored through 'EXPECT its action can be changed.
- This is the outer text interpreter which sequentially executes or compiles text from the input stream (terminal or screens) depending on STATE . If the word name cannot be found after a search of CONTEXT and then CURRENT vocabularies it is converted to a number according to the current base. That also failing, an error message echoing the name with ? - UNDEFINED is given. Text input is taken according to the convention for WORD . <INTERPRET> is the default action of INTERPRET . Since INTERPRET is vectored through 'INTERPRET its action can be changed.
addr - d Convert a character string at address addr to a signed double number, using the current numeric base. The string is assumed to have a preceding count at addr itself and this is ignored. The string should have at least one trailing space. If a decimal point is encountered in the text, its position will be given in DPL , but no other effect occurs. If numeric conversion is not possible then the error message ? - UNDEFINED is given. This word is the default action of NUMBER . Since NUMBER is vectored through 'NUMBER its action can be changed.
c n - Puts character c at position n on LCD. E.g. 65 2 < PUT> will place the character A (ASCII value 65) at the third from the left position on the LCD (as with other Forth counts, the left position is 0). Usually <PUT> is not used directly. At power-up PUT is vectored to <PUT> through the user variable 'PUT . The word PUT can be used as the primitive to write to the LCD. See PUT 'PUT and AT .
addr blk f - The standard linkage to the RAM mass memory on the TDS9092. addr specifies the source or destination block buffer, blk is the sequential number of the referenced block or screen; and f is a flag with f=0 for write and f=1 for read. <R/W> determines the location in the RAM and performs the read-write and error-checking. On power up R/W is vectored to execute <R/W> through the user variable 'R/W and R/W is the word used by higher level functions like BLOCK . The action of BLOCK can be changed by re-vectoring R/W to a user defined word instead of <R/W> . E.g. : R/W .(new action) ; ' R/W CFA 'R/W ! n1 n2 - f Leave a true flag if n1=n2, otherwise leave a false flag. n1 n2 - f Leave a true flag if n1 is greater than n2, otherwise leave a false flag.
n1 - n2 Swaps the top and bottom bytes of n1 to form n2. Useful for input/output with byte-wide ports. E.g. get a number on the stack from two bytes input on Port 6: HEX 0017 C@ >< 0017 C@ + (Port 6 is at address hex 0017).
n - day month year Converts the number of days n since 1st Jan 1984 to three numbers representing the equivalent date. Account is taken of leap-years. Valid to the year 2073. DMY> does the reverse.
n - Remove a number from the parameter stack and place it on the return stack. Use should normally be balanced by >R in the same definition.
d - secs mins hrs Converts a double number representing 'ticks' since midnight to the equivalent seconds, minutes and hours as three items on the stack. Usually used after @TIME . addr - Display the value contained at the address according to the current base. A trailing blank is also displayed.
- Issue error message ? - COMP. ONLY if not compiling.
- Issue error message ? - INCOMPLETE if stack position differs from value saved in user variable CSP .
f n - Issue error message number n if the boolean flag is true.
- Issue error message ? - EXEC. ONLY if not executing.
n - Gives an error message ? - DICT FULL if there are not n bytes left in the dictionary.
- Issue error message ? - LOADG ONLY if not loading (compiling from screen).
n1 n2 - Issue an error message ? - NOT PAIRED if n1 does not equal n2.
- Issue an error message ? - FULL STACK or ? - EMPTY STK if stack is out of bounds. On the TDS9092 the stack is 260 bytes.
- f On power-up ?TERMINAL checks if the last character received was ctrl+C (03) or if there is any serial error flag. If so, flag f is true, otherwise false (0). It is vectored to execute <?TERMINAL> but its function can be changed. See EMIT .
- u Used in a colon definition to provide the time u in microseconds taken by the words since 0TIME in the same definition. There is a maximum of 53333�s and a longer delay should either be broken into parts or it should be measured by reading the on-board clock in ticks, mins and days before and after the event. E.g. : TEST 1000 2000 0TIME U* ?TIME U. 2DROP ; Execution of TEST shows the time in microseconds taken by U* . addr - n Leave the 16-bit content n of address addr.
- n Gives the number of days since 1st January 1984. This date is day 0 and this is the date set at power-up.
- d Gives the number of 'ticks' since midnight, or power-up if time has not been set. A 'tick' is 53.333ms and there are exactly 1125 in a minute. See TICKS for detail. A double number is returned. Useful for measuring time between two events. Take the time at beginning and end, then subtract. |