Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Forth word list
I to LWHILE,
Live website search
Enter key words
 

I                     ANS

 

- n or

- u

 

n or u is a copy of the index of the current innermost loop index. Not the same as R@ .

 

I2C!

 

b a1 a2 - flag

 

For I2C bus peripherals. This is the main word for sending data to I2C devices, but sometimes it may be necessary to make up other sending words from the primitives STARTI2C STOPI2C R1BYTE S1BYTE R1BIT . The byte b is sent to the internal address a1 in the device at I2C address a2. The flag returned is true (-1) if the transfer was successfully handshaken, otherwise false (0). E.g.

HEX 35 FE 50 I2C!

This sends the byte 35 to address FE in the on-board I2C clock/RAM device. This has the I2C address 50. I2C peripheral chips are available from Philips, Xicor and Microchip Technology. They include I/O, A-D etc. When using I2C words on the TDS2020F the spare bits P10 P15 P16 & P17 should preferably be used as inputs since the I2C words have to change the Data Direction Register of Port 1, and the unused bits are always afterwards set to 0 (for input).

 

I2C@

 

a1 a2 - b flag

 

For I2C bus peripherals. This is the main word to receive data from I2C devices, but sometimes it may be necessary to make up other receiving words from the primitives STARTI2C STOPI2C R1BYTE S1BYTE R1BIT . The byte b is fetched from internal address a1 of I2C device address a2. The flag is true (-1) if the transfer was successfully handshaken, otherwise false (0). E.g.

HEX FE 50 I2C@

fetches the data at address FE inside the on-board PCF8583 clock/RAM, which has I2C address 50. When using I2C words on the TDS2020F the spare bits P10 P15 P16 & P17 should preferably be used as inputs since the I2C words have to change the Data Direction Register of Port 1, and the unused bits are always afterwards set to 0 (for input).

 

IF                    ANS

 

SYNTAX:   IF . ELSE . THEN

 

COMPILATION:   - orig 2

Put the location of a new unresolved forward reference orig onto the stack. Append the run-time action below to the current definition. The structure will be incomplete until orig is resolved, e.g. by THEN or ELSE .

 

RUN-TIME:      x -

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

 

IF,

 

- addr

 

Assembler word. Use in a structure

xx IF, . ELSE, . THEN,

The ELSE, is optional. xx is a condition code word such as EQ (Z flag in status register set). Other condition words are LS CS VS MI LT LE . Each can be negated by using N after it. E.g.

CODE <> @R7+ R3 MOVI,

 @R7+ R3 SUB,

 EQ N IF, -1 ## R3 MOVI,

 THEN, @-R7 R3 MOVO, END-CODE

This compares two stack items and returns -1 if not equal, 0 if equal. addr is left by IF, so that ELSE, or THEN, can fix up the branch assembled by IF, with the correct destination offset.

 

IFCASE

 

COMPILATION:   4 - 4 of-sys 5

Append run-time action to the current definition. The structure will be incomplete until of-sys is resolved by ENDOF . See CASE for an example of use.

 

RUN-TIME:   x1 flag -    or

   x1 flag - x1

If the flag is false discard the top value and continue execution at the location specified by the resolution of of-sys, i.e. at ENDOF . Otherwise discard both values and continue execution in-line.

 

 

IMMEDIATE                    ANS

 

-

 

Make the most recent definition that has a name an immediate word, i.e. one that will execute rather than compile when the system is in a compile state.

 

INC,

 

-

 

Assembler instruction, see assembler section and ADD:Q in Programming Manual. ADD:Q # 1 in Hitachi code.

Syntax examples:

R2 INC, \ Increment

  \ register 2

B $FF00 )) INC, \ Increment

  \ byte at address FF00

 

INKEY

 

- n (0 to 64)

 

