Microsoft TASC The Applesoft Compiler Microsoft(TM) TASC(TM) User's Manual Microsoft Consumer Products A Division of Microsoft, Inc. 400 108th Ave NE. Suite 200 Bellevue, WA 98004 Information in this document is subject to change without notice and does not represent a commitment on the part of Microsoft. The software described in this document is furnished under a license agreement. The software may be used or copied only in accordance with the terms of the agreement. It is against the law to copy the software in this package on any medium for any purpose other than personal use. Copyright (C) Microsoft, Inc. 1981 LIMITED WARRANTY MICROSOFT, INC. shall have no liability or responsibility to purchaser or to any other person or entity with respect to any liability, loss or damage caused or alleged to be caused directly or indirectly by this product, including but not limited to any interruption of service, loss of business or anticipatory profits or consequential damages resulting from the use or operation of this product. This product will be exchanged within twelve months from date of purchase if defective in manufacture, labeling, or packaging, but ex- cept for such replacement the sale or subsequent use of this program is without warranty or liability. THE ABOVE IS A LIMITED WARRANTY AND THE ONLY WARRANTY MADE BY MICROSOFT, INC. ANY AND ALL WARRANTIES FOR MERCHANTABILITY AND/OR FIT-NESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY EXCLUDED. TASC is a trademark of Microsoft, Inc. Apple II and Apple II Plus are registered trademarks of Apple Computer, Inc. 8106-200-00 SYSTEM REQUIREMENTS TASC(TM) requires an Apple II Plus(R) or an Apple II (R) with the Applesoft firmware card installed, 48K RAM and a minimum of one disk drive. TASC supports but does not require the Microsoft RAMCard(TM) or Apple Language System *************************************************************************** Contents 1 Introduction ... 1 1.1 How to Use this Manual ... 3 1.2 Contents of the TASC Package ... 5 1.3 Resources for Learning Applesoft ... 6 2 Demonstration Run ... 7 3 Introduction to Compilation ... 11 3.1 Vocabulary ... 11 3.2 Compilation vs. Interpretation ... 11 3.3 The Program Development Process ... 14 4 Debugging with the Applesoft Interpreter ... 17 4.1 Creating a Source Program ... 17 4.2 Running a Program with Applesoft ... 17 5 Compilation ... 19 5.1 Options ... 19 5.2 Terminating Compilation ... 24 5.3 Compiling Large Programs ... 25 6 Executing a Compiled Program ... 29 7 A Compiler/Interpreter Language Comparison ... 31 7.1 Statements Not Implemented ... 31 7.2 Features Supported with Limitations ... 32 7.3 Other Language Differences ... 35 7.4 Operational Differences ... 37 8 Language Enhancements ... 45 8.1 Integer Arithmetic ... 45 8.2 CHAIN with COMMON ... 51 9 How the Compiler Works ... 61 9.1 PASS0, PASS1, and PASS2 ... 61 9.2 Syntax Analysis ... 63 9.3 Code Generation ... 65 9.4 Special Thchniques ... 66 10 Error Messages and Debugging ... 69 10.1 Compiletime Error Messages ... 69 10.2 Runtime Error Messages ... 71 10.3 Sources of Common Problems ... 72 Appendix A Moving Binary Files with the ADR Utility ... 77 Appendix B Copying TASC and Converting to DOS 3.3 ... 81 Appendix C Creating a Turnkey Disk ... 83 Appendix D Notes on Applesoft ... 85 Appendix E Runtime Memory Map ... 89 Appendix F Zero Page Usage ... 91 Index ... 93 *************************************************************************** TASC -- page 1 1. Introduction Microsoft's TASC(TM) is designed to complement the Applesoft(TM) interpreter, to extend the Applesoft language, and to enhance execution of Applesoft programs. The Applesoft interpreter itself was designed by Microsoft, Inc. and later modified by Apple Computer, Inc. The interpreter/compiler combination is the ideal Applesoft program development tool since programs can be quickly entered and debugged with the interpreter, then optimized for speed with the compiler. The compiler supports the Applesoft language with only a few exceptions. Therefore most of the programs already written in Applesoft for the Apple II can be compiled with little or no change. Other major benefits provided by TASC are: 1. Increased execution speed Applesoft programs compiled with TASC normally run from two to twenty times faster than the same programs run under the interpreter. 2. Inter-program communication Programs can be made to communicate with each other with the use of COMMON variables. 3. True integer arithmetic Unlike the Applesoft interpreter, TASC can perform true integer arithmetic. Integer arithmetic can greatly increase execution speed. 4. Source-code security TASC creates machine language equivalents of Applesoft BASIC programs. This machine language file is all that *************************************************************************** TASC -- page 2 -- Introduction need be distributed when a commercial application is sold. Therefore, the Applesoft program, (called a "source" program) is protected from copy or plagiarism. 5. Disk-based compilation Unlike other Applesoft compilers that create the machine language version of the program in memory, TASC writes out the machine language program to disk as it compiles. This allows TASC to compile programs of virtually any size. These benefits are important for speed-critical applications such as graphics, and for applications in which a large system of programs needs to be supported by a main menu. TASC is also outstanding for commercial applications sold in a competitive marketplace that require source-code security. TASC is particularly good for programs that are otherwise too large to fit in memory. By separating such programs into parts and communicating between them with COMMON variables, large systems of communicating programs can be created. TASC is an example of such a large system, since TASC was separated into parts and used to compile itself. This gives an indication of the impressive power of TASC as a programming tool *************************************************************************** TASC -- page 3 -- Introduction 1.1 How to Use this Manual The first three chapters of the TASC User's Manual are designed for users who are unfamiliar with the compiler as a programming tool. Following chapters give a thorough technical description of TASC and its use. Therefore, at first this manual serves as an introduction to TASC and the compilation process; later the manual serves as a technical reference. With this structure in mind, this manual is organized as follows: Chapter 1, Introduction -- Provides brief descriptions of the con- tents of the TASC package, and gives a list of resources for learning Applesoft programming. Chapter 2, Demonstration Run -- Explains the compilation and execution of a demonstration program. Chapter 3, Introduction To Compilation -- Gives an introduction to the vocabulary associated with compilers, a comparison of inter- pretation and compilation, and an overview of program development with the compiler. Chapter 4, Debugging With The Interpreter -- Describes how to debug the source file with the Applesoft interpreter before compiling the same source. Chapter 7, A Compiler/Interpreter Language Comparison, describes differences between TASC and the Applesoft interpreter. Chapter 5, Compilation -- Describes the use of TASC in detail, including the various compiler options. Chapter 6, Executing A Compiled Program -- Describes how to run a compiled object file. Chapter 7, A Compiler/Interpreter Language Comparison -- De- scribes all of the language, operational, and other differences between TASC and the Applesoft interpreter. This chapter should be read before attempting to compile any programs with TASC. *************************************************************************** TASC -- page 4 -- Introduction Chapter 8, Language Enhancements -- Describes TASC's exten- sions to Applesoft. Chapter 9, How The Compiler Works -- Describes the inner work- ings of the compiler. Chapter 10, Error Messages and Debugging -- Describes each error message and discusses common problems. Appendices include: A. Moving Binary Files with the ADR Utility -- How to BLOAD and BSAVE binary files with the ADR utility B. Copying TASC and Converting to DOS 3.3 -- How to copy and convert the TASC compiler C. Creating a Turnkey Disk -- How to create a turnkey disk for compiled programs D. Notes on Applesoft -- Information on unusual Applesoft features E. Runtime Memory Map -- Memory usage by compiled programs F. Zero Page Usage -- Zero page locations used by compiled programs This manual assumes that the user has a working knowledge of the Applesoft language. For additional information on Applesoft pro- gramming, refer to Section 1.3, Resources for Learning Applesoft....
Amiga7878