ALPHANUMERIC WORD DEFINITIONS
Leave the address of a transient region which can be used to hold data for intermediate processing. The position of this area is altered if new definitions are made or deleted. The Forth system itself never uses this area.
Sets the cursor to the top left of the screen and clears the display. If this does not work see HOME .
nfa - pfa
Convert the name field address (nfa) of a definition to its parameter field address (pfa).
N - n
Take the Nth item on the stack (not including N) and place it on top of the stack. For example 2 PICK is equivalent to OVER . Use of PICK is sometimes bad Forth. Try splitting the definition to reduce the number of items on the stack.
A variable containing the address of the buffer most recently accessed. The UPDATE command marks this buffer to be later written to mass memory.
Initialises an alphanumeric LCD which uses driver chip HD44780 internally. PRIME is essential before using any other Forth words. Before using, check that the values set in the variables LCDKIND I/D SH ONOFF CURSOR and BLINK are those needed. See each of these words for full details.
Assembler word. Push accumulator A onto the stack. Note that this is 8 bits only and another byte will be needed to make up one Forth item.
Assembler word. Push accumulator B onto the stack. Note that this is 8 bits only and another byte will be needed to make up one Forth item.
Assembler macro. Push accumulators B then A to the stack, i.e. register D.
Assembler word. Push register X onto the stack.
Assembler word. Pull accumulator A from the stack. Note that this is 8 bits only and another byte will be needed to remove one Forth item.
Assembler word. Pull accumulator B from the stack. Note that this is 8 bits only and another byte will be needed to remove one Forth item.
Assembler macro. Pull accumulators A then B from the stack, i.e. register D.
Assembler word. Pull register X from the stack.
Assembler word. The address returned is a constant which an entry point into the Forth system which first pushes accumulators B, then A then executes NEXT . Use it to end a CODE definition in this way in place of END-CODE : E.g.
PUSHBA JMP, SMUDGE
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 code field address (cfa) 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 .
Input 80 characters of text (or until a return) from the operator's terminal (Serial Port 1 by default at power-up). Text is placed at the address contained in the user variable TIB and the pointer user variable IN is set to zero.
Clear the return stack, set interpret state, accept new input from the current input device and begin interpretation. No message is displayed.
Copy n from the return stack to the data stack.
A user variable which may contain the location of an editing cursor or other file-related function.
An LCD user variable. Returns address where a flag is kept. If the flag is 1, SHIFT will cause a right shift of the message, if 0 a left one. R/L is initialised to 1 at power-up and by COLD but is not changed by reset or by re-start by the watchdog. E.g.
0 R/L ! SHIFT
moves the LCD one place left. See S/C and SHIFT .
addr blk f -
At power-up R/W is vectored to execute <R/W> . R/W is the primitive which controls all access to mass storage. See <R/W> .
A user variable containing the initial location of the return stack. See RP! .
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! .
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! .
Move n from return stack to the data stack.
A user variable needed by RBAUD , but not normally useful otherwise. It returns the address where is stored a double number related to the second serial port. See library program _SERIAL2.TDS.
Sets the receive baud rate for the second serial port, available on pins SIN2 and SOUT2. It is independent of the transmit baud rate. E.g.
1200 RBAUD 75 TBAUD
to set Prestel rates. Non-standard baud rates can be used. See also *EMIT *(KEY) *?TERMINAL TBAUD .
SYNTAX: : cccc . RECURSE . ;
Allows recursion. This is an immediate word which compiles the code field address (cfa) of the word currently being defined. 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.
addr n -
SYNTAX: : cccc .
COMPILING: At compile-time REPEAT compiles BRANCH and the offset from HERE to addr. n is used for error checking.
EXECUTING: At run-time forces an unconditional branch back to just after the corresponding BEGIN .
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, .
On the TDS9092 delay by n x 3.26�s approx. The watchdog timer is not serviced so use only for delays up to 106ms. Over this use WAIT or MS .
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 RTI instruction at the end of the interrupting word. ASSIGN and LATER have examples.
Moves the terminal cursor right one position. If this does not work see HOME .
Assembler word. Rotate left accumulator or memory location. Carry bit goes into bit 0 and bit 7 is moved into the carry. E.g.
rotates accumulator B left.
Rolls nth item on stack to the top, others move down one place. Its use is not good Forth. Try splitting the definition so that the stack depth is not so great.
Assembler word. Rotate right accumulator or memory location. Carry bit goes into bit 7 and bit 0 is moved into the carry. E.g.
rotates right the content of address hex 8000.
n1 n2 n3 - n2 n3 n1
Rotate the top 3 stack entries.
- 44 (hex)
Assembler word. The address provided contains the pointer to the Forth system return stack.
Initialise the return stack pointer from the user variable R0 . Clears the return stack.
Return from Interrupt assembler instruction ending a code definition which makes that definition an interrupt routine. E.g.
Return from Subroutine assembler instruction ending a code definition which makes that definition a subroutine. E.g.