Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Forth word list
PAD to Rx
Live website search
Enter key words
 

PAD                    ANS

 

- ca

 

ca is the address of a transient region of RAM memory that can be used to hold data for intermediate processing.

 

PAGE                    ANS

 

-

 

Sets the cursor to the top left of the screen and clears the display by sending the ASCII character hex 0C.

 

PARSE                    ANS

 

char 'ccc<char>' - ca u

 

Parse ccc delimited by char. ca is the address within the input buffer and u is the length of the parsed string. If the parse area was empty u = 0.

 

PAUSE

 

-

 

Suspends current task and passes to next activated one in round-robin multitasking. In assembler this is

DECIMAL 13 ## TRAPA,

There is no action until the multitasker files are compiled.

 

PC!

 

char ca -

 

Store char at address ca synchronising the store with the E clock. The unused higher-order bits are all zeros.

 

PC@

 

ca - char

 

Fetch char from address ca synchronising the fetch with the E clock. The unused higher-order bits are all zeros.

 

PICK                    ANS

 

? u - ? x

 

Remove u. Copy '(u+1)th' item to the top of the stack. 0 PICK is equivalent to DUP and 1 PICK is equivalent to OVER etc.

 

PJMP,

 

-

 

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

0 @R2 PJMP, \ Page jump to

 \ address in registers R2

 \ and R3, lower byte of R2

 \ to code page register and

 \ R3 to program counter

HEX F1234. PJMP, \ Page jump

 \ to extended address F1234,

 \ i.e. address 1234 in

 \ page F

 

PJSR,

 

-

 

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

HEX F1234. PJSR, \ Jump to

 \ subroutine at extended

 \ address F1234, i.e.

 \ address 1234 in page F

 

PLACE

 

ca1 u ca2 -

 

Take string at ca1 extending for u characters and put as counted string at ca2.

 

POSTPONE                    ANS

 

'<spaces>name' -

 

Defer execution compilation behaviour of name until run-time.

 

PRIME

 

blink cursor on/off sh id lcdkind -

 

Initialises an alphanumeric LCD which uses driver chip HD44780 internally. PRIME is essential before using any other LCD words. The parameters needed are:

blink:

1=character blinks

 

0=not

cursor:

1=cursor on

 

0=not

on/off:

1=display visible

 

0=not

sh:

1=display shifts on write

 

0=not

id:

1=auto incr char position

 

0=not

lcdkind:

To calculate the required number start with hex 30. Add 8 if the display is two lines not one, and add 4 if the display is 10 x 7 matrix not 7 x 5. E.g. 38 will initialise a 2-line 7 x 5 dot display.

 

PRIORITY

 

n -

 

Sets the general interrupt priority level in the H8/532 microprocessor's status register.

0 = All interrupts enabled

7 = All interrupts disabled (except NMI)

Note that as well as this general enable, each interrupt also has its own enable bit and each interrupt group has its priority level register. An interrupt will only succeed if (i) It has its enable bit set (ii) The priority level for its group is equal to or above that set in the status register by PRIORITY .

 

PRTD,

 

-

 

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

B 8 ## PRTD, \ Page return

 \ from subroutine and

 \ deallocate 8 bytes of

 \ stack by adding 8 to R7

$100 ## PRTD, \ Same but

 \ deallocates hex 100 bytes

 

PRTS,

 

-

 

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

PRTS, \ Page return from

  \ subroutine that was

  \ called with PJSR,

 

PUT

 

c n -

 

The character c is written to position n on the LCD. n = 0 for the most left position. PUT calls <PUT> through a user variable 'PUT which is set with the execution token of <PUT> at power-up or when COLD is executed. For certain LCDs it is necessary to point 'PUT at a user-defined version so that PUT will correctly address the particular LCD. See 'PUT <PUT> and AT .

 

QUERY                    ANS

 

-

 

Make user input the input source. Receive input into the terminal input buffer. Set terminal input buffer offset >IN to zero.

 

QUIT                    ANS

 

-

 

Clear return stack and enter text interpreter. This is the executing loop when you are interactively accessing Forth.

 

R1BIT

 

- flag

 

For I2C bus peripherals. Takes one bit from an I2C peripheral device. Sets clock to output and data to input, issues a clock pulse and reads the data in while the clock is at logic 1. See I2C! .

 

R1BYTE

 

- b

 

For I2C bus peripherals. Inputs one byte from an I2C device. Sets clock to output and data to input then issues 8 positive-going clock pulses, reading the data in each time the clock is at logic 1. This is formatted to the output byte. See I2C! .

 

R>                    ANS

 

EXECUTION:   - x   R:   x -

Move x from the return stack to the data stack. Use should normally be balanced by >R in the same definition.

 

R@                    ANS

 

- x         R:    x - x

 

Copy x from return stack to data stack.

 

RAM

 

-

 

