Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Forth word list
! to /STRING
Live website search
Enter key words
 

ALPHANUMERIC WORD DEFINITIONS

 

!                    ANS

 

x aa -

 

Store x at aligned address aa.

 

!CSP

 

-

 

Saves the stack position in CSP . Used as part of the compiler security.

 

!ODD

 

x ca -

 

Store x to any address ca.

 

"x

 

- char

 

The set of words "A "B "e ") etc. The ASCII value of the second character is left on the stack. This is more convenient and gives better documentation than using the number equivalent. E.g.

: TEST "A . ;

TEST gives 65 (decimal). These words can be used both in and out of definitions. See also ^x .

 

#                    ANS

 

ud1 - ud2

 

SYNTAX: <# # # # # #>

Divide ud1 by the number in BASE giving the quotient ud2 and the remainder n, the least significant digit of ud1. Convert n to ASCII and add the resulting character to the beginning of the pictured numeric output string. Must be used within a <# . #> structure.

 

##

 

-

 

SYNTAX: 34 ## R3 MOVI,

Assembler word. Used before an assembly mnemonic to indicate immediate data. Use just after the data. The example loads number 34 to R3. Use only in a CODE definition.

 

#>                    ANS

 

xd - ca u

 

Drop xd. Make the pictured output available as string ca u present in RAM memory.

 

#LCD

 

- aa

 

An LCD user variable preset to 0 at power-up. The number (0 to 7) in #LCD indicates which one of 8 address pairs in the range 81C0 to 81CE will be used for LCD writing words such as PUT and LCDEMIT . This enables up to 8 LCDs to be driven, provided a 3 to 8 line decoder is added externally to further decode LCD chip select line CS81C0.

 

#S                    ANS

 

ud1 - ud2

 

Convert one digit of ud1 according to the rule for. Continue conversion until the quotient is zero. Must be used within a <# . #> structure.

 

#TIB                    ANS

 

- aa

 

aa is the address of a cell containing the number of characters in the terminal input buffer.

 

$xxxx  $xxx $xx  $x

 

- n

 

These are 4 sets of words for indicating hex numbers irrespective of the current BASE . E.g.

DECIMAL $F .  gives 15

$FF .         gives 127

$1000 .       gives 4096

$FFFF .       gives -1

These words enable the easy mixture of decimal and hex constants in definitions:

DECIMAL : TEST 78 $FF00 C! ;

This puts the decimal number 78 to hex address FF00. A more cumbersome alternative is:

: TEST

 [ DECIMAL ] 78 [ HEX ] FF00

 C! ;

 

'                     ANS

 

'name' - xt

 

