Organize a program into modules
Modula-2 builds on structured programming with explicit modules and imports. A definition module describes a public interface; an implementation module supplies its code. Atari ST systems such as TDI Modula-2 brought this approach to native 68000 software development.
Example: import console input and output
MODULE AtariHello;
FROM InOut IMPORT WriteString, WriteLn, Read;
VAR
key: CHAR;
BEGIN
WriteString("HELLO FROM MODULA-2 ON THE ST");
WriteLn;
WriteString("PRESS A KEY TO FINISH");
Read(key)
END AtariHello.
HELLO FROM MODULA-2 ON THE ST PRESS A KEY TO FINISH
Shown while Read is waiting for input. After the library accepts a character, execution reaches the end of the module. This preview uses a monochrome ST console appearance.
Save this as a module source file, compile it, and link it with the system’s InOut library to make an ST executable. Run it from the desktop. The explicit import names the input/output procedures that this program needs; Read keeps the greeting visible until keyboard input arrives.
The example uses the classic InOut interface taught with ST Modula-2 systems. Library names and build commands vary between implementations, so select the matching library supplied with your compiler.
Reference: ST-Computer’s Atari ST Modula-2 course, by the tutorial authors.