Choose the RAM data space when working with the words , ALIGN ALLOT C, CREATE HERE UNUSED

 

RECURSE                    ANS

 

-

 

Append the execution action of the current definition to the current definition. E.g.

: TEST ." Another time "

 1- ?DUP IF RECURSE THEN ;

Now try 4 TEST and 10 TEST to get the message the appropriate number of times.

 

REFILL                    ANS

 

- File #ANS.TDS needed -

 

- flag

 

Attempt to fill the input buffer from the input source, returning a true flag if successful. If the source is user input, set >IN to zero and return true flag. If the source is a string from EVALUATE return false and perform no other action.

 

REPEAT                    ANS

 

COMPILATION:   orig 2 dest 1 -

Append the run-time action below to the current definition, resolving the backward reference dest. Resolve the forward reference orig using the location following the appended execution action.

 

RUN-TIME:   -

Unconditionally continue execution at the location specified by dest.

 

REPEAT,

 

addr1 addr2 -

 

Assembler word. Ends the structure:

BEGIN, . xx WHILE, . REPEAT,

The addr1 and addr2 are used to assemble a branch at REPEAT, back to the start at BEGIN, and to fix up a branch left at WHILE, to make it go to after REPEAT, if the condition code xx is not true. See BEGIN, WHILE, IF, . Use only in a CODE definition.

 

REST

 

u -

 

Delay by approximately u x 0.8�s (u x 2.0�s using TDS2020DV). Neither of the two watchdogs is serviced so use only for delays up to 106ms. Over this use WAIT or MS .

 

RESTORE-INPUT                    ANS

 

- File #ANS.TDS needed -

 

xn.x1 n - flag

 

Restore the input source described by x1 to xn. Flag is true if the source cannot be restored.

 

RETURN;

 

-

 

Used instead of ; to end a high-level Forth word which is to execute on interrupt, and which will be the subject of an ASSIGN statement. RETURN; compiles code which will restore the main task when the interrupt is over and also compiles the RTE instruction at the end of the interrupting word. ASSIGN & LATER have examples.

 

ROLL                    ANS

 

?1 u - ?2

 

Remove u. Rotate u+1 items on top of the stack. For example

 - 1 2 3 4 5 6 3

becomes

 - 1 2 4 5 6 3

(4 items rotated).

Here we work with 4 items (3 being the top number on the stack, which is then discarded). ROLL picks the lowest of the 4 items, here the number 3, and places it on top of the stack. The other 3 items get pushed down one place. Use of ROLL is generally not good Forth, try splitting the current definition into two or more parts.

 

ROM

 

-

 

Choose the dictionary data space when working with the words , ALIGN ALLOT C, CREATE HERE UNUSED

 

ROT                    ANS

 

x1 x2 x3 - x2 x3 x1

 

Rotate the top three stack entries.

 

ROTL,

 

-

 

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

B $FF00 ROTL, \ Rotate byte

  \ at hex FF00 left with bit

  \ 7 copied to carry bit

 

ROTR,

 

-

 

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

R3 ROTR, \ Rotate R3 right

  \ with bit 0 copied

  \ to carry bit

 

ROTXL,

 

-

 

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

B $FF00 ROTXL, \ 9-bit rotate

  \ left of byte at hex FF00

  \ including the carry bit

 

ROTXR,

 

-

 

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

R3 ROTXR, \ 17-bit rotate

  \ right of register 3,

  \ including the carry bit

 

RP!

 

aa -

 

Set return stack pointer to address aa.

 

RP0

 

- aa

 

Address containing base of return stack.

 

RP@

 

- aa

 

Get return stack pointer address aa.

 

RSHIFT                    ANS

 

x1 u - x2

 

Logically right shift x1 u places, giving x2. Put zero into the most significant bits vacated by the shift. Not the same as a two's complement divide.

 

RTD,

 

-

 

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

B 8 ## RTD, \ Return from

 \ subroutine and deallocate

 \ 8 bytes of stack by

 \ adding 8 to R7

$100 ## RTD, \ Same but

 \ deallocates hex 100 bytes

 

RTE,

 

-

 

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

RTE, \ Return from

 \ exception or interrupt

 

RTS,

 

-

 

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

RTS, \ Return from subroutine

 

Rx

 

-

 

An assembler word. Rx stands for any register R0 to R7 and is used as part of an assembler instruction. Registers R5 and R6 must be saved then restored at the end if needed in a CODE word. In interrupts, save and restore any of R2 R3 R4 R5 and R6 that will be used. RO will compile without showing an error but will not work -.be sure to type R0 for register 0. Register allocation of the Forth is:

R0 R1

Only used in compiling, usually free at run-time

R2 R3

Used as a scratchpad by many Forth words

R4

Forth W register

R5

Forth IP inner interpreter pointer

R6

Return stack pointer

R7

Machine and parameter stack pointer

 

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