Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Forth word list
C! to CURRENT
Live website search
Enter key words
 

C!                    ANS

 

char ca -

 

Store the 8 lower bits of char at address ca.

 

C"                    ANS

 

COMPILATION:   'ccc<quote>' -

Parse ccc delimited by double quote. Append the run-time action below to the current definition. Use of S" is  preferred.

 

RUN-TIME:   - ca

Return ca, a counted string consisting of ccc. A program may not change the string-it might be addressed in a locked Flash-EEPROM or PROM.

 

C+!

 

- File #EXTEND.TDS needed -

 

char ca -

 

Add lower byte of the second item on the stack to the byte at address ca.

 

C,                    ANS

 

char -

 

Reserve 8 bits of data space, in line with the dictionary at power-up (or after ROM ) and in RAM data space after RAM , and store char in the body space.

 

C@                    ANS

 

ca - char

 

Fetch 8-bit char from address ca. The unused higher-order bits are all zeros.

 

CASE                    ANS

 

COMPILATION:   - 0 4

Mark the start of the CASE .. OF .. ENDOF .. ENDCASE structure. Append the run-time action below to the current definition.

 

RUN-TIME:   -

Continue execution. The general form is:

: TEST

  CASE w OF . ENDOF

       x OF . ENDOF

       y OF . ENDOF

   . (more if needed) .

 DUP nx cond IFCASE . ENDOF

   . (default if not any of above) .

   ENDCASE

nx represents possible value(s) of n. cond is any conditional such as > = or < . E.g.

: TEST

 CASE 1 OF ." 1st case" ENDOF

      2 OF ." 2nd case" ENDOF

      3 OF ." 3rd case" ENDOF

  DUP 10 < IFCASE

          ." 4th to 9th case"

           ENDOF

      ." not 1st to 9th case"

 ENDCASE ;

If the code between the final ENDOF and ENDCASE puts something on the stack the test condition, which will be discarded by ENDCASE , must be brought back to the top of the stack. See example POINTS TO WATCH, page 71.

 

CATCH                    ANS

 

?1 xt - ?2 0   or

?1 xt - ?4 n

 

Push exception frame and execute the execution token xt (as with EXECUTE ) in such a way that control can be transferred to a point just after CATCH if THROW is executed during the execution of xt. If execution of xt does not encounter THROW , pop the exception frame and return 0 on the stack. Otherwise return error code n determined by the THROW . All run-time errors from words like ?STACK will cause the application program to restart at a position following the last CATCH whose execution has commenced but not yet finished. By default this is in the interactive Forth loop QUIT but a real-time program should include its own CATCH . See OPERATION OF CATCH AND THROW, page 146.

 

CCR

 

-

 

Assembler word. Condition Code Register.

 

CELL+                    ANS

 

aa1 - aa2

 

Add the size in address units of a cell to aa1. On the TDS2020F aa2 = aa1+2.

 

CELLS                    ANS

 

- File #ANS.TDS needed -

 

n1 - n2

 

n2 is the size in address units of n1 cells. On the TDS2020F n2 = n1*2.

 

CFIGM

 

- addr

 

A system variable, which holds the same content as the Port A and Port B configuration register. This register at address 81F0 is write only, it cannot be read back. Because of this is it useful to keep a copy in RAM so that one bit can be changed without affecting others. At power-up the content of CFIGM and the real configuration register is 00. Bits are allocated as follows:

 

Bit0:

0=Port A input

1=Port A output

Bit1:

0=Port B input

1=Port B output

 

 

   or keyboard

Bit2:

0=Not keyboard

1=Kbd mode

 

Other bits are unused. See INKEY NEWKEY . E.g.

CFIGM @ 2 OR DUP CFIGM !

$81F0 PC!

This sets Port B to be an output.

 

CHAR                    ANS

 

- File #ANS.TDS needed -

 

'<spaces>name' - char

 

Parse name delimited by a space. Put the value of its first character on to the stack. E.g.

CHAR FRED

returns decimal 70, the ASCII value of the letter F. In most cases within definitions [CHAR] will be needed, not CHAR .

 

CHAR+                    ANS

 

- File #ANS.TDS needed -

 

ca1 - ca2

 

Add the size in address units of a character to ca1, giving ca2. On the TDS2020F ca2 = ca1+1

 

CHARS                    ANS

 

- File #ANS.TDS needed -

 

n1 - n2

 

n2 is the size in address units of n1 characters. On the TDS2020F n2 = n1.

 

CLR,

 

-

 

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

B R3 CLR, \ Clear R3 lower

  \ byte

$FF00 )) CLR, \ Clear word

  \ FF00, i.e. both memory

  \ bytes at addresses

  \ FF00 & FF01