Scans an external keyboard as a matrix of up to 8 x 8 keys. Returns 0 if no key pressed or 1 to 64 according to the key. If two or more keys are pressed the higher number is returned. To use this word, connect Port B via diodes to one side of the matrix, cathodes towards the matrix. Connect the other side of the matrix via diodes to the data bus, cathodes towards the bus. 8 3k3 pull-down resistors are also needed on the data bus. Make sure system variable CFIGM is set with the desired direction of Port A before calling this word. INKEY itself will configure CFIGM for keyboard mode. See also NEWKEY , which can be more useful.

 

INTERPRET

 

-

 

Interpret input stream till exhausted.

 

INVERT                    ANS

 

x1 - x2

 

Invert all bits of x1 giving its logical inverse x2. E.g.

2 BASE ! 0000000010110000

INVERT U.

returns 1111111101001111.

 

IS

 

- File #EXTEND.TDS needed -

 

INTERPRETATION:   xt 'name' -

Set deferred word to execute 'name'. See DEFER .

 

COMPILATION:   'name' -

Compile run-time action shown.

 

RUN-TIME:   xt -

Set deferred word included at compilation time to execute word whose execution token is xt.

 

J                     ANS

 

- n or

- u

 

n or u is a copy of the index of the next outer loop. See POINTS TO WATCH, page 67.

 

JMP,

 

addr -

 

Assembler instruction, see assembler section and JMP in Programming Manual. Syntax examples:

0 @R2 JMP, \ Jump to address

  \ in register R2

8 @R2 JMP, \ Jump to 8 after

  \ address in R2

$9000 JMP, Jump to address

  \ hex 9000

 

JSR,

 

addr -

 

Assembler instruction, see assembler section and JSR in Programming Manual. Syntax examples:

0 @R2 JMP, \ Jump to sub-

  \ routine at address in

  \ register R2

$9000 JMP, \ Jump to sub-

  \ routine at address 9000

 

KEY                    ANS

 

- char

 

Receive one keyboard event char. All characters from 0 to 255 can be received. Characters received are not displayed. At power-up KEY is configured to wait until a byte is received from serial Port 1, SIN1 on pin a25. It is vectored through 'KEY to execute <KEY> but that can be changed. See 'KEY <KEY> . Use KEY? to test whether a character is pending (without waiting).

 

KEY?                    ANS

 

- flag

 

If a keyboard event is available return true. The event is returned by the next execution of KEY . After KEY? returns with true, subsequent executions of KEY? prior to the execution of KEY do not affect the event or character in any way.

 

LASTKEY

 

- aa

 

System variable. Returns the address which contains the last key depressed as found by the word NEWKEY . This refers to an 8 x 8 matrix keyboard, not the serial terminal. See also NEWKEY and INKEY .

 

LATER

 

u -

 

Used near the end of a routine caused by a Timer 3 Output Compare B Interrupt. The number u is added to the current value of output compare register B of Timer 3 and after clearing the current output compare match flag the sum is placed in the output compare register. Regular interrupts will therefore occur at intervals governed by u. Each unit is (by default) 0.8138�s. Keep u below 65000 so that the repeat time is under the 53ms cycle of the free-running counter. Such a regular interrupt is a second infinite loop and an independent task. E.g.

: A/D READ 10000 LATER

 RETURN;

-27 +ORIGIN ASSIGN A/D

(See ASSIGN for details). If READ is a simple word which inputs and stores an A to D converter reading, this will be done each 8ms as a background task.

 

LCD

 

- ca

 

Returns the address of the control register of an LCD connected to the chip select line CS81C0. Used by PUT etc. The address is on an even byte in the range 81C0 to 81CE so that up to 8 LCDs can be connected if an external 3 to 8 line address decoder is added. Which one of the 8 addresses depends on the value in user-variable #LCD . This is set to 0 at power-up to give 81C0.

 

LCDDATA

 

- ca

 

Returns the address of the data register of an LCD connected to the chip select line CS81C0. Used by PUT etc. The address is on an odd byte in the range 81C1 to 81CF so that up to 8 LCDs can be connected if an external 3 to 8 line address decoder is added. Which one of the 8 addresses depends on the value in user variable #LCD . This is set to 0 at power-up to give 81C1.

 

LCDEMIT

 

c -

 

