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

TDS9092 ALPHANUMERIC WORD DEFINITIONS


I

       - n

SYNTAX:

: cccc   .   DO . I . LOOP   . ;

n is a copy of the current (innermost) loop index.


I/D

       -

An LCD user variable.  Returns address where a flag is kept.  If the flag is 1 the character address inside the LCD is auto-incremented, if 0 it is not. Use the word ENTRY-SET to send the flag to the LCD. I/D is initialised to 1 at power up and by COLD but is not changed by reset or re-start by the watchdog. E.g.

0 I/D !  ENTRY-SET


I2C!

       b  a1  a2 - f

For I2C bus peripherals. This is the main word for use to send 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 f returned is 1 if the transfer was successfully handshaken, otherwise 0. E.g.

 HEX  35 FE 50 I2C!

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


I2C@

       a1 a2 - b f

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 f is 1 if the transfer was successfully handshaken, otherwise 0. E.g.

 HEX  FE 50 I2C@

fetches the data at address FE inside the on-board EEPROM, which has I2C address hex 50. When using I2C words on the TDS9092 the spare bits P50 to P55 should preferably be used as inputs since the I2C words have to change the Data Direction Register of Port 5, and the unused bits are always afterwards set to 0 (for input).


IBM

       -

Sets up editor control codes to match TDS-PC and various Microsoft Basics.


ICI

       - 0812 (hex)

Gives address of jump table entry for Timer 1 Input Capture Interrupt. Usually used before ASSIGN which places at this address a jump to the interrupt code. To enable this interrupt set bit 4 of the Timer Control/Status Register 1 at addr 08.


ID.

       nfa -

Display a definition's name from its name field address.


IF

       - addr n
       f -

SYNTAX:
: cccc   . IF . ELSE . THEN . ;

COMPILING: At compile-time IF compiles 0BRANCH and reserves space for an offset at addr. addr and n are used later for resolution of the offset and error testing.

EXECUTING: At run-time IF selects execution based on a boolean flag. If f is true (non-zero), execution continues ahead. If f is false (0), execution skips till just after ELSE . After either of these, execution resumes after THEN or ENDIF . ELSE and its false part are optional. If missing, the false case execution skips to just after THEN or ENDIF .


IF,

       condition - 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 NOT, after it. E.g.

 CODE <>   PULD,  TSX,
    0 ,X SUBD, EQ NOT,
    IF, 1 ## LDD,  THEN,
    0 ,X STD,

  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

       n1 - n2

Part of a CASE structure. See CASE .


IMMEDIATE

       -

Marks the most recently created dictionary entry as an immediate word, so that when encountered at compile-time it will be executed rather than being compiled. The user may force compilation of an immediate word by preceding it with [COMPILE] .


IN

       - addr

A user variable containing the byte offset within the current input text buffer (terminal or mass memory) from which the next text will be accepted. WORD uses and moves the value of IN .


INC,

       n -

Assembler word. Increment memory location or accumulator. E.g.

 B INC,

will add 1 to the accumulator B.


INDEX

      from  to -

Display the first line of each editor screen over the range from . to. This is used to view comment lines at the top of each screen.


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 Schottky 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. Make sure system variable CFIGM is set with the desired direction of Port A before calling this word. INKEY will itself configure CFIGM for keyboard mode. See also NEWKEY which can be more useful.


INS,

       -

Assembler word. Increment stack pointer register. Take one byte from stack.


INTERPRET

       -

The default action of this word is shown under <INTERPRET> . The action of INTERPRET is that of the word whose cfa is stored in 'INTERPRET and so it can be changed. See NUMBER for the method.


INX,

       -

Assembler word. Increment X register.


IP

       - 42 (hex)

Assembler word. The address returned is the Forth system inner interpreter pointer.


IRQ1

       - 0815 (hex)

Gives address of jump table entry for maskable Interrupt Request 1, or ISF (port 6 Input Strobe). Usually used before ASSIGN which places at this address a jump to the interrupt code. To enable IRQ1 clear the status register interrupt mask bit. The word EIS does this. DIS sets it. Enable ISF by setting bit 6 of the port 6 Control/Status register at addr 21 (hex).

  


IRQ2

       - 0800 (hex)

Gives address of jump table entry for maskable Interrupt Request 2. Usually used before ASSIGN which places at this address a jump to the interrupt code. Enable IRQ2 by clearing the interrupt mask bit in the status resister.  EIS does this and DIS sets it to disable interrupts.


J

       - n

Copies the third number on the return stack to the parameter stack. Usually used in the inner of two nested DO loops to access the index of the outer loop. E.g.

 : TEST

    5 0 DO 205 200 DO

    J . LOOP LOOP ;

This displays the numbers 0 to 4 five times.


JMP,

       addr -

Assembler word. Compile a jump to a particular address addr. E.g. NEXT JMP, to re-enter the Forth system from assembler.


JSR,

       addr -

Assembler word. Used to compile a jump  to subroutine at address addr. See BSR, for an example which is similar.


KEY

       - c

Receive one 7-bit character c from input terminal (Serial Port 1 at power-up). A rubout (hex 7F) is converted to backspace and bits 7 to 15 are zero. Since KEY calls (KEY) the input source can be re-vectored using 'KEY . To receive a binary byte without modifications use (KEY) itself.


LASTKEY

       - addr

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 16-bit timer Output Compare Interrupt. The number u is added to the current value of the free running counter 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 60000 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;

 OCI 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.