0 @R7 CLR, \ Clear top item

  \ on stack

 

CMOVE                    ANS

 

from to count -

 

Move the specified number of characters beginning at address 'from' to address 'to'. The content of address 'from' is moved first proceeding towards high memory. If source and destination address areas overlap use this to move to lower memory addresses, otherwise use CMOVE> . Or use MOVE which makes the change automatically.

 

CMOVE>                    ANS

 

from to count -

 

Move the specified number of characters beginning at address 'from' to address 'to'. The content of address 'from+count-1' is moved first proceeding towards low memory. If source and destination address areas overlap use this to move to higher memory addresses, otherwise use CMOVE . Or use MOVE which makes the change automatically.

 

CMP,

 

-

 

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

B R2 R3 CMP, \ Compare R2 to

  \ R3, lower bytes only

$FF00 )) R3 CMP, \ Compare

  \ word at hex FF00 to R3

4 @R7 R3 CMP, \ Compare third

  \ item on stack with R3.

  \ First is 0, second 2,

  \ third 4 etc.

 

CMPIM,

 

-

 

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

$FF00 )) 1234 ## CMPIM,

  \ Compare decimal 1234

  \ with word at hex FF00

 

CODE                    ANS

 

'<spaces>name>' -

 

Create a definition for name with the execution action below. Starts an assembler definition in a similar way to : for a high-level word. However CODE leaves you in the execute, not compile, state.

 

name EXECUTION:   ?1 - ?2

Execute the machine code sequence that was generated following CODE .

 

COLD

 

-

 

Cold start procedure which deletes all user definitions and restarts via START . Unlike the power-up situation COLD does not zero the real-time clock.

 

COMPARE                    ANS

 

- File #ANS.TDS needed -

 

ca1 u1 ca2 u2 - n

 

Compare the string specified by ca1 u1 to the string ca2 u2 up to the length of the shorter string or until a difference is found.

 - If the two strings are identical, n is zero.

 - If identical up to the length of the shorter string, n is -1 if u1 is less than u2 and +1 otherwise.

 - If the two strings are not identical up to the length of the shorter string, n is -1 if the first non-matching character in the string ca1 u1 has a lesser numeric value than the corresponding character in the string ca2 u2, and +1 otherwise.

 

COMPILE

 

-

 

SYNTAX:
 
 : ccc . COMPILE nnn . ;

When the word ccc containing COMPILE executes, the execution address of nnn is copied (compiled) into the dictionary. This allows compilation to be deferred until run-time. Use of the ANS word POSTPONE is to be preferred in most situations.

 

COMPILE,                    ANS

 

xt -

 

Append the action of the definition represented by xt to the run-time action of the current definition.

 

CONSTANT                    ANS

 

x '<spaces>name' -

 

Create a definition for name with the execution action defined below.

 

name EXECUTION:   - x

Place x on the stack.

 

CONTEXT

 

- aa

 

A user variable containing a pointer to the address that contains the name field address of the first word in a linked list used for dictionary searches.

 

CONVERT                    ANS

 

ud1 ca1 - ud2 ca2

 

ud2 is the result of converting the characters within the text beginning at the first character after ca1 into digits, using the number in BASE . Conversion continues until a character that is not convertible is encountered. ca2 is the location of the first unconverted character. This word is obsolescent and >NUMBER supersedes it.

 

COUNT                    ANS

 

ca1 - ca2 u

 

Return the character string specification for the counted string stored at ca1. ca2 is the address of the first character after ca1. u is the contents of the character at ca1 which is the length in characters of the string at ca2.

 

CR                    ANS

 

-

 

Cause subsequent output to appear at the beginning of the next line. The column counter OUT is zeroed.

 

CREATE                    ANS

 

'<spaces>name' -

 

Parse name delimited by space. Create a definition for name with the action shown below. The new data-space pointer defines name's data field and will be aligned. CREATE does not allocate any data space in name's data field. Use CREATE to make both tables and defining words.

 

name EXECUTION:   - aa

aa is the address of name's data field. The execution action may be extended by DOES> .

 

CS

 

- 24 (hex)

 

SYNTAX:

CODE ccc . CS IF, . THEN, .

 END-CODE

Assembler word. Condition code for use before IF, WHILE, and UNTIL, . The IF, is true when in the status register C=1 (carry flag set). See IF, .

 

CSP

 

- aa

 

A user-variable temporarily storing the stack pointer position for compilation error checking.

 

CURRENT

 

- aa

 

A user variable containing a pointer to the address that contains the name field address of the first word in a linked list to which definitions will be added.

 

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