# The Complete FORTH

Alan Winfield

In English

Publisher: Sigma Press, 1983

ISBN: 0-905104-22-6 (Wikipedia Book Sources) (Wikipedian kirjalähteet)

FORTH is a new, unusual and exciting computer language. Originally developed to control telescopes, it has since been applied in many diverse fields including the animation sequences for 'Star Wars'.

FORTH is a compact and fast language: faster than BASIC yet more flexible. It is more than just a language: it is a programming language, editor, assembler and disk operating system all rolled into one. In short, a complete 'environment'. This book describes the standard dialect of FORTH, together with numerous examples, exercises and complete programs. Read it - you'll never use BASIC again.

Introducing FORTH
How is FORTH differentviii
How best to read this bookix
For Handy Referencexi
For Computer Professionalsxi

Chapter 1 FORTH Fundamentals
1.1 Speak FORTH1
1.2 Stack1
1.3 FORTH Arithmetic2
1.4 Further FORTH Arithmetic3
1.6 Some DUPlication6
1.7 More Stack Manipulation7
1.8 Summary and Exercises8

Chapter 2 The FORTH WORD
2.1 FORTH in Action11
2.2 The FORTH Error12
2.3 The FORTH Variable13
2.4 A Closer look at VARIABLE14
2.5 The FORTH CONSTANT16
2.6 Summary and Exercises17

Chapter 3 The COLON Definition
3.1 Colon Calculations21
3.2 More Percentages22
3.3 Colon Definition or Program?23
3.4 Interpret?..Compile?24
3.5 Creating tables and arrays25
3.6 The Stack Notation Extended27
3.7 Summary and Exercises28

Chapter 4 FORTH Structures 1, IF
4.1 True or False?31
4.2 The IF strucure defined32
4.3 Nested IF structures33
4.4 Logical Operators for Complex Conditionals34
4.5 The Missing Comparison operations
4.6 Summary and Exercises37

Chapter 5 FORTH Structures 2, Loops
5.1 The DO loop41
5.2 The DO loop in action42
5.3 Loop Calculations43
5.4 +LOOP for interesting increments44
5.5 Nested DO loops and other specialities44
5.6 The UNTIL loop46
5.7 The WHILE loop47
5.8 FORTH structures in action48
5.9 Summary and Excercises49

6.2 The Editor55
6.3 More BLOCK handling58
6.3 Vocabulary Management60
6.4 Summary62

Chapter 7 Number and String Input and Output
7.1 Characted input-output, the basics65
7.2 String input-output 166
7.3 String input-output 268
7.4 Number Bases70
7.5 Alternative number input71
7.6 Summary72

Chapter 8 Double Precision and beyond
8.1 Double Precision Numbers75
8.2 Mixed Precision77
8.3 The Return stack for High Speed Definitions78
8.4 Formatted Number Output80
8.5 Fixed Point Arithmetic82
8.6 Summary84

Chapter 9 Extending FORTH
9.1 Defining new Defining words87
9.2 The last wornd on ARRAYs89
9.3 A STRING variable90
9.4 Self Modifying Data structures93
9.5 A Closer Look at the Dictionary94
9.6 Defining new Compiling words97
9.7 Summary100

Chapter 10 FORTH Finale
10.1 The Calerndar Vocabulary103
 10.1.1 Zeller's Congruence
103
 10.1.2 Daynumber and day
105
 10.1.3 Month, year and daysleft
106
 10.1.4 The Calendar Vocabulary blocks listed
107
10.2 A Video Game Vocabulary109
 10.2.1 The Ball handling routines
110
 10.2.2 Bat handling
112
 10.2.3 The Squash game
112
 10.2.4 The Videogame Vocabulary blocks listed
114
Bibliography116