channel - n
Analog to digital conversion of channel (0 to 7) giving digital value n (0 to 1023).
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 "
F>A 0 @R7 DEC, A>F
." again" .S ;
Note that F>A and A>F can be used in colon definitions only, not in words starting with CODE .
?1 - R: ?2 -
Perform the function of -1 THROW . If this is not intercepted by a program CATCH then empty the data stack and (by default) perform QUIT , which includes emptying the return stack, without displaying a message. Do not use in stand-alone systems where no operator executing Forth will be present, unless CATCH is also used. See THE INDEFINITE LOOP, page 233.
COMPILATION: ccc<quote>' -
Parse ccc delimited by " (double quote).
RUN-TIME: x -
If any bit of x is not zero, perform the function of -2 THROW displaying ccc if this is not intercepted by a program CATCH .
n - u
u is the absolute value of n.
ca +n - +n2
At power-up, is vectored through 'ACCEPT to execute <ACCEPT> but that can be changed by the application program. See <ACCEPT> 'ACCEPT .
- Multitasker files needed -
Used within a colon definition to start a task whose task-record is at addr. Use as
BEGIN 0 A-D $FF00 ! PAUSE
0 A-D $FF00 ! STOP ;
Assembler instruction, See assembler section and ADD in Programming Manual. Syntax examples:
B R2 R3 ADD, \ Add R2 to R3,
\ lower bytes only
$FF00 )) R3 ADD, \ Add word
\ at hex FF00 to R3
@R7+ R3 ADD, \ Add top of
\ stack, dropping it, to R3
Assembler instruction, see assembler section and ADDS in Programming Manual. Syntax example:
B R2 R3 ADDS, \ Add lower
\ byte of R2 with sign
\ extension to word in R3
Assembler instruction, see assembler section and ADDX in Programming Manual. Syntax example:
W $FF00 )) R3 ADDX, \ Add
\ word at hex FF00 and
\ carry bit to word in R3
COMPILATION: dest 1 -
Append the run-time action below to the current definition, resolving the backward reference destination. Used to create a never-ending loop, for instance in the word executed at power-up.
Unconditionally continue execution at the location specified by dest. Any program code after AGAIN will not be executed.
If the data space pointer DP or VDP is not aligned, increment to align it. On power-up (or after ROM ) DP , the pointer into the dictionary, is used. After RAM VDP , the pointer into the RAM data space is used.
ca - aa
aa is the first aligned address greater than or equal to address ca.
Reserve n bytes of data space, in line with the dictionary on power-up and after ROM , or in RAM data space after RAM .
x1 x2 - x3
x3 is the logical 'and' of x1 with x2.
Assembler instruction, see assembler section and AND in Programming Manual. Syntax example:
0 @R2 R3 AND, \ Logically AND
\ the word pointed at by
\ R2, offset 0, to
\ register R3
Assembler instruction, see assembler section and ANDC in programming manual. Syntax example:
W $0300 ## SR ANDC,
\ Logically AND immediate
\ 300 with status register
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):
: SAY . speaking words . RETURN;
-60 +ORIGIN ASSIGN SAY
ASSIGN compiles code that 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 8800-88C4 (DV version: 4000-40C4) which will go into Flash-EEPROM at the same time as the application code. In the example -60 +ORIGIN gives $8848, the jump table address for IRQ1*. If the word being assigned was defined in assembler by CODE , ASSIGN will just set the Interrupt Jump Table. While compiling, interrupts are disabled by ASSIGN .
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 one of 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 CS81C0 has completed a previous command. Used by PUT etc.