Parse name delimited by space. Find name in dictionary and return xt, the execution token for name. The execution token returned by the compiled phrase ['] xxx is the same value returned by ' xxx outside the compilation state. See also ['] .

 

'?NUMBER

 

- aa

 

A user variable, aa is the address of a cell containing the execution token to be executed when ?NUMBER is invoked. ?NUMBER can be 'vectored', i.e. given different actions, by putting the execution token of the appropriate word into '?NUMBER . See ?NUMBER <?NUMBER> .

 

'ACCEPT

 

- aa

 

A user variable, aa is the address of a cell containing the execution token to be executed when ACCEPT is invoked. ACCEPT can be 'vectored', i.e. given different actions, by putting the execution token of the appropriate word into 'ACCEPT . See ACCEPT <ACCEPT> .

 

'EMIT

 

- aa

 

A user variable. aa is the address of a cell containing the execution token to be executed when EMIT is invoked. EMIT can be 'vectored', i.e. given different actions, by putting the execution token of the appropriate word into 'EMIT . E.g.

: DEFAULT

 ['] <EMIT> 'EMIT ! ;

DEFAULT would restore EMIT to its power-up action. See EMIT <EMIT> .

 

'ERROR

 

- aa

 

A user variable. aa is the address of a cell containing the execution token to be executed when ERROR is invoked. ERROR can be 'vectored', i.e. given different actions, by putting the execution token of the appropriate word into 'ERROR . See ERROR <ERROR> .

 

'KEY

 

- aa

 

A user variable. aa is the address of a cell containing the execution token to be executed when KEY is invoked. KEY can be 'vectored', i.e. given different actions, by putting the execution token of the appropriate word into 'KEY . For example:

: DEFAULT ['] <KEY> 'KEY ! ;

DEFAULT would restore KEY to its power-up action. See KEY <KEY> .

 

'KEY?

 

- aa

 

A user variable. aa is the address of a cell containing the execution token to be executed when KEY? is invoked. KEY? can be 'vectored', i.e. given different actions, by putting the execution token of the appropriate word into 'KEY? .

For example:

: DEFAULT

 ['] <KEY?> 'KEY? ! ;

DEFAULT would restore KEY? to its power-up action. See KEY? <KEY?> .

 

'PUT

 

- addr

 

An LCD user variable vectoring PUT . The address addr contains the execution token of the word which will actually execute when PUT is called. On the TDS2020F by default at power-up this is <PUT> . It can be changed to point to any alternative user defined word which takes the same stack conditions as PUT . E.g. for LM020L

: PUT DUP 7 >

   IF $38 + THEN

   $80 + AWAIT LCD PC!

   AWAIT LCDDATA PC! ;

: INIT ['] PUT 'PUT ! ;

After INIT the word PUT will use this special version instead of the default <PUT> . See AT PUT .

 

'SOURCE

 

- aa

 

A user variable. aa is the address of a cell containing the execution token to be executed when SOURCE is invoked. SOURCE can be 'vectored', i.e. given different actions, by putting the execution token of the appropriate word into 'SOURCE . See SOURCE <SOURCE> .

 

(                     ANS

 

COMPILATION:

Perform the execution action shown below. Used to embed comments in source code.

 

EXECUTION:   'ccc<paren>' -

Parse string ccc delimited by a right parenthesis and discard it.

 

(DATE)

 

n - ca 8

 

Convert day number n to displayable date string of length 8 at address ca. Day numbers start from zero at 1 Jan 1984. If the word USA has been executed the string will be in the form 12.25.01 otherwise as 25.12.01.

 

(TIME)

 

d - ca 8

 

A double number representing the 'ticks' since midnight is converted into a displayable time string of 8 characters at address ca. This format is suitable for use by TYPE . The string is in the form XX.YY.ZZ where XX is the hour (0-23), YY minutes and ZZ seconds.

 

))

 

n -

 

SYNTAX: $FF00 )) R3 MOVI,

Assembler word. Assembles the direct address n.

 

*                    ANS

 

n1 n2 - n1*n2

 

Leave the signed product of two signed numbers on the stack.

 

*/                    ANS

 

n1 n2 n3 - n4

 

Leave the ratio n4 = n1*n2/n3 where all are signed numbers. Use of an intermediate 31-bit product permits greater accuracy than would be available with n1 n2 * n3 /

 

*/MOD                    ANS

 

n1 n2 n3 - n4 n5

 

Leave the quotient n5 and remainder n4 of the operation n1*n2/n3. A 31-bit intermediate product is used as for */ .

 

+                    ANS

 

n1 n2 - n3   or

u1 u2 - u3

 

Add n2 or u2 to n1 or u1 giving the sum n3 or u3.

 

+!                    ANS

 

n aa - or

u aa -

 

Add n or u to the 16-bit number at aligned address aa.

 

+LOOP                    ANS

 

SYNTAX:

: ccc . DO . n1 +LOOP . ;

 

COMPILATION:   3 -

Append the run-time action below to the current definition. Resolve the destination of all unresolved occurrences of LEAVE since the previous DO , so that they execute the words after the +LOOP .

 

EXECUTION:   n -

R:  n1 n2 -   or

n1 n2 - n1 n3

Add n to the loop index. If the loop index did not cross the boundary between the loop limit minus one and the loop limit, continue execution at the beginning of the loop, otherwise discard the current loop control parameters and continue execution immediately following the loop.

 

+ORIGIN

 

n - ca

 

Leave the memory address relative by n to the origin parameter area. n is the number of bytes of offset. This definition is used to access or modify the cold start parameters in the origin area.

 

+TIMER

 

-

 

Enables the Timer 3 Overflow Interrupt. At power-up this interrupt is used for the on-board timekeeping. -TIMER stops the clock and +TIMER restarts it. Note that the interrupt priority level for Free Running Timer 3 (FRT3) set in bits 6 to 4 of address FFF2 must be greater than the interrupt mask in bits 10 to 8 of the microprocessor's status register.

 

,                    ANS

 

x -

 

Reserve 16 bits of data space, in line with the dictionary at power-up or after ROM and in RAM data space after RAM , and store x in the cell.

 

-                    ANS

 

n1 n2 - n3   or

u1 u2 - u3

 

Subtract n2 or u2 from n1 or u1 giving the difference n3 or u3.

 

-ROT

 

x1 x2 x3 - x3 x1 x2

 

Reverse rotate the top three stack entries.

 

-TIMER

 

-

 

Disables the Timer 3 Overflow Interrupt. At power-up this interrupt is used for the on board time-keeping so -TIMER will stop the update of the clock.

 

-TRAILING                    ANS

 

ca u1 - ca u2

 

If u1 is greater than zero, u2 is equal to u1 less the number of spaces at the end of the character string specified by ca u1. If u1 is zero or the entire string consists of spaces, u2 is zero. Use to shorten a string with trailing spaces before writing to an output device.

 

.                     ANS

 

n -

 

Display signed 16-bit number n followed by a space.

 

."                    ANS

 

COMPILATION:   ccc<quote>' -

Parse ccc delimited by double quote. Append the run-time action below to the current definition. Used to embed messages in definitions.

 

RUN-TIME:   -

Display string ccc.

 

.#

 

d n -

 

Display a double number d formatted with n decimal places. For example:

12345.  2 .# gives 123.45

12345.  6 .# gives 0.012345

12345.  0 .# gives 12345

-12345. 4 .#   gives -1.2345

As with other number formatting words this can be put on an LCD by revectoring EMIT to point to LCDEMIT .

 

.(                    ANS

 

COMPILATION:

Perform the execution action shown below. Compiles nothing, displays the message at compile-time.

 

EXECUTION:   'ccc<paren>' -

Parse and display string ccc ending in a right parenthesis.

 

.DATE

 

-

 

Displays the date set in the on-board clock in the format XX.YY.ZZ where XX is the day, YY the month and ZZ the year. If the word USA has been executed the day and month are reversed, i.e. YY.XX.ZZ. Valid from 1984 to 2072. Since EMIT is vectored the date can be sent to an LCD or other outputs by revectoring EMIT . See LCDEMIT .

 

.ID

 

nfa -

 

Display name corresponding to this nfa.

 

.R                    ANS

 

n1 n2 -

 

Display n1 right-aligned in a field n2 characters wide. If the number of characters required to display n1 is greater than n2, all digits are displayed with no leading spaces in a field as wide as necessary.

 

.S                    ANS

 

-

 

Non-destructive stack display.

 

.TIME

 

-

 

Displays the current time in the format XX.YY.ZZ followed by a space. XX is the hours 0-23, YY minutes, ZZ seconds. The time is since power-up if it has not been set. Since EMIT is vectored the time can also be displayed on an LCD or sent elsewhere. See (TIME) and LCDEMIT .

 

/                     ANS

 

n1 n2 - n1/n2

 

Leave the signed quotient n1/n2.

 

/MOD                    ANS

 

n1 n2 - remainder quotient

 

Leave the remainder and signed quotient n1/n2. The remainder has the sign of the dividend.

 

/SOURCE

 

- ca u

 

A string of u characters at address ca defines the area to be parsed.

 

/STRING                    ANS

 

ca1 u1 n - ca2 u2

 

Adjust the character string at ca1 by n characters. The resulting character string, specified by ca2 u2, begins at ca1 plus n characters and is u1 minus n characters long.

Go to Triangle Digital Support Home Page Go to top   Next page