Writes character c to an alphanumeric LCD display connected to chip select CS81C0. The particular LCD, if there is more than one, depends on the number 0 to 7 in variable #LCD .The position written to is that contained in the variable AT . This is incremented so that the next LCDEMIT writes to the next character position. LCDEMIT behaves like, and has the same stack conditions as EMIT which normally writes to the serial terminal. Since EMIT is vectored (through 'EMIT ) it can be re-pointed to LCDEMIT to make all serial display words such as ..# U.R etc. write to the LCD instead. E.g.

: TEST \ Display time

       \ continuously

 <LCD BEGIN 0AT .TIME

 KEY? UNTIL  LCD> ;

For definitions of <LCD and LCD> see ALPHANUMERIC SOFTWARE, page 101.

 

LDC,

 

-

 

Assembler instruction, see assembler section and LDC in Programming Manual. For an example, see STC, .

 

LDM,

 

-

 

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

7 LDM, \ Restore registers

  \ 0 1 and 2 from stack.

  \ Appropriate bits are set

  \ in the operand byte.

 

LE

 

- 2E (hex)

 

SYNTAX:

CODE ccc . LE 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 Z + (N xor V) = 1 (Z flag is set or N and V are not the same).

 

LEAVE                    ANS

 

EXECUTION:   -   R:   n1 n2 -

Discard loop control parameters. Continue execution immediately following the innermost enclosing DO . LOOP or DO . +LOOP structure. Note that the code between LEAVE and LOOP (or +LOOP ) is not executed.

 

LELSE,

 

addr1 - addr2

 

Assembler word. This is a 'long ELSE, ' see LIF, . Use only in a CODE definition.

 

LIF,

 

condition - addr

 

Assembler word. This is a 'long IF, ' since it is used when the distance from the IF, to the following ELSE, or THEN, would be over 127 bytes. It does the same function but assembles a 16-bit instead of an 8-bit branch displacement. Use with LELSE, and LTHEN, and only in a CODE definition.

 

LINK>

 

lfa - xt

 

Convert link field address to execution token.

 

LINKFP,

 

-

 

Assembler instruction, see assembler section and LINK in Programming Manual. Syntax examples:

B 8 LINKFP, \ Save R6 to

 \ stack, copy R7 to R6 and

 \ add 8 to R7 to allocate

 \ new stack frame

-$200 LINKFP, \ Same but

 \ subtracts hex 200 from R7

 

LITERAL                    ANS

 

COMPILATION:   x -

Append the run-time action to current definition.

 

RUN-TIME:   - x

Place x on the stack

 

LOOP                    ANS

 

SYNTAX:  : ccc . DO . 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 .

 

RUN-TIME:   -

        R: n1 n2 -    or

 n1 n2 - n1 n3

Increment the loop index. If it is then equal to the loop limit discard the loop parameters and continue execution immediately following the loop. Otherwise resume execution at the beginning of the loop.

 

LREPEAT,

 

-

 

SYNTAX:

BEGIN, . xx LWHILE, . LREPEAT,

An assembler word. Used for large structures of the form shown where the branch back from LREPEAT, to BEGIN, exceeds 127 bytes.

 

LS

 

- 22 (hex)

 

SYNTAX:

CODE ccc . LS 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 C + Z = 1 (carry or z flags set).

 

LSHIFT                    ANS

 

x1 u - x2

 

Logically left shift x1 u places, giving x2. Put zero into the least significant bits vacated by the shift.

 

LT

 

- 2C (hex)

 

SYNTAX:

CODE ccc . LT 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 (N xor V) = 1 (N and V are different).

 

LTHEN,

 

addr -

 

SYNTAX:

xx LIF, . LELSE, . LTHEN,

Assembler word. This is a 'long THEN, ' see LIF, .  Use only in a CODE definition.

 

LWHILE,

 

condition - addr

 

SYNTAX:

BEGIN, . xx LWHILE, . LREPEAT,

Assembler word. This is a 'long WHILE, ' see LIF, .  Use only in a CODE definition.

 

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