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.
Table of Contents| |
| Introducing FORTH | |
| How is FORTH different | viii |
| How best to read this book | ix |
| For Handy Reference | xi |
| For Computer Professionals | xi |
| |
| Chapter 1 FORTH Fundamentals | |
| 1.1 Speak FORTH | 1 |
| 1.2 Stack | 1 |
| 1.3 FORTH Arithmetic | 2 |
| 1.4 Further FORTH Arithmetic | 3 |
| 1.5 About the Numbers | 4 |
| 1.6 Some DUPlication | 6 |
| 1.7 More Stack Manipulation | 7 |
| 1.8 Summary and Exercises | 8 |
| |
| Chapter 2 The FORTH WORD | |
| 2.1 FORTH in Action | 11 |
| 2.2 The FORTH Error | 12 |
| 2.3 The FORTH Variable | 13 |
| 2.4 A Closer look at VARIABLE | 14 |
| 2.5 The FORTH CONSTANT | 16 |
| 2.6 Summary and Exercises | 17 |
| |
| Chapter 3 The COLON Definition | |
| 3.1 Colon Calculations | 21 |
| 3.2 More Percentages | 22 |
| 3.3 Colon Definition or Program? | 23 |
| 3.4 Interpret?..Compile? | 24 |
| 3.5 Creating tables and arrays | 25 |
| 3.6 The Stack Notation Extended | 27 |
| 3.7 Summary and Exercises | 28 |
| |
| Chapter 4 FORTH Structures 1, IF | |
| 4.1 True or False? | 31 |
| 4.2 The IF strucure defined | 32 |
| 4.3 Nested IF structures | 33 |
| 4.4 Logical Operators for Complex Conditionals | 34 |
| 4.5 The Missing Comparison operations | |
| 4.6 Summary and Exercises | 37 |
| |
| Chapter 5 FORTH Structures 2, Loops | |
| 5.1 The DO loop | 41 |
| 5.2 The DO loop in action | 42 |
| 5.3 Loop Calculations | 43 |
| 5.4 +LOOP for interesting increments | 44 |
| 5.5 Nested DO loops and other specialities | 44 |
| 5.6 The UNTIL loop | 46 |
| 5.7 The WHILE loop | 47 |
| 5.8 FORTH structures in action | 48 |
| 5.9 Summary and Excercises | 49 |
| |
| Chapter 6 Editing, Saving and Loading FORTH programs | |
| 6.1 The FORTH LOADing concept | 53 |
| 6.2 The Editor | 55 |
| 6.3 More BLOCK handling | 58 |
| 6.3 Vocabulary Management | 60 |
| 6.4 Summary | 62 |
| |
| Chapter 7 Number and String Input and Output | |
| 7.1 Characted input-output, the basics | 65 |
| 7.2 String input-output 1 | 66 |
| 7.3 String input-output 2 | 68 |
| 7.4 Number Bases | 70 |
| 7.5 Alternative number input | 71 |
| 7.6 Summary | 72 |
| |
| Chapter 8 Double Precision and beyond | |
| 8.1 Double Precision Numbers | 75 |
| 8.2 Mixed Precision | 77 |
| 8.3 The Return stack for High Speed Definitions | 78 |
| 8.4 Formatted Number Output | 80 |
| 8.5 Fixed Point Arithmetic | 82 |
| 8.6 Summary | 84 |
| |
| Chapter 9 Extending FORTH | |
| 9.1 Defining new Defining words | 87 |
| 9.2 The last wornd on ARRAYs | 89 |
| 9.3 A STRING variable | 90 |
| 9.4 Self Modifying Data structures | 93 |
| 9.5 A Closer Look at the Dictionary | 94 |
| 9.6 Defining new Compiling words | 97 |
| 9.7 Summary | 100 |
| |
| Chapter 10 FORTH Finale | |
| 10.1 The Calerndar Vocabulary | 103 |
| 10.1.1 Zeller's Congruence |
| 103 |
| 105 |
| 10.1.3 Month, year and daysleft |
| 106 |
| 10.1.4 The Calendar Vocabulary blocks listed |
| 107 |
| 10.2 A Video Game Vocabulary | 109 |
| 10.2.1 The Ball handling routines |
| 110 |
| 112 |
| 112 |
| 10.2.4 The Videogame Vocabulary blocks listed |
| 114 |
| Bibliography | 116 |
| Answers to Problems | 117 |
| Glossary of FORTH Terminology | 123 |
| Index | |
| FORTH Handy Reference Card | |