TDS9092 ALPHANUMERIC WORD DEFINITIONS
Assembler word. Used before an assembly mnemonic to reference the A register. E.g.
rotate left register A.
Used to embed assembler within Forth words. An application is often written in Forth and then the inner loops are converted to assembler to gain an overall speed close to the maximum possible. The conversion process is sometimes made easier by two Forth words F>A (Forth to Assembler) and A>F (Assembler to Forth). They allow you to include sections of assembler within a normal colon definition. Try this, the bit of assembler code decrements the top item on the stack.
: TEST ( Puts 3 on the
( stack, executes some
( Forth, decrements the 3
( in assembler and then
( does more Forth
3 .S ." Hello "
Assembler word. Add accumulator B to accumulator A leaving the result in A.
Clear the stacks and enter the execution state. Return control to the operator, displaying a banner message and version number. Do not use in stand-alone systems where no operator executing Forth will be present.
n - u
Leave the absolute value of n as u. E.g. both 12 ABS and -12 ABS leave 12.
Assembler word. Add accumulator B to X register.
Assembler word. Add immediate or memory with carry. E.g.
$8000 B ADC,
adds the content of address hex 8000 to accumulator B and increments by 1 if the carry flag is set beforehand.
Assembler word. Add immediate or memory content to accumulator. E.g.
45 ## A ADD,
adds 45 to the content of accumulator A
Assembler word. Add immediate or memory to accumulator D, which is a A and B put together with A the more significant byte. E.g.
$1234 ## ADDD,
adds hex 1234 to the 16-bit content of the pair of accumulators A and B.
Sets up editor control codes to match ADDS and some
addr n -
COMPILING: Used in a colon definition paired with BEGIN . At compile time AGAIN compiles BRANCH with an offset from HERE to addr. n is used for compile-time error checking.
EXECUTING: At run time AGAIN forces execution to return to the corresponding BEGIN . There is no effect on the stack. Execution cannot leave this loop (unless R> DROP is executed one level below) .
addr imm -
Assembler word. And immediate data to the content of a memory location. E.g.
$8000 2 ## AIM,
adds 2 to the content of address hex 8000.
Adds the signed number n to the dictionary pointer DP . May be used to reserve an array of ROM for a fixed table.
n1 - n2
Used for fractional arithmetic. Converts n1 representing a fraction, to n2 representing a fraction which is its natural antilogarithm (exponent). The range of n1 is 0.0000 to 0.6931 which is a range of 0.0000 to 1.9999 in n2. E.g.
: TEST 0.2000 D>F ALOG .F ;
This prints 1.2214 which is e to the power of 0.2 (otherwise known as antilogarithm). Useful for linearising some transducers.
n1 n2 - n3
n3 is the logical and of n1 and n2.
Assembler word. Logically AND immediate or memory content to accumulator. E.g.
$9000 B AND,
ANDs the content of address hex 9000 with the content of accumulator B.
Assembler word. Shift left accumulator or memory location. Zero goes into bit 0 and bit 7 is moved into the carry bit. E.g.
shifts accumulator B left.
Assembler word. Shift left accumulator D, (A and B together, with A the more significant byte). Zero goes into bit 0 and bit 15 is moved into the carry bit. E.g.
shifts accumulators A and B left (multiply by 2).
Assembler word. Shift right accumulator or memory location. Bit 15 is duplicated and bit 0 is moved into the carry bit. E.g.
shifts accumulator A right (divide by 2).
Used at compile-time only to allow a high level Forth word to be executed on interrupt or as a regular background task (see LATER for this). For example, to cause a word SAY to be executed when a user button attached to IRQ1* input is pressed (for instance to speak a message):
. speaking words . RETURN;
ASSIGN compiles code which will allow SAY to be executed on interrupt 1. It also sets up a jump in an array of 3-byte interrupt jumps at addresses hex 0800-081D which will go into PROM at the same time as the application code. In the example IRQ1 returns the jump table address for IRQ1*.
An LCD user variable. Return address where the next character position to be written to is stored. The first position is 0. AT is cleared by PRIME WIPE and 0AT . Some LCDs have logical character positions different from the physical ones. E.g. on LM020L the 16 physical positions need 0 1 2 3 4 5 6 7 64 65 66 67 68 69 70 71 to be in AT (these numbers are decimal).
Delays until an LCD connected to chip select line CS01C0 has completed a previous command. Used by PUT etc.