Advanced Macintosh BASIC Programming
From the originals
13 scansMachine-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
Advanced Macintosh BASIC Programming Philip Calippe This reference guide and thorough tutorial to Microsoft BASIC 2.0 shows you the advanced commands and techniques you need to create your own Macintosh applications. Includes software development utilities and an arcade-style game, ready to type in and use. A COMPUTE! Books Publication $16.95
Book cover with a light mint green background, large teal handwritten-style script title across the center, author name below, a descriptive blurb in white text, and a publisher line at the bottom.
Reading notes: Blurb text in white on light green is low contrast and some words near the middle-left are faint, notably 'techn|ques' and 'Macintosh' area; reading follows visible wording. The 'COMPUTE!' publisher name is printed in bold white-outlined type and read with moderate confidence.
- Printed product names
- Advanced Macintosh BASIC Programming · Microsoft BASIC 2.0
- Printed prices
- $16.95
- Languages
- English
PDF page 1
Advanced Macintosh BASIC Programming Philip Calippe This reference guide and thorough tutorial to Microsoft BASIC 2.0 shows you the advanced commands and techniques you need to create your own Macintosh applications. Includes software development utilities and an arcade-style game, ready to type in and use. A COMPUTE! Books Publication $16.95
A book cover with a pale mint-green background, large dark teal handwritten-style title lettering, the author name in small text below, a descriptive blurb in white text at lower right, and a publisher line with price at the bottom.
Reading notes: Author name 'Philip Calippe' and the blurb text are white on pale green and may be low contrast; spelling read as printed. The word 'Macintosh' in the blurb is partly affected by a small colored speck near the letter 'a'; reading taken as 'Macintosh'.
- Printed product names
- Advanced Macintosh BASIC Programming · Microsoft BASIC 2.0
- Printed prices
- $16.95
- Languages
- English
PDF page 2
Advanced Macintosh BASIC Programming Philip Calippe COMPUTE! Publications, Inc. One of the ABC Publishing Companies Greensboro, North Carolina
A title page with large teal handwritten-style script title lettering 'Advanced Macintosh BASIC Programming' centered over a underline stroke, with the author name below and the publisher logo and location in black type at the bottom.
Reading notes: Faint ghosted text from the reverse side of the page is visible in the middle area but is not legible and was not transcribed. The publisher logo includes a small ABC circle mark; transcribed as 'abc'.
- Printed product names
- COMPUTE! Publications, Inc.
- Languages
- English
PDF page 3
Copyright 1985, COMPUTE! Publications, Inc. All rights reserved. Reproduction or translation of any part of this work beyond that permitted by Sec- tions 107 and 108 of the United States Copyright Act without the permission of the copyright owner is unlawful. Printed in the United States of America 10 9 8 7 6 5 4 3 2 1 ISBN 0-87455-030-0 The author and publisher have made every effort in the preparation of this book to insure the ac- curacy of the programs al'\d information. However, the information and programs in this book are sold without warranty, either express or implied. Neither the author nor COMPUTE! Publications, Inc., will be liable for any damages caused or alleged to be caused directly, indirectly, incidentally, or consequentially by the programs or information in this book. The opinions expressed in this book are solely those of the author and are not necessarily those of COMPUTE! Publications, Inc. COMPUTE! Publications, Inc., Post Office Box 5406, Greensboro, NC 27403, (919) 275-9809, is one of the ABC Publishing Companies and is not associated with any manufacturer of personal computers. Macintosh is a trademark of Apple Computer, Inc. Microsoft BASIC 2.0 is a trademark of Microsoft Corporation.
Reading notes: Possible OCR artifact 'al'\d' in the phrase 'and programs'
- Printed product names
- Macintosh · Microsoft BASIC 2.0
- Printed dates
- 1985
- Languages
- English
PDF page 4
Contents Foreword ......................................... v Introduction The Form of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Chapter 1 Keyboard and String Manipulation . . . . . . . . . . . . . . . . . . . 1 Chapter 2 Input Processing Commands . . . . . . . . . . . . . . . . . . . . . . . 13 Chapter 3 Graphics and Animation . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Chapter 4 Bit Image Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Chapter 5 File Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Chapter 6 Program File Oriented Commands .... . .......... ... 91 Chapter 7 Device I/O and Microsoft BASIC Techniques . . . . . . . . 103 Chapter 8 Using ROM Routines ............................ 131 Chapter 9 ROM Routines-Graphics . . . . . . . . . . . . . . . . . . . . . . . . 151 Chapter 10 Text ROM Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 Chapter 11 Software Tools 253 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Disk Coupon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Reading notes: Table of contents page; the source text does not show a product, advertised prices, or any printed dates beyond none present.
- Languages
- English
PDF page 5
Foreword You already know Microsoft BASIC on the Macintosh, but now you want to tap its full potential. You've studied the manual and you're ready for some practical applications. This book is not a simplistic guide to elementary pro- gramming. Instead, Advanced Macintosh BASIC Programming is a tutorial and reference to the advanced commands, state- ments, and techniques of Microsoft BASIC 2.0. You'll learn how to tackle useful projects and how to get the results you want from your Macintosh and its BASIC. You'll learn how to use various Macintosh peripherals- such as the disk drive and printer-and how to use the Mac's unique graphic capabilities. Many sample programs are in- cluded, illustrating concepts like creating and maintaining a mailing list, drawing business graphics, block graphic anima- . tion, creating functional dialog boxes with control buttons, and generating pull-down menus. Countless examples make the transition from intermediate programmer to advanced applica- tions designer painless and worry-free. Different Abilities, Different Approaches To accommodate everyone-no matter what their expertise- this book takes three major approaches to illustrating the Mac- intosh's advanced capabilities. •The first approach explores the Macintosh-specific features of Microsoft BASIC. With this background, you can utilize the rest of the book. Programming features covered only briefly in the Microsoft BASIC manuals are detailed here. You're also shown the BASIC commands to create programming tools. • The second approach uses the concepts defined in the first section to create a set of software tools, which are generally added to programs as subroutines. Each tool evolves from a design requirement to a subroutine or subprogram. Where applicable, each of these tools will be defined by purpose and theory of operation, data structure implementation, cod- ing, and example of usage. This mirrors the organizational process of creating applications. • The third approach deals with programming utilities, which incorporate the tools already defined. Each utility is defined v
Reading notes: Line-end hyphenation in 'peripherals-' and 'Macintosh-specific' and 'transition' spans may affect reading order Stray period before 'tion' in 'block graphic anima-' may be an OCR artifact
- Printed product names
- Microsoft BASIC · Advanced Macintosh BASIC Programming · Macintosh · Microsoft BASIC 2.0
- Languages
- English
PDF page 6
in terms of purpose, design, and implementation-complete with code and sample application. Often utilities use them- selves and each other in their creation. Together they signifi- cantly reduce the amount of time it takes to develop an application. The ultimate utility writes most of the applica- tion itself. A programmer's most challenging task is writing a game. The last program included in the book is an arcade-action game which demonstrates the concepts of event interrupts and event processing. In these pages you'll find a wealth of information-from programming techniques and tricks to practical software utili- ties. Armed with this information, you'll be able to write so- phisticated programs, programs that truly make the most of your Macintosh.
Reading notes: Reading order of the extracted fragment begins mid-sentence and may not reflect the original page layout.
- Languages
- English
PDF page 7
INTRODUCTION The Form of the Book To make this book as easy to use as possible, we need to men- tion a few things before you begin. Anyone with a reasonable understanding of BASIC will find this section useful, though not essential, for comprehending the programs and program segments which are used as examples. All BASIC keywords within the text appear in boldface, just as they would in the List window on your Macintosh screen. Programs are printed just as they show on the screen, with keywords also in boldface. That's one of the niceties of Microsoft BASIC on the Macintosh. The terms BASIC command and BASIC statement are often used interchangeably, but they're not necessarily the same. To keep things from getting too confusing, let's define these terms. •BASIC commands can be keywords like PRINT, IF-THEN- ELSE, and CALL. •On the other hand, BASIC statements can be made from BASIC commands like IF X>O THEN PRINT X. •Thus, a command can be equated to a keyword, while a statement is a segment of programming code which may contain one or more commands. Most elementary BASIC programs, no matter for which computer, use a small assortment of BASIC commands which typically include PRINT, GOTO, GOSUB, INPUT, and IF- THEN-ELSE within statements. You can program practically anything using just these commands and some algebraic ex- pressions. However, less common commands are available, often machine dependent, which exploit machine-specific hardware features . Obviously, there are many such commands for the Macintosh. To prepare for later chapters, some of these commands will be examined in detail and categorized into keyboard input and input processing commands, graphic commands, file com- mands, miscellaneous commands, and ROM routine calls. There are examples associated with most of the commands. It's an excellent idea for you to type in these examples-you'll find it far easier to understand how they function . vii
Reading notes: Some boldface keyword formatting cannot be confirmed from plain text Page number 'vii' appears at end of copy
- Printed product names
- Microsoft BASIC · Macintosh
- Languages
- English
PDF page 8
INTRODUCTION BASIC 2.0 requires the adjustment of the List and Output windows. When starting BASIC 2.0, a List window is pro- vided; double click on its title bar to set it to full screen size. The same can be done with the Output window. The Command window is rarely required and, when it is, the default size is usually sufficient. Some Terms The following terms should be explained before we go into any detail about the BASIC commands. Term ~-C ~-S ~-period Number Prompt string String String variable Variable list viii Meaning The result of pressing the Command key ( 3€ ) with the C key. This usually stops program execution. The result of pressing the Command key ( ~ ) with the S key. This usually suspends program execution until another key is pressed. The result of pressing the Command key ( 3€) with the period key (.). This usually stops program execution. A numeric value usually greater than zero. A message which appears with a request for input. It usually indicates to the user what input is desired. A typical message would be Type your name and press RETURN:. The message may be any string, but not a string variable. A string is a list of characters such as This is a string!!!. A string is divided into two components when stored in memory. First is a length which ranges from 0 to 32767 characters; then comes the set of characters that make up the string. A string with five characters, such as <-+->,requires six bytes of storage in memory. A string of zero length looks like " " and is called a null string or null char- acter. It has special uses, which will be discussed and demonstrated later. A variable that may have a string assigned to it. String variables end with a dollar sign ($), for ex- ample, A$ or NAME$. A list of variable names separated by commas (though it can conceivably be just a single variable). A variable list may look something like NAME$, PHONE$, AMOUNT, or INDEX([). Note that variable types may be mixed in a variable list and that arrays must be indexed.
Reading notes: Special characters such as the Command key symbol and the ~ character are rendered inconsistently in the extracted copy (e.g., '3€', '~-C', '<-+->').
- Languages
- English
PDF page 9
CHAPTER 1 Keyboard and String Manipulation
CHAPTER 1 Keyboard and String Manipulation
A teal-blue chapter opener page with the word CHAPTER in widely spaced capitals above a thin horizontal rule, and a large white numeral 1 above the title in a serif typeface.
Reading notes: Headline is split across several lines and is treated as the chapter title with the numeral, reading order top to bottom.
- Languages
- English
PDF page 10
Keyboard and String Manipulation
1 Keyboard and String Manipulation Most programs perform three general tasks: input, input pro- cessing, and output. Some programs may have no input or out- put-such as those used for benchmarking computer processing time when performing calculations. Let's take a look at the first of these tasks, input. A set of BASIC commands handles input on the Macintosh, and since a good program provides an easy-to-use interface which checks the input, there's also a set of commands to assist in verifying the integrity of the input. The most commonly used command for input is, strangely enough, INPUT. It has six forms of syntax: INPUT variable list INPVT;variabie list INPVT"prompt string";variable list INPVT;"prompt string";variable list INPVT"prompt string'',variable list INPVT;"prompt string",variable list The first and simplest form of INPUT sends a question mark to the screen and waits for a keyboard response, which is ended with a press of the Return or Enter key (these two Macintosh keys don't always behave the same). Accidentally entered characters can be erased with the Backspace key. Cer- tain characters cannot be entered-these restricted characters depend on the type of variables in the variable list. Numeric variables are delimited by either commas or semicolons; thus, neither of these characters can be entered as part of the input data. String variables use a comma as a delimiter, so commas are forbidden here. Command-period and other Command 3
Reading notes: Page number '1' and trailing '3' appear as stray marks; reading order of fragment near bottom uncertain
- Languages
- English
PDF page 11
ONE keystrokes cannot be entered. If a nonnumeric character is en- tered as data for a numeric variable, a ?Redo from start message will appear. If this message occurs, all the items of that IN- PUT statement must be reentered. There are two exceptions to this rule of nonnumeric entry: The characters e and d are in- terpreted as exponents for single- and double-precision entries, respectively. For example, entering 4e4 for a numeric variable would be the same as entering 40000. Although this form of INPUT is the simplest to use, it doesn't give the user any information about what to enter, how many entries to make, or even the nature of the entries. One way to get around this deficiency is to use a PRINT com- mand prior to the INPUT. The second form of INPUT differs from the first only with the addition of a semicolon before the variable list. This prevents Return and Enter from generating a linefeed and car- riage return on the screen. This is useful to remember when programming data entry screens that cannot be destroyed by user input. Data entry screens are discussed in more detail later. Program 1-1 demonstrates the use of the added semi- colon in INPUT. For each response, enter 1 or 2, according to the prompt. (Because spacing can be important in certain pro- grams, if in doubt, type the statements with spaces as shown.) Program 1-1. INPUT; CLS PRINT "Enter 1 :";:INPUT A:PRINT.. Enter 2:";:1NPUT B PRINT .. Thank you, let's do it again." PRINT "Enter 1 :";:INPUT ;A:PRINT" Enter 2:";:1NPUT ;B PRINT" Thank you." Figure 1-1. When a semicolon is used before the variable list, Return does not affect the screen. 0 Program 1 1 Enter 1 :? 1 Enter 2:7 2 Thank you, l et"s do it again. Enter 1 :? 1 Enter 2:? 2 Thank you. 4
Reading notes: Possible OCR spacing artifacts such as 'PRINT..' and 'l et"s' in the program listing Figure 1-1 output lines may be out of reading order relative to program code
- Languages
- English