Go to Triangle Digital Support Home Page TDS2020F TECHNICAL MANUAL
Forth word list
M* to OVER
Live website search
Enter key words
 

M*                    ANS

 

n1 n2 - d

 

d is the 32-bit signed product of 16-bit signed numbers n1 and n2.

 

M*/                    ANS

 

d1 n1 +n2 - d2

 

Multiply d1 by n1 producing the triple-cell 48-bit intermediate result t. Divide t by +n2 giving the double cell quotient d2.

 

M+                    ANS

 

d1 n - d2   or

ud1 n - ud2

 

Add n to underlying 32-bit double number.

 

M/MOD

 

ud1 u1 - u2 ud2

 

Divide unsigned 32-bit dividend ud1 by unsigned 16-bit divisor u1 to give a 32-bit quotient ud2 and 16-bit remainder u2.

 

MARKER                    ANS

 

'<spaces>name' -

 

Parse name delimited by space. Create definition for 'name' with the execution action shown.

 

name EXECUTION:   -

Restore all dictionary allocation and search order pointers to the state they had just prior to the definition of name. Remove the definition of name and all subsequent definitions. For example put

MARKER TASK

at the start of a section of program. Subsequent execution of TASK will delete all definitions in that section from the dictionary.

 

MA                    xANS

 

n1 n2 - n3

 

n3 is the greater of n1 and n2.

 

MI

 

- 2A (hex)

 

SYNTAX:

CODE ccc . MI IF, . THEN, .

END-CODE

Assembler word. Condition code for use before IF, WHILE, and UNTIL, - see IF, . The IF, is true when in the status register N = 1 (negative flag set).

 

MIN                    ANS

 

n1 n2 - n3

 

n3 is the lesser of n1 and n2.

 

MINS

 

- aa

 

A system variable forming part of the on-board clock. Contains minutes since midnight (or since power-on if clock has not been set). It is zeroed every 24 hrs, when the variable DAYS is incremented. See TICKS .

 

MOD                    ANS

 

n1 n2 - n3

 

Divide n1 by n2 giving the remainder n3. This has the same sign as n1.

 

MOVE                    ANS

 

ca1 ca2 u -

 

Copy contents of u consecutive addresses at ca1 to the u addresses starting at ca2. This can be used even if the source and destination areas overlap.

 

MOVFPE,

 

-

 

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

CODE PC@ ( addr - byte )

 \ Fetch byte from peripheral

 \ which needs E clock

  @R7+ R2 MOVI, R3 CLR,

  B 0 @R2 R3 MOVFPE,

  @-R7 R3 MOVO, END-CODE

 

MOVI,

 

-

 

Assembler instruction, See assembler section and MOV in Programming Manual. Moves are treated as 3 separate types, MOVe In, MOVe Out, and MOVe IMmediate. Syntax examples:

B R2 R3 MOVI, \ Move R2 to

  \ R3, lower byte only

$FF00 )) R3 MOVI, \ Move word

  \ at hex FF00 to R3

@R7+ R3 MOVI, \ Pull top of

  \ stack to R3

6 ## R2 MOVI, \ Put literal 6

  \ into register 2

 

MOVIM,

 

-

 

Assembler instruction, See assembler section and MOV in Programming Manual. Moves are treated as 3 separate types, MOVe In, MOVe Out, and MOVe IMmediate. Syntax examples:

@-R7 6 ## MOVIM, \ Move 6 to

  \ top of stack

$FF00 )) 1234 ## MOVIM,

  \ Move decimal 1234 to

  \ address hex FF00

 

MOVO,

 

-

 

Assembler instruction, See assembler section and MOV in Programming Manual. Moves are treated as 3 separate types, MOVe In, MOVe Out, and MOVe IMmediate. Syntax examples:

$FF00 )) R3 MOVO, \ Move word

  \ in R3 to hex FF00

@-R7 R3 MOVO, \ Push R3 to

  \ top of stack

 

MOVTPE,

 

-

 

Assembler instruction. See assembler section and MOVTPE in Programming Manual. Syntax example:

CODE PC! ( byte addr - )

 \ Put byte from peripheral

 \ which needs E clock

@R7+ R2 MOVI, @R7+ R3 MOVI,

B 0 @R2 R3 MOVTPE, END-CODE

 

MS                    ANS

 

u -

 

Wait at least u milliseconds where u is 0 to 65535 (approximately 65 seconds). When using the TDS2020DV the delay will be about 2.13ms per unit. Also, it may be longer when multitasking or with interrupts running. Include file #TIMING.TDS to get precise milliseconds based on the 19.6608MHz crystal frequency rather than on software loops.

 

