# Category : Modula II Source Code

Archive : M2TUTOR.ZIP

Filename : TABCONT.TXT

CORONADO ENTERPRISES

MODULA-2 TUTOR - Version 2.0

This documentation and the accompanying software, including all

of the example Modula-2 programs and text files, are protected

under United States copyright law to protect them from unauth-

orized commercialization. This version of the tutorial is dis-

tributed under the shareware concept, which means you are not

required to pay for it. You are permitted to copy the disks,

and pass the copies on to a friend, provided that you do not

modify any files or omit any files from the complete package,

and you are in fact encouraged to pass on complete copies to

friends. You are permitted to charge a small fee to cover the

costs of duplication, but you are not permitted to charge any-

thing for the software itself.

If you find the tutorial helpful, you are encouraged to register

with the author and to submit a small fee to help compensate him

for his time and expense in writing it. We will provide you

with a beautifully printed copy of this tutorial if you submit a

full registration. See the READ.ME file on either diskette for

additional details.

Whether or not you send a registration fee, feel free to request

a copy of the latest list of available tutorials and a list of

the authorized Public Domain libraries that distribute our full

line of programming language tutorials.

Gordon Dodrill - Jan 18, 1989

Copyright (c) 1989, Coronado Enterprises

Coronado Enterprises

12501 Coronado Ave NE

Albuquerque, New Mexico 87122

MODULA-2 TUTORIAL - TABLE OF CONTENTS

Introduction to the Modula-2 tutorial Page I-1

FIRSTEX.MOD The first example program I-5

Part I - Modula-2 is like Pascal

Chapter 1 - What is a computer program? Page 1-1

Chapter 2 - Getting started in Modula-2 Page 2-1

PUPPYDOG.MOD The minimum Modula-2 program 2-1

WRITESM.MOD Write something on the monitor 2-3

MODCOMS.MOD Modula-2 comments 2-4

GOODFORM.MOD Good formatting example 2-5

UGLYFORM.MOD Ugly formatting example 2-5

Chapter 3 - The simple Modula-2 data types Page 3-1

INTVAR.MOD Integer variables 3-2

INTMATH.MOD Integer variable math examples 3-4

CARDMATH.MOD Cardinal variable math examples 3-6

REALMATH.MOD Real variable math example 3-7

REALTRIG.MOD Trigonometric example 3-8

BOOLMATH.MOD Boolean variable math example 3-9

CHARDEMO.MOD Character variable demonstration 3-10

TRANSFER.MOD Transfer between types 3-12

Chapter 4 - Modula-2 loops and control structures Page 4-1

LOOPDEMO.MOD Loop demonstration 4-1

IFDEMO.MOD Conditional branching 4-5

LOOPIF.MOD Loops and IF's together 4-6

TEMPCONV.MOD Temperature conversion 4-6

DUMBCONV.MOD Poor variable names 4-7

CASEDEMO.MOD CASE demonstration 4-7

BIGCASE.MOD Bigger case example 4-8

Chapter 5 - Modula-2 procedures Page 5-1

PROCED1.MOD Simple procedures 5-2

PROCED2.MOD Procedures with variables 5-3

PROCED3.MOD Multiple variables 5-6

PROCED4.MOD Scope of variables 5-6

PROCED5.MOD Procedure calling procedures 5-7

FUNCTION.MOD An example function 5-7

RECURSON.MOD An example with recursion 5-8

Chapter 6 - Arrays, types, constants, and labels Page 6-1

ARRAYS.MOD Simple arrays 6-1

ARRAYS2.MOD Multiple arrays 6-2

TYPES.MOD Example of types 6-3

CONSTANT.MOD Example of constants 6-5

ARAYPASS.MOD Pass Array to Procedure 6-6

STRINGEX.MOD String Handling Examples 6-7

Chapter 7 - Overall Program Construction Page 7-1

OVERPROG.MOD Overall Program Construction 7-1

MOREPROG.MOD More Program Construction 7-2

