Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Forth word list
VALUE to ^x
Live website search
Enter key words
 

VALUE                    ANS

 

x '<spaces> name' -

 

Create a variable 'name' with an initial value x. Use TO and VALUE as a faster and neater way to implement variables. In assembler you can access the variable XYZ defined by 0 VALUE XYZ like this:

' XYZ 2+ @ )) R3 MOVI,

  \ reads content of

  \ variable to R3

 

name EXECUTION:   - x

Place x on the stack. The value of x is that given when name was created, until the phrase x TO name is executed, causing a new value of x to be associated with name. At power-up of a stand-alone system TO must be used to avoid x being indeterminate.

 

VARIABLE                    ANS

 

'<spaces>name' -

 

Create a definition for name. Reserve one cell of data space (which is not initialised).

 

name EXECUTION:   - aa

aa is the address of the reserved cell. A program should initialise its contents.

 

VDP

 

- aa

 

A user variable pointing at the next RAM cell for allocation with VARIABLE . It is initialised to hex FDF6 (8800 with TDS2020DV) at power-up but can be changed to any even RAM address in the first 64k bytes.

 

VS

 

- 28 (hex)

 

SYNTAX: CODE cccc

 . VS IF, . THEN, . END-CODE

Assembler word. Condition code for use before IF, WHILE, and UNTIL, - see IF, . The IF, is true when in the status register V = 1.

 

W

 

-

 

Assembler word. Sets operand size to 16 bits (word). Use only in a CODE definition and as first word in an instruction. See also. E.g.

W $FF00 )) R3 ADD, \ Add word

  \ at hex FF00 & FF01 to R3

 

W!

 

-

 

Set non-volatile clock chip PCF8583 on the TDS2020F from the on-board time system. For example the on-board clock date and time can be set like this:

25.12.02 NOW 09.00.00 HRS W

In USA use:

12.25.02 NOW etc.

 

W@

 

-

 

Set the on-board time system from the PCF8583 non-volatile clock on the TDS2020F. The variables TICKS MINS and DAYS are adjusted. Once this is done date and time are available via .DATE and .TIME (as well as other words).

 

WAIT

 

u -

 

Suspend operations for n units of time (u = 1 to 65535). Each unit is approximately 26�s (54�s with TDS2020DV) but a bit larger for small u. The watchdog timers are serviced but nothing else happens. See also MS and REST .

 

WAITS

 

- File #EXTEND.TDS needed -

 

n -

 

Sets n wait states per microprocessor cycle time. By default there are no wait states but slow peripherals may need them. The number of wait states depends on the access time of the device:

0 wait states

< 120ns

1 wait state

< 220ns

2 wait states

< 320ns

3 wait states

< 420ns

 

WDT

 

-

 

Resets both the internal and external watchdog timers. This, and machine code equivalents, are included in most Forth branching words such as DO LOOP +LOOP UNTIL MS etc. so WDT will normally not be needed. If the TDS2020F resets itself without showing any error message then the external watchdog has timed out 426.66ms since it was last serviced. When the internal watchdog operates the message WATCHDOG is displayed. To service the watchdogs in assembler code:

External:

B $8160 )) R3 MOVTPE,

Internal:

$FFEC )) $5A00 ## MOVIM,

 

WHILE                    ANS

 

COMPILATION:   dest n - orig 2 dest n

Put the location of a new unresolved forward reference orig on to the stack under the existing dest. Append the run-time action below to the current definition. The structure will be incomplete until orig and dest are resolved, e.g. by REPEAT . The other stack items help the compiler detect syntax errors.

 

RUN-TIME:   x -

If x is zero continue execution at the location specified by the resolution of orig, e.g. after the next REPEAT .

 

WHILE,

 

addr1 - addr1 addr2

 

Assembler word. Used in a structure like: BEGIN, . xx WHILE, . REPEAT, . This is the most general form of loop. Despite its high structure it assembles to simple machine code-no extra op codes. xx is a condition code like EQ . See IF, . Use only in a CODE definition.

 

WIDTH

 

- aa

 

A user variable containing the maximum number of letters saved in compilation of a definition's name. Range is 1 to 31. The name's actual character count and its letters, up to the number in WIDTH , are saved. The value may be changed at any time within the limits given. The default width is 31.

 

WIPE

 

-

 

Blanks alphanumeric LCD display and restores character pointer in variable AT to the first position. See AT and 0AT .

 

WITHIN                    ANS

 

n1 n2 n3 - flag   or

u1 u2 u3 - flag

 

Perform a comparison of a test value n1 with a lower limit n2 and a upper limit n3 returning true if n1>= n2 and n1< n3. Analogously also for unsigned parameters.

 

WORD                    ANS

 

char '<chars>ccc<char>' - ca

 

Skip leading delimiters. Parse ccc delimited by char. ca is the address of a transient region containing the parsed word as a counted string. A space, not included in the count, follows. If the parse area was empty the string has zero length. Maximum string length trimmed to 255 characters.

 

WORDS                    ANS

 

 -

 

List the definition names.

 

XCH,

 

-

 

Assembler instruction, see assembler section and XCH in Programming Manual. Syntax example:

R2 R3 XCH, \ Exchange

  \ registers R2 and R3.

  \ Must be word mode.

 

XOR                    ANS

 

x1 x2 - x3

 

x3 is the exclusive 'or' of x1 with x2.

 

XOR,

 

-

 

Assembler instruction, see assembler section and XOR in Programming Manual. Syntax example:

R2 R3 XOR, \ Exclusive OR 16

  \ bits of R2 with all 16

  \ bits of R3, result to R3

 

XORC,

 

-

 

Assembler instruction, see assembler section and XORC in Programming Manual. Syntax example:

B 1 ## CCR XORC, \ Exclusive

  \ OR immediate 1 with

  \ condition code register.

  \ i.e. invert carry flag

 

ZERO

 

ca n -

 

Clear bit n (0 to 7) at address ca. Opposite is ONE .

 

[                     ANS

 

COMPILATION:

Perform the execution action shown below.

 

EXECUTION:   -

Enter interpretation state. [ is an immediate word.

 

[']                    ANS

 

COMPILATION:   '<spaces>name' -

Parse name delimited by space. Find name in dictionary and append run-time action shown below to current definition.

 

RUN-TIME:   - xt

Place name's execution token xt on the stack. The execution token returned by the compiled phrase ['] xxx is the same value returned by ' xxx outside the compilation state.

 

[CHAR]                    ANS

 

- File #ANS.TDS needed -

 

COMPILATION:   '<spaces>name' -

Parse name, delimited by a space. Append the run-time action below to the current definition. Either "x or [CHAR] x in a definition will return the ASCII value of x on the stack but only the latter is ANS Forth.

 

RUN-TIME:   - char

Place char, the value of the first character of name, on the stack.

 

[COMPILE]                    ANS

 

- File #ANS.TDS needed -

 

'<spaces>name' -

 

Parse name delimited by space. Find name in dictionary and append name's run-time action to current definition. POSTPONE is usually to be preferred.

 

\                      ANS

 

COMPILATION:

Perform the execution action shown below. Use \ to make the rest of a line a comment.

 

EXECUTION:   'ccc<eol>' -

Parse and discard the remainder of the parse area. \ is an immediate word.

 

]                     ANS

 

-

 

Enter compilation state.

 

^x

 

- n

 

This is a set of words ^@ ^A ^B etc. to put numbers equivalent to ASCII control characters on the stack. The above leave 0, 1 and 2 respectively for example. More convenient and giving better documentation than the number equivalent. See also "x .

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