An important notice and disclaimer: this is human made software and 
is prone to errors.
You could call it monkey software.
It's a hobby project, I needed to get it out of my system.
See if I could do it.

Not for use in rockets and other mission critical appliances or vehicles.
Suited for Tie-fighters, nonetheless, as they always get blown up.

This is a list of commands you can use in the Turbo Forth interpreter.
Dit is een lijst met opdrachten in de Turbo Forth programmeertaal.

Calculations are done with Reverse Polish notation, or in case you 
want to
    use "infix"-notation, with the VAL command.
De berekeningen kunnen worden gedaan met omgekeerde Poolse notatie,
    of met het VAL commando.
Forth and Turbo Forth

.S is short for "write the top stack value."

5 5 1 + + .S
|5|5|1| ---> |5|6| ----> |11| ---> '11'.

(*'.S' and 'PRINT' are equivalents.*)

e.g.:
5 7 + .S               ---> output is 12
"5+7" VAL .S           ---> output is 12
"1+1+1+1" VAL .S       ---> output is four (4)
3 VALUE "VALUE*7" .S   ---> output is 21 (* <--- Vars not implemented here
                                                 anymore *)
LPRINT or .LPRINT  ---> .S, maar naar uw drukker (printer);

4 5 + LPRINT ---> prints "9" through your printer
                    (hardware printing device) .... ... .... ..
{---------------------------------------------------------------++++}

Program control flow:
Iteraties en sprongen:

a) FOR
1 17 FOR "Dit is zeventien maal deze zin." .S
1 17 FOR "Sentence here * 17" .S
INDEX is a special reserved word and SOLID BUILT-IN VARIABLE FOR
use with the FOR -loop.

e.g.: VGA 1 17 FOR 640 2 / 480 2 / INDEX CIRCLE

b) GOTO
100 110 GOTO
110 "I jumped to here." .S STOP

c) GOSUB, RETURN (* --> not implemented anymore *++*)
(Line 1 in editor) 100 120 GOSUB
(Line 2 in editor) 110 "On hold, for a very short time." .S STOP
(Line 3 in editor) 120 "At 120" .S RETURN

d) DO            (* --> not implemented anymore ++*)
   END

This executes the code within in an endless loop.
It can be broken with reading a key with INKEY$ and then seeing
what key was pressed.

e) SYSTEM, STOP: this ends the execution of the current program in
      the computer memory.

f) IF: I can only give an example.
  1 1 = IF "The numbers are equal." PRINT
  or:
      1 1 = IF "The numbers are equal." .S
      1 0 = IF "Equal" .S ELSE "Not Equal." .S

{------------------------------------------------------------++++}

Screen and graphics:
Scherm en grafisch:

CLS clears the screen.

INK and PAPER can be used in both modes.
INK sets the foreground colour (0..15).
PAPER sets the background colour (0..15).

   Dark Colors  Ί
  (Foreground & Ί  Light Colors
   Background)  Ί  (Foreground)
 ΝΝΝΝΝΝΝΝΝΝΝΡΝΝΝΞΝΝΝΝΝΝΝΝΝΝΝΝΝΝΡΝΝΝΝ
  Black     ³ 0 Ί DarkGray     ³  8
  Blue      ³ 1 Ί LightBlue    ³  9
  Green     ³ 2 Ί LightGreen   ³ 10
  Cyan      ³ 3 Ί LightCyan    ³ 11
  Red       ³ 4 Ί LightRed     ³ 12
  Magenta   ³ 5 Ί LightMagenta ³ 13
  Brown     ³ 6 Ί Yellow       ³ 14
  LightGray ³ 7 Ί White        ³ 15

For flashing (blinking) text foreground, Blink
= 128.

e.g.
TEXT "This is blinking green." 2 128 + INK .S

a) TEXT
  puts the screen into 80x25, 16 colours Text Modus.
  The cursor is visible here.

b) VGA
  puts the screen into 640x480, 16 colours Graphics Modus.

  b-0) PUTPIXEL, takes two parameters.
  b-1) LINE, takes four parameters.
  b-2) RECTANGLE, takes four parameters.
      e.g.: VGA 11 11 111 111 RECTANGLE
        "---->draws a square in Graphics Modus.
  b-3) CIRCLE, takes three parameters.
  The Graphics primitives are drawn in default LIGHTGRAY,
                                           or colour set by INK.
c) 1 1 LOCATE   --> Locates the cursor at the top left corner of the screen.

d) INPUT --> scans if it's a number or a string, then puts it on the stack.
e) INKEY$ --> waits for a keypress and puts the one character string on
              the stack.
    (^ you can flush the key out with the FLUSH command ++)++
f) KEYPRESSED --> pushes 1 on the stack if a key is pressed,
                  0 otherwise... .... ...
e.g.:

100 0 KEYPRESSED = IF 100 GOTO ELSE STOP

{------------------------------------------------------------------++++}
String functions:
  a) MID$
     e.g.
     TEXT "Honest Abe Lincoln." 8 3 MID$ .S
     "--->prints: 'Abe' on the screen.
  b) LEFT$
  c) RIGHT$
  d) UCASE$ puts a string into uppercase.
  e) LCASE$ puts a string into lowercase.
  f) INKEY$: this waits for a keypress and pushes the key character
               on the stack.
            e.g.: to wait for a key and check if it is a certain key....
                 "--=> TEXT INKEY$ LCASE$ "q" = IF SYSTEM
            You can use the FLUSH command with inkey.
            This removes the key from the stack, if you're only doing this:
               "Press any key to continue......."
  g) STRCAT$: this glues text strings together (called concatenate)... ..
  h) INSTR: returns a number with the position of "this" "here this" INSTR .S
  i) ASCII: for instance, "\" ASCII .S, outputs: 92, the character code of
                                             "\"... ..
  j) CHR$: 92 CHR$ .S, should produce an "\" on the screen.


{----------------------------------------------------------------++++}
Dos commands:
Dos-opdrachten:

a) SHELL
e.g.: TEXT "dir *.*" SHELL INKEY$ FLUSH STOP
this lists the directory in the current drive, waits for the any key and
the program terminates.

b) COPY ---> copies a file
             kopi"eert een bestand... .... ....

e.g.:

"HELP.4th" "HELP.BAK" COPY

{-------------------------------------------------------------++++}
Variables:
Variabelen:

Any other name than a taken token name preceded by keyword VAR (a command),
5 VAR MONKEY
this defines the variable monkey and puts the number five in it.

RECALL or MRC
RECALL MONKEY
that puts 5 on the stack ... .... ...

You can, later in your program, call up the with RECALL MONKEY.... .
... ......

or, "Abe" VAR PRESIDENT$
    RECALL PRESIDENT LEN .S ----> prints 3.0000
(*--------------------------------------------------------------------*)

(Unexpected machine control)
SEGMENT: sets the segment of the (more global) place (address),
         where to peek and poke in the computer
47104 SEGMENT --> sets the base address to the beginning of the text
                  screen memory. ... .. .... ..
POKE & PEEK


{*++++---------------------------------------------------------------++*}
ROUND rounds a real or broken number.

{*--------------------------------------------------------------------++*}
HOUR      --> great with LOCATE
MINUTES
SECONDS
SECONDS100

(*---------------------------------------------------------------------++*)

File handling:
by example:;

OPEN, READ, WRITE, EOF

e.g.:

100 "W" "DATA.DAT" OPEN
110 INPUT WRITE
120 CLOSE
130 "Type data.dat" SHELL

(*//++****EOF*++*++)