MULXU,

 

-

 

Assembler instruction, See assembler section and MULXU in Programming Manual. Syntax example:

CODE UM* ( u1 u2 - ud )

 0 @R7 R2 MOVI,

 2 @R7 R2 MULXU,

 2 @R7 R3 MOVO,

 0 @R7 R2 MOVO,

END-CODE

 

N

 

-

 

SYNTAX:

CODE cccc . MI N IF,  . THEN,  .

END-CODE

Assembler word. Negates the effect of a condition code immediately preceding it. E.g.

CODE 0<> ( n - f ) 0 @R7 TST,

EQ N IF, \ top of stack not 0

0 @R7 1 ## MOVIM,

 \ change to 1

THEN, END-CODE

 

N>LINK

 

nfa - lfa

 

Converts a name field address to a link field address.

 

NEG,

 

-

 

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

R2 NEG, \ Negate register 2

B $FF00 )) NEG, \ Negate byte

  \ at address FF00

 

NEGATE                    ANS

 

n1 - -n1

 

Negate n1, giving its arithmetic inverse -n1.

 

NEWKEY

 

- n (0 to 64)

 

Internally uses INKEY to scan a keyboard in a matrix of up to 8 x 8. See INKEY . Normally returns 0 but gives the key number if that key is different from last time NEWKEY was called. The key number is stored in system variable LASTKEY by this word and so the latest key is always available to the system. E.g.

: TEST

  BEGIN NEWKEY ?DUP

   IF DUP 1 = IF QUIT ELSE .

   THEN THEN

  AGAIN ;

This displays key numbers as each is pressed until key number 1, when the program ends.

 

NEXT

 

- aa

 

Assembler word. The address returned is a constant that is the entry point into the Forth system. NEXT is sometimes needed in the form NEXT JMP, . The alternative code NEXT 2- JMP, pushes R3 to the stack, then enters Forth.

 

NIP                    ANS

 

x1 x2 - x2

 

Drop the first item below the top of stack.

 

NOP

 

-

 

Do nothing. Used to back-patch Forth code (not recommended).

 

NOP,

 

-

 

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

NOP, \ Does nothing, just

 \ wastes time

 

NOT

 

x - flag

 

Flag is true if x is equal to zero. On the TDS2020F it is exactly the same as the ANS word 0= which should be used in an ANS Forth program.

 

NOT,

 

-

 

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

0 @R7 NOT, \ Invert every bit

  \ of top word of stack

$FF00 )) NOT, \ Invert bits

  \ at addr FF00 & FF01

 

NOW

day.month.year -   or

month.day.year -

 

Use this to set the date in the on-board clock. The double number expected is in the format XX.YY.ZZ or XX/YY/ZZ where XX is the day, YY the month and ZZ the year. E.g.

23.06.02 NOW

sets 23rd June 2002. Note that each element must be two digits, made up with zeros if necessary. TDS-PC for Windows uses this word on initialisation to set the clock in the TDS2020F to that in the user's PC. If the word USA has been executed the input format should be month.day.year e.g.

06.23.02 NOW

 

OF                    ANS

 

COMPILATION:   4 - 4 of-sys 5

Append run-time action to the current definition. The structure will be incomplete until of-sys is resolved by ENDOF . See CASE for an example of use.

 

RUN-TIME:   x1 x2 -     or

x1 x2 - x1

If the two values on the stack are not equal, discard the top value and continue execution at the location specified by the resolution of of-sys, i.e. at ENDOF . Otherwise discard both values and continue execution in-line.

 

OFF

 

aa -

 

Stores false (0) to address aa.

 

ON

 

aa -

 

Stores true (-1) to address aa.

 

ONE

 

ca n -

 

Set bit n (0 to 7) at address ca. Opposite is ZERO .

 

OR                    ANS

 

x1 x2 - x3

 

x3 is the logical 'or' of x1 with x2.

 

OR,

 

-

 

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

B $FF8E )) R3 OR, \ Inclusive

  \ OR byte at FF8E, Port 7

  \ data register, with the

  \ lower byte of R3

 

ORC,

 

-

 

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

B 1 ## CCR ORC, \ Logically

  \ OR immediate 1 with

  \ condition code register.

  \ i.e. set carry flag

 

OUT

 

- aa

 

A user variable incremented by <EMIT> and reset to zero by CR . It will normally contain the current output column number that the user can examine to control display formatting.

 

OVER                    ANS

 

x1 x2 - x1 x2 x1

 

Place a copy of x1 on top of the stack.

 

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