User Tools

Site Tools


tutorials:forth

This is an old revision of the document!


FORTH-10 is a Forth language interpreter included in the Panda TOPS-20 distribution. The anonymous programmer describes the implementation as “NOT totally standard”. The interpreter can be started with the following command on TWENEX:

@FORTH

MIDAS assembly language source is available in file TOPS20:<UTILITIES>FORTH.MID.

Primitive Dictionary

Arithmetic

plus

+ ( n1 n2 – n1+n2 )

one-plus

1+ ( n – n+1 )

minus

- ( n1 n2 – n1-n2 )

one-minus

1- ( n – n-1 )

star

* ( n1 n2 – n1*n2 )

negate

MINUS ( n – -n )

abs

ABS ( n – |n| )

max

MAX ( n1 n2 – n ) n is the greater of n1 or n2

min

MIN ( n1 n2 – n ) n is the lesser of n1 or n2

slash

/ ( n1 n2 – n1/n2 ) integer division

mod

MOD ( n1 n2 – n ) n is the modulus of n1/n2

slash-mod

/MOD ( n1 n2 – n3 n4 ) n3 is the modulus of n1/n2, n4 is the integer quotient (n1 = n2*n4+n3)

f-plus

F+ ( r1 r2 – r1+r2 ) floating point addition

f-minus

F- ( r1 r2 – r1-r2 ) floating point subtraction

f-star

F* ( r1 r2 – r1*r2 ) floating point multiplication

f-slash

F/ ( r1 r2 – r1/r2 ) floating point division

Stack manipulation

drop

DROP ( n – )

dup

DUP ( n – n n )

over

OVER ( n1 n2 – n1 n2 n1 )

pick

PICK ( n1 – n2 ) n2 is the n1th item from the top of the stack

swap

SWAP ( n1 n2 – n2 n1 )

Start-Up File

At start-up, FORTH-10 searches the user's log-in directory for a file named AUTO-LOAD.4TH. If such a file exists, it is loaded automatically. If the file does not exist, FORTH-10 displays a standard greeting message.

tutorials/forth.1641469181.txt.gz · Last modified: 2022/01/06 11:39 by papa