← Learn BASIC for the Apple Macintosh Now

Learn BASIC for the Apple Macintosh Now

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

LEARN BASIC FOR THE APPLE MACINTOSH NOW

LEARN BASIC FOR THE APPLE® MACINTOSH® NOW INCLUDES MICROSOFT QuickBASIC™ INTERPRETER SOFTWARE DISK Includes the Powerful Microsoft QuickBASIC Interpreter for the Macintosh Dozens of Sample Programs The Fastest, Easiest Way to Explore Macintosh Programming Michael Halvorson & David Rygmyr Foreword by Jerry Pournelle Microsoft PRESS

Book cover with large green and black stylized title letters, a red, yellow and blue 'Includes Microsoft QuickBASIC Interpreter Software Disk' badge at top, red arrow bullet points, author names in black type, and a Microsoft Press logo square at bottom right, with an orange strip along the right edge.

Reading notes: The author surname 'Rygmyr' and the stylized 'Halvorson' and 'Pournelle' lettering are in a decorative typeface and may be imprecise. Title words LEARN, BASIC and NOW are rendered in stylized display lettering; transcribed as shown. Reading order of the badge text is approximate due to its curved and angled layout.

Printed product names
Microsoft QuickBASIC Interpreter · Apple Macintosh
Languages
English
PDF page 1

Microsoft QuickBASIC Interpreter for the Macintosh

FOR THE APPLE® MACINTOSH® ~ Includes the Powerful Microsoft QuickBASIC Interpreter for the Macintosh ~ Dozens of Sample Programs ~ The Fastest, Easiest Way to Explore Macintosh Programming Miubael Halvorson & David Rygmyr Forewonl by Jerry Pournelle ®

Reading notes: Headline choice is uncertain: the top line reads 'FOR THE APPLE® MACINTOSH®' and the subhead reads 'Includes the Powerful Microsoft QuickBASIC Interpreter for the Macintosh'. OCR-like spelling 'Miubael' may be a misreading of 'Michael' and should be checked against the image. OCR-like spelling 'Forewonl' may be a misreading of 'Foreword' and should be checked against the image. Author surname 'Rygmyr' should be verified against the image. Visual layout, reading order and the exact positions of the bullet items could not be confirmed from the supplied text alone.

Printed product names
Microsoft QuickBASIC Interpreter for the Macintosh
Languages
English
PDF page 2

LEARN BASIC FOR THE APPLE MACINTOSH NOW

LEARN BASIC FOR THE APPLE® MACINTOSH® NOW

A white page with large serif headline words in black and red, a gray subtitle line, and a solid red vertical bar along the right edge.

Reading notes: Headline words are stacked in a large display type; reading order follows top to bottom. The registered trademark symbols after APPLE and MACINTOSH are small and may be approximate.

Printed product names
Apple Macintosh
Languages
English
PDF page 3

LEARN BASIC FOR THE APPLE® MACINTOSH® NOW

LEARN BASIC FOR THE APPLE® MACINTOSH® NOW Michael Halvorson & David Rygmyr Foreword by Jerry Pournelle Microsoft PRESS®

A book cover with large black and red serif title letters reading LEARN, BASIC, and NOW, a gray subtitle line FOR THE APPLE MACINTOSH, author credits at lower left, a red Microsoft Press logo box at lower right, and a solid red vertical stripe along the right edge.

Reading notes: Small faint text block in upper half (copyright and publisher lines) is too faint and small to transcribe reliably and was omitted. Faint lines between the title and author credits appear to be fine print that could not be read.

Printed product names
Apple Macintosh · Microsoft Press
Languages
English
PDF page 4

PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 1990 by Microsoft Press, a division of Microsoft Corporation All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Library of Congress Cataloging-in-Publication Data Halvorson, Michael. Learn BASIC for the Apple Macintosh now I Michael Halvorson, David Rygmyr. p. cm. Includes index. ISBN 1-55615-314-7 1. Macintosh (Computer)--Programming. language) I. Rygmyr, David, 1958- QA76.8.M3H355 1990 005.265--dc20 2. BASIC (Computer program IL Title. 90-13263 CIP Printed and bound in the United States of America. l 2 3 4 5 6 7 8 9 FGFG 4 3 2 1 0 Distributed to the book trade in Canada by General Publishing Company, Ltd. Distributed to the book trade outside the United States and Canada by Penguin Books Ltd. Penguin Books Ltd., Harmondsworth, Middlesex, England Penguin Books Australia Ltd., Ringwood, Victoria, Australia Penguin Books N.Z. Ltd., 182-190 Wairau Road, Auckland 10, New Zealand British Cataloging in Publication Data available Apple'\!> Mac'\!> and Macintosh® are registered trademarks of Apple Computer, Incorporated. Microsoft® is a registered trademark and Microsoft QuickBASIC™ is a trademark of Microsoft Corporation. Project Editor: Erin O'Connor Technical Editor: Dail Magee, Jr.

Reading notes: Catalog-number and library-code strings such as 90-13263 and 005.265--dc20 are OCR-like and may be garbled Garbled characters appear around the Apple and Mac trademark marks (rendered as 'Apple'\!>')

Printed product names
Apple Macintosh · Macintosh · Microsoft Press
Printed dates
1990 · 1958
Languages
English
PDF page 5

For my parents, Ken and Linda, with love. M.lH. For Carol, Bruce, Benjamin, Brandon, and any future nieces or nephews. D.L.R.

Reading notes: Initials 'M.lH.' and 'D.L.R.' are not expanded and may be partially ambiguous.

Languages
English
PDF page 6

Contents Foreword ix Pref ace xuz 1 Introduction to Programming and BASIC 2 Getting Started with the QuickBASIC Interpreter 13 3 Introduction to the BASIC Language 45 4 QuickBASIC Variables and Operators 57 5 Controlling Program Flow 93 6 Working with QuickBASIC Loops 133 7 Creating Your Own Subprograms and Functions 165 8 Working with Large Amounts of Data 189

Reading notes: Source text is a table of contents with no primary heading or advertised products, prices or dates. Spacing in 'Pref ace' and 'Getting Started' entries may reflect OCR artifacts rather than printed spelling.

Languages
English
PDF page 7

LEARN BASIC FOR THE APPLE MACINTOSH NOW

LEARN BASIC FOR THE APPLE MACINTOSH NOW 9 Working with Strings 235 10 Working with Files and Printers 275 11 Working with Menus, Windows, and the Mouse 307 12 Working with Graphics and Sound 361 13 Debugging QuickBASIC Programs 407 14 Learning More About BASIC 427 Appendix A Table of Character Sets 433 AppendixB Solutions to Questions and Exercises 439 Index 471 viii

Reading notes: Table of contents text with page numbers; reading order is sequential but chapter-to-page mapping is unclear

Printed product names
Apple Macintosh
Languages
English
PDF page 8

Foreword by Jerry Pournelle

Foreword by Jerry Pournelle Some computer fanatics laugh at BASIC. Real Programmers, they say, write in Assembler. Or Forth, or C, or APL, or even Pascal. Never BASIC, though. There's even a famous computer scientist who likes to pretend that learning BASIC cripples the mind and makes one forever unable to become a Real Programmer. The BASIC Secret All of which is nonsense. I can say this with some authority since I've been around long enough that Ezekial-my friend who happens to be a Z-80 micro and the machine I used to write the first book ever to be writ- ten on a home computer-is on display in the Smithsonian. In the more than a dozen years since I wrote that book, I've seen small desktop com- puters grow in power until they rival the biggest machines available in those times. I've also seen fads in computer languages: Having started with Bill Gates ' s first Altair BASIC, I went on to FORTRAN, RATFOR, 8080 Assembler, Z-80 Assembler, PL/I, Pascal, and Modula 2 and even had a shot at C. Through all those times, I've noticed that ifl really want to get something done in a hurry, I still use BASIC-and so do a lot of Real Programmers. Now, true, modern compiling BASIC, the QuickBASIC this book does such an admirable job of teaching, is a lot different from the BASIC I first learned-but then so are the machines we use now. There ' s a strong par- allel between the development of BASIC and the development of the Mac- intosh computer. Each was, when introduced, the most learnable product of its class: With both early Microsoft BASIC and the first 128K Mac, you could sit down and do something interesting within a few minutes. Each also had severe limitations, but over the years, both developed into powerful tools without losing their ease of use. The Mac developed speed and power. Compiling BASIC developed long variable names, new IX

Reading notes: Possible OCR spacing artifacts in names such as 'Ezekial' and 'ifl' (likely 'if I') Page marker 'IX' at the end of the excerpt may indicate a page break in reading order

Printed product names
Altair BASIC · QuickBASIC · FORTRAN · RATFOR · PL/I · Pascal · Modula 2 · C · Z-80 · Assembler · Forth · APL · Microsoft BASIC · BASIC
Languages
English
PDF page 9

LEARN BASIC FOR THE APPLE MACINTOSH NOW

LEARN BASIC FOR THE APPLE MACINTOSH NOW data types, and all the needed control structures such as CASE and WHILE and multiline IF statements. I don't want to carry the analogy too far. There's a lot you can do with a Mac that you can't teach it in BASIC, even a BASIC as powerful as Microsoft QuickBASIC. But there's a surprising amount you can do, espe- cially when you consider that QuickBASIC has the capability to incorpo- rate routines compiled from other languages such as Pascal and C. In fact, you will not soon reach the limits of this language. Years ago I wrote an accounting program in compiled BASIC. Once in a while I add some new features or go through it and make something simpler; and I use that program for all my accounting to this day. I've never been tempted to change to any other language for my program because what I have runs fast enough and is small enough-and it's very easy to maintain and expand. Learning BASIC When I first started programming, there wasn't much choice: You learned to program by diving in headfirst. And there wasn't much choice for a lan- guage to use: It was either Assembler or Gates's Microsoft BASIC. I had a printed copy of a fairly complex program by Gupta called "The People's Data Base'' that was written in BASIC. I had to type that program into the machine using the line editor available in early editions of interpreted BASIC. It took days. Eventually, I got the program to work, and then I was able to add features to it. That was a wonderful experience: I was making the computer do something I wanted it to do. After that, I struck out on my own, and that program evolved into something quite complex. I used it for years; indeed, parts of it are incorporated into some file manager pro- grams I use today. The sink-or-swim method of learning BASIC had the merit of showing you unmistakably that a computer expects every word in every program statement to be spelled correctly and put in exactly the right form . On the other hand, it took a lot of time, some of the work was pretty boring, and often when it wasn't boring it was frustrating. As I said, though, there wasn't much choice. There weren't any systematic tutorials for learning BASIC. Now there is, and this is it, and it works. I know that for two reasons. First, Mrs. Roberta Pournelle used the IBM PC version of this tutorial to x

Reading notes: Final sentence is truncated at 'to x' and the page may continue beyond the supplied text. Hyphenated line breaks (e.g. 'lan-guage', 'pro-grams') may split words that should be rejoined. Name 'Gupta' and 'Gates's' are as printed and may be partial or misattributed in OCR.

Printed product names
Apple Macintosh · Microsoft QuickBASIC · Pascal · C · Microsoft BASIC · The People's Data Base · IBM PC
Languages
English
PDF page 10

Foreword learn QuickBASIC, and she swears by it. She says the examples and demonstrations work splendidly with the text, helping you to be sure you understand what you think the book says. Second, although I know QuickBASIC for the IBM, I don't know it for the Mac; and I have to learn because I wrote Mrs. Pournelle's Reading Program in IBM QuickBASIC and she wants me to translate it to run on the Macintosh. Thus, I've been going through this book and its lessons myself; and I very much like the systematic approach, with examples and specific lessons. I'm going through it much faster than Mrs. Pournelle did because I started out know- ing more of the language-but surely that's the whole point? In ancient times, the mere ability to read and write was sufficient to guarantee that you'd belong to the ruling class. Scribes were important people; after all, it took many years to learn how to do what they did. Gradually, that changed. Instead of only a tiny number of people knowing how to read and write, nearly everyone could do it. It wasn't an ability that would guarantee you an important job-but if you couldn't read and write, that pretty well guaranteed that you wouldn't have a decent position. Computer programming is, I think, headed that way. I don't know how long it will be before the ability to program-or at least to understand what programming is about even if you don't actively do it-will be a re- quirement for a significant number of jobs. I suspect that that day is com- ing more quickly than most realize. Anyway, you've got the right tools for the first step. I wish I'd had something half as good when I started. When you finish this book, get the full QuickBASIC compiler and write yourself some big programs. There's no experience quite like it. Good luck! Hollywood, California Summer 1990 xi

Reading notes: Hyphenated line break 'know-ing' and 'pro-gram' split across lines; reading order is linear as supplied.

Printed product names
QuickBASIC · IBM QuickBASIC · Macintosh
Printed dates
Summer 1990
Languages
English
PDF page 11

Preface We put this book-disk package together for people who have wondered about programming on the Macintosh but could never get the time, the software, and the right book together for the right price. Our idea was that Learn BASIC for the Apple Macintosh Now would be an inexpensive pack- age that would contain everything you need to start writing useful pro- grams fast: • The Microsoft QuickBASIC Interpreter for the Apple Mac- intosh-an easy-to-learn programming environment to make BASIC programming fast and fun • Sample programs-dozens of examples to help you learn and at the same time provide real utility • The companion book-a hands-on, step-by-step guide to BASIC programming, with plenty of practice sessions to make you com- fortable with what you learn • Questions and exercises-review questions and programming ex- ercises that help you apply what you learn-with answers and suggested solutions in the back of the book We think we've done it. Whether you're a total beginner with no pro- gramming experience or a Macintosh fanatic with some knowledge of BASIC, we think this package contains what you need to become a profi- cient programmer. The powerful QuickBASIC Interpreter contains all but a few of the features of its big brother, the Microsoft QuickBASIC Com- piler for the Apple Macintosh. And the step-by-step programming instruc- tion begins where we think it should, at the beginning. We predict that this investment in learning to program will be of value to you for years to come. BASIC, along with the Macintosh, is here to stay. We've tried to keep the organization of the book true to the nature of programming, and we recommend that you take up the BASIC program- ming topics in the sequence in which the book presents them. BASIC's ability to perform some fairly impressive tasks rests on simple fundamen- tals, so you won't want to miss any of the early details if you're starting xiii

Reading notes: Hyphenated line breaks and justified spacing in the preface make some word boundaries uncertain The phrase 'the right price' is printed but no currency amount appears in the supplied copy

Printed product names
Learn BASIC for the Apple Macintosh Now
Languages
English