Input / Output in Volks-FORTH#

Input / output commands in VolksFORTH#

All input and output words (KEY EXPECT EMIT TYPE etc.) are vectorized in the people-FORTH, ie when called, the code field address of the associated command is taken from a table and executed. It is included in the system table wine named DISPLAY, which provides for the output to the screen terminal.

This method of vectorization offers significant benefits:

  • Nit-vectorization of the input can e.g. switch with one stroke of the keyboard on the input of a modem.
  • The output can vectorization with a new table, the total expenditure to another device (eg a printer) will be conducted without having to change the output commands themselves.
  • In a word (DISPLAY, PRINT) can all be changed spending habits. Is there such a (((print a list display))) will be issued a screen on a printer, and then falls back to the screen. So you need a new word, such PRINTERLIST to define.

A new table is created with the word OUTPUT: . The definition can output with (((view:)) look). OUTPUT: Expected to issue a list of words, with must, be completed.

Beipsiel:

Output:> PRINTER
   pemit pcr ptype pdel PPAG pat pat? ;

For a new table named > PRINTER is created. With a later call to PRINTER > is the address of this table in the Uservariable OUTPUT written. From now leads EMIT from a PEMIT, a PTYPE TYPE etc.

The order of words after OUTPUT: userEMIT userCR userType userdel Userpage userAT userAT? must necessarily be met. Accordingly, the input-vectorization is handled.

Input / output terminal on#

The state-FORTH has a number of constants which serve to improve readability:

Input / output of numbers#

The input of numbers is made in the interpretive mode via the keyboard, and basic input words are defined with number numbers and related words. For the issue of numbers again is the lack of typing of FORTH observed - for a specific data format (integer, unsigned, double) is appropriate in each case the operator to select.

Input / output via a port#

MS-DOS

Enter characters#

In FORTH you will always designate a storage area, incorporated into the characters and strings. To do this you usually use a small, 80-character memory area called PAD. This note pad - so the German translation of pad used - no fixed memory area and is both the FORTH system and the programmers.

Then I liked you with the text input buffer TIB another important Speicherberelch imagine that ensures the reasonable use of the connected devices. Because the text input via the keyboard vorsichgeht relatively slow, the characters are collected here only in a free space, the buffer TIB, and then processed.

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-4) was last changed on 21-Aug-2010 06:36 by John