LATEST

       - addr

Leave the name field address (nfa) of the topmost word in the CURRENT vocabulary.


LCD

       - addr

Returns the address of the control register of an LCD connected to the chip select line CS01C0. Used by PUT etc. The address is on an even byte in the range 01C0 to 01CE 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 is selected depends on the value in user variable #LCD . This is set to 0 at power up to give 01C0.


LCDDATA

       - addr

Returns the address of the data register of an LCD connected to the chip select line CS01C0. Used by PUT etc. The address is on an odd byte in the range 01C1 to 01CF 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 is selected depends on the value in user variable #LCD . This is set to 0 at power-up to give 01C1.


LCDEMIT

       c -

Writes character c to an alphanumeric LCD display connected to chip select CS01C0. 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

    PRIME

    'EMIT @  ( keep old value

    ' LCDEMIT CFA  'EMIT !

           ( install new one

    BEGIN  0AT .TIME ?TERMINAL

    UNTIL  'EMIT ! ;


LCDKIND

       -

An LCD user variable.  Returns address where is kept a number which defines the type of LCD in use. To calculate the required number start with 30 (hex). Add 8 if the display is 2 lines not one, and add 4 if the display is 10 x 7 matrix not 7 x 5.  Use PRIME to send the number to the LCD. LCDKIND is initialised to 30 (hex) at power-up and by COLD but is not changed by reset or on re-start by the watchdog. E.g.

 $3C LCDKIND !   PRIME

will initialise a 2-line 10 x 7 dot display.


LDA
,

       n -

Assembler word. Load accumulator A or B with immediate data or from memory. E.g.

 $9000 B LDA,

copies the content of address hex 9000 to accumulator B.


LDD,

       n -

Assembler word. Load 16 bits of immediate or memory data to D (A and B put together with A the more significant byte), E.g.

 $9000 LDD,

copies the content of address hex 9000 to accumulator A and the content of hex 9001 to B.


LDS,

       n -

Assembler word. Load stack pointer with immediate data or from memory. E.g.

 $B000 LDS,

Relocate the stack at address hex B000.


LDX,

       -

Assembler word. Load 16 bits of immediate or memory data to the X register. E.g.

 1234 ## LDX,

moves immediate data 1234 into X.


LE

       - 2E (hex)

SYNTAX:
CODE cccc 
. 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

       -

SYNTAX:
: cccc
  . DO . LEAVE . LOOP . ;

Force termination of a DO . LOOP structure at the next LOOP or +LOOP by setting the loop limit equal to the current value of the index. The index itself remains unchanged and execution proceeds normally until LOOP or +LOOP is encountered. Use only in DO . LOOP or DO . +LOOP structures.


LEFT

       -

Moves the terminal cursor left one position. If this does not work see HOME .


LELSE,

       addr1 - addr2

Assembler word. This is a 'long ELSE, '- see LIF, .


LFA

       pfa - lfa

Convert the parameter field address (pfa) of a dictionary definition to its link field address (lfa).


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, .


LINE

       n - addr

Converts line number n (0 to 15) to an address where that line on the current screen can be accessed.


LIST

       n -

Display the text of editor screen n. The value n is left in the variable SCR .


LIT

       - n

COMPILING: Within a colon definition LIT is automatically compiled before each 16-bit literal number encountered in the input text.

EXECUTING: At run-time when LIT is executed the contents of the next dictionary location are pushed on the stack.


LITERAL

       n -
       - n

COMPILING: If compiling, then compile the stack value n as a 16-bit literal. It is immediate so that it will execute during a colon definition. The intended use is:

 : xxx [ calculate ] LITERAL ;

In the example compilation is suspended for the compile time calculation of a value. Compilation is then resumed and LITERAL compiles this value.

EXECUTING: At run-time literal n is placed on the stack.


LOAD

       n -

Begin compilation at editor screen n. Loading will terminate at the end of the screen or at ;S . If the screen contains --> compilation will immediately continue on the next editor screen.


LOG

       n1 - n2

Used for fractional arithmetic. Converts n1 representing a fraction in the range 1.0000 to 1.9999, to n2 representing the natural logarithm of n1. Example:

 : TEST 1.1230 D>F LOG .F ;

This prints 0.1160 which is logn(1.123). Useful for linearisation of transducers.


LOOP

       addr n -
       -

COMPILING: At compile-time LOOP compiles (LOOP) and uses addr to calculate an offset to DO . n is used in error checking.

EXECUTING: At run-time LOOP selectively controls branching back to the corresponding DO based on the loop index and limit. The loop index is incremented by one and compared to the limit. The branch back to DO occurs until the index equals or exceeds the limit. At that time the index and limit parameters are discarded and execution continues ahead.


LS

       - 22 (hex)

SYNTAX:
CODE cccc . 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).


LSR,

       n -

Assembler word. Shift right accumulator or memory location. Zero goes into bit 7 and bit 0 is moved into the carry bit. E.g.

 B LSR,

shifts accumulator B right.


LSRD,

       -

Assembler word. Shift right accumulator D, (A and B together, with A the more significant byte). Zero goes into bit 15 and bit 0 is moved into the carry bit. E.g.

 LSRD,

shifts accumulators A and B right (divide by 2).


LT

       - 2C (hex)

SYNTAX:
CODE cccc . 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,

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