Microsoft Basic Using the Softcard 1984 II Plus Iie.Pdf

Microsoft Basic Using the Softcard 1984 II Plus Iie.Pdf

Microsoftm BASIC Using the SoftCardm Microsoft.. BASIC Using the SoftCard .. James S. Coan [l1 HAYDEN BOOK COMPANY a division of Hayden Publishing Company, Inc. Hasbrouck Heights, New Jersey Equipment Reeded • Apple II, Apple II Plus, or an Apple Ile computer with a minimum of 48K of memory • Color television set or monitor • Microsoft SoftCard (at least one disk drive required) To achieve lowercase characters you will need one of the following: · • Apple Ile, an SO-column card, or an external terminal with an appropriate interface card. Production Editor: TERRY DONOVAN Art Director: JIM BERNARD Cover Design: SHARYN BANKS Original Artwork: JOHN McAUSLAND Composition: BI-COMP, INC. Printed and bound by: ARCATA GRAPHICS CO.: FAIRFIELD GRAPHICS DIVISION Apple and Applesof&are registered trademarks of Apple Computer. Inc.; Microsoft is a trademark of Microsoft Corp.; CP/M is a registered trademark of Digital Research. Inc.; none of which is affiliated with Hayden Book Company. Copyright © 1984 by HAYDEN BOOK COMPANY. All rights reserved. No part of this book may be reprinted, or reproduced, or utilized in any form or by any electronic, mechanical, or other means,. now known or hereafter invented, includ­ ing photocopying and recording, or in any information storage and retrieval system, without permission in writing from the Publisher. Printed in the United States of America 1 2 3 4 5 6 7 8 9PRINT1NG 84 85 86 87 88 89 90 91 92 YEAR Who knows how many versions of BASIC there are? All are recognizable as emanating from the original BASIC developed at Dartmouth College under John G. Kemeny and Thomas E. Kurtz. Most versions have added new features. BASIC-80, developed by Microsoft, is in use on yast numbers of com· puters today. Therefore, if you learn Microsoft BASIC (also known as MBASIC or MS-BASIC), you will be able to use many computers. In addition, the BASIC we learn will be a good foundation for programming in other versions of BASIC and other computer languages everywhere. Microsoft has developed BASIC in two modes: one is interpretive, and the other is compiled. The interpretive mode of BASIC is highly interac­ tive. This interactive nature of BASIC has been a primary reason for its tremendous popularity. We can easily write programs and instantly com­ mand the computer to execute them for us. We can even command the computer to execute individual BASIC statements immediately right at the keyboard. Our mistakes and typing errors are often pointed out to us in plain English, rather than in undecipherable code. One of the drawbacks of BASIC is its slow execution speed. The reason for this slow speed is that interpretive languages must analyze and translate each statement into a more primitive form each time it is encountered during program execu· tion. If a statement is executed fifteen thousand times, the interpreter must do the analysis and translation fifteen thousand times. The com­ puter derives no benefit from the repetitious nature of the process (see, computers are not as smart as humans!). This interpretation takes more time than the actual program execution. Compiled BASIC overcomes the slow-speed problem. The compiler performs the line-by-line analysis and translation once and creates an entirely new program, which may then be executed without the aid of the BASIC interpreter program. The time required to transform each program statement is eliminated. The icing on the cake is that we have, in Microsoft BASIC, one lan­ guage that may be managed in either mode. Thus it is possible to write and thoroughly test BASIC prognUns interactively and then compile the result for more efficient use of computer resources. This book is about prognUnming in Microsoft BASIC-80 using the SoftCard and CP/M on Apple II, Apple II Plus, and Apple lie computers. BASIC-80 is an enhanced version of the standard Microsoft BASIC. The primary enhancement is the inclusion of low-resolution and high­ resolution graphics. Some of the additions are simply to include features for the convenience of Applesoft programmers. Problems included at ap­ propriate points in the book make it suitable for the classroom as well as for the individual who wants to learn BASIC. Features of BASIC are generally introduced as they are needed to solve a task. Nearly one hun­ dred programs are presented and discussed. The general approach is to begin with small programs to solve real problems and then to build them up into larger programs as required. It is helpful to break any task into small segments. One goal is to write prognUn segments that will fit en­ tirely on one screen. We even organize things in such a way that our list of tasks actually become the REMarks that form the prognUn documenta­ tion before we begin to write program statements in BASIC. Larger pro­ gnimS are developed by first writing a control routine that will manage a collection of subroutines. Then we write the subroutines. Sometimes we have already written some of the subroutines to solve earlier prognim­ ming problems. We get started with simple calculations and printed messages in Chapter 1. Chapter 2 introduces numeric and string variables. The loop concept comes up in Chapter 3, with the formal introduction of FOR and NEXT in Chapter 4. We learn about functions and subroutines in Chapter 5. Chapter 6 presents numeric and string arrays. Here an alphabet game rounds out our work with string arrays. With many programming con­ cepts and BASIC features in hand, we consider a few interesting applica­ tions in Chapter 7. A calendar program, the sieve of Eratosthenes, and different base numbering systems appear here. Chapters 8, 9, and 10 take us from a simple sequential-access file to a workable mailing-list prognim. Low-resolution and high-resolution graphics are the topics of Chapters 11 and 12. Each chapter (except for Chapter 7) is followed by a "Sidelight" sec­ tion that presents special features, concepts, and advanced techniques. Topics range from the use of a question mark for PRINT to how to use POKE to change the "Ok" message issued by BASIC after every task. Appendix A compares SoftCard BASIC.with Applesoft. EDIT Mode is discussed in Appendix B with numerous examples. Use of the disk for maintaining a library of prognUns is presented in Appendix C, and an ASCII chart is presented in Appendix D. An index of prognUns in the text appears in Appendix E. Appendix F contains solution prognUns for the even-numbered problems. I wish to thank Alan Boyd of Microsoft Consumer Products for provid­ ing material assistance. Mike Violano and Chris Varley of Hayden Book Company, Inc., have made important suggestions and provided valuable counsel in the development of this book. New Hope, Pa. JAMES s. COAN To the Beader Learning to program a computer can be very exhilarating. The thrill of seeing your first apparently complicated idea implemented in a clear, simple program is wonderful. You will be well advised to look upon the computer as something to be mastered and not as some impersonal mon­ ster that is out to do you in. Everything that the computer does is explain· able and predictable. You should take care to evaluate the results that the computer produces; do not blindly accept computer results as faultless. That is not to say that the computer is going to make mistakes. In fact, under normal conditions, the computer will execute your instructions exactly. Mistakes in the results of a program execution are usually caused by errors in the instructions written by the programmer. Resist the temp­ tation to blame anything other than your programming for incorrect or unexpected results. No one need fear the computer. This is especially true when it comes to learning. We can work with the computer in total privacy. Errors that the computer reports to us become our secret. Nobody else needs to know what we did wrong. Once we have mastered the computer, we may confi­ dently demonstrate our skill to all who will join in. When we learn to ride a bicycle or drive a car, someone is bound to know and we may be· humiliated. This need not be the case with the computer. The computer will keep its secret if you will keep yours. The computer has truly infinite patience and will never raise its voice. Learning to program a computer is not so complicated. You will prob­ ably find that an iterative process works best. Read some of the text, try some programs on the computer, and go back to read some more. There are certain things that you cannot possibly know without being told and certain things that make sense based on what is known so far. You will find that reading the text will help with writing the next program and that writing and executing a program will help with reading the text. A program consists ofa set of instructions that causes the computer to perform a task of our choosing. The process of writing those instructions for the computer is called programming. Programs do an amazing variety of things. You may perform the simplest of arithmetic calculations or the most complex of mathematical manipulations. You can write programs to interact with the user. You may want to do this to make the computer play a game or to fill out a tax return. You may write a computer program to solve an algebra homework problem or organize a directory of names and addresses of your friends or business associates. And you may even be programming a computer just for the fun of it. I hope that you are soon stimulated by your work in programming to bring to the computer your new and exciting problems to be solved.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    267 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us