LASTPROG.MOD Scrambled Order of Definitions 7-3

Chapter 8 - Input/Output and Printing Page 8-1

SIMPLOUT.MOD Simple Monitor Output 8-1

SIMPLIN.MOD Simple Keyboard Input 8-3

FILEIO.MOD File I/O with InOut 8-5

VARYFILE.MOD Variable Filename Input 8-7

PRINTFLE.MOD Printer and File Output 8-9

Chapter 9 - Example Programs Page 9-1

TIMEDATE.MOD Time and Date Example 9-1

AREAS.MOD Calculate Areas 9-1

PC.MOD Printer Control 9-2

LIST.MOD List Program File 9-2

Part II - Advanced Topics

Chapter 10 - Scalars, subranges, and sets Page 10-1

ENTYPES.MOD Enumerated Types 10-1

SUBRANGE.MOD Subranges 10-3

SETS.MOD A SET example 10-5

Chapter 11 - Records in Modula-2 Page 11-1

SMALLREC.MOD A Small Record Example 11-1

BIGREC.MOD A Larger Record Example 11-2

VARREC.MOD A Variant Record Example 11-5

Chapter 12 - Pointers and Dynamic Allocation Page 12-1

POINTERS.MOD Pointer Example 12-1

DYNREC.MOD A Dynamically Allocated Record 12-4

LINKLIST.MOD A linked List 12-6

Part III - Modula-2 extends Pascal

Chapter 13 - Modules, Local and Global Page 13-1

LOCMOD1.MOD Local Module Demonstration 13-1

LOCMOD2.MOD Local Module Demonstration 13-4

CIRCLES.DEF Global Module - Definition 13-5

CIRCLES.MOD Global Module - Implementation 13-6

GARDEN.MOD Calls Module "MYCALCUL" 13-9

GARDEN2.MOD Calls Module "MYCALCUL" 13-9

OPAQUETY.DEF Opaque type definition 13-10

OPAQUETY.MOD Opaque type implementation 13-10

OPTYPE.MOD Use opaque type 13-11

PROCTYPE.MOD Procedure Type Example 13-11

Chapter 14 - Machine Dependent Facilities Page 14-1

TYPEREL.MOD Type relaxation 14-1

WORDADDR.MOD WORD and ADDRESS example 14-3

ADRSTUFF.MOD Address manipulation 14-4

Chapter 15 - Concurrency in Modula-2 Page 15-1

COROUT.MOD A Simple Coroutine 15-2

COROUT2.MOD Added Features 15-4

COROUT3.MOD Triple Coroutines 15-5

RANPROC.MOD Random processes 15-5

INFINITE.MOD Infinite Execution Loop 15-6

Chapter 16 - Complete example programs Page 16-1

BAKLIST.MOD Get All filenames From Disk 16-1

BAKCOPY.MOD Copy files from Fixed to Floppy 16-2

BAKRSTR.MOD Read Floppy back to Fixed Disk 16-2

DIRHELPS.DEF Directory help procedures 16-3

DIRHELPS.MOD 16-3

BITOPS.DEF Bit Level Operations 16-3

BITOPS.MOD 16-3

REAL2MON.DEF Real outputs to the monitor 16-3

REAL2MON.MOD 16-3

REAL2FIL.DEF Real outputs to a file 16-3

REAL2FIL.MOD 16-3

ABOUT THE AUTHOR

_________________________________________________________________

The author of this tutorial began programming in 1961 using FORTRAN

on an IBM 1620. Since then most of his career has been involved

with designing digital logic for satellite application. In 1983,

being somewhat burned out with logic design, he began a study of

some of the more modern programming languages and has since made

a complete career shift to software development. After learning

Pascal, C was studied, followed by Modula-2 and Ada. Rather than

simply learning the syntax of each new language, modern methods of

software engineering were studied and applied to effectively

utilize the languages. He is currently employed by a large

research and development laboratory where he continues to study,

teach, and apply the newer programming languages.

Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/