# SAMS Macintosh Programming Techniques 1985 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-17badb2c0a2cf5387d2f6319c8af161cfbc1b9d84eb83cc7300a06ba1a1d9687)

Transcribed text:

SAMS
22411
Macintosh™
Programming
Techniques
David C. Willen
Microsoft® BASIC 2.0

Image description: A dark red book cover with the SAMS logo at top left and a framed photograph of red apples surrounding a light bulb whose upper half is an apple sliced open with a glowing ring at its middle.

Reading notes: The number 22411 at top right is likely a catalog or stock number rather than a date; it is included only as printed. The ™ symbol after Macintosh and the ® after Microsoft are small superscripts and are transcribed as shown.

Printed product names: Microsoft BASIC 2.0

Printed dates: 22411

Languages: English

[Original Image 1](https://www.vintageapple.net/files/5ee2fc38380dfb23c938753a706bc5a3689fab9b0b2276e4e0eaa05152d93ef5/51ea7870692dfac2baef30c3.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-f8960eaa6f11392e065b656874d8a4e2b4e818042a8de5ec8f04384e14a84917)

Macintosh™ Programming Techniques

Transcribed text:

SAMS
22411
Macintosh™
Programming
Techniques
David C. Willen
Microsoft® BASIC 2.0

Image description: A book cover with a deep maroon background, a gold-bordered photograph of a red apple shaped like a glowing light bulb with a leaf on top and a screw base, surrounded by other red apples against a blue-tinted backdrop, with the SAMS logo at top left and the title in large white type at top right.

Reading notes: The title 'Macintosh' is followed by a superscript trademark symbol (™), transcribed as printed. The '22411' catalog number appears at top right and is in small type; its meaning is not stated on the cover.

Printed product names: Microsoft BASIC 2.0

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-eca37246b14b3ebeefd2737e1e7098fb4ab2b63ccdca5325145856443029dc8d)

Transcribed text:

Macintosh™ Programming Techniques
Microsoft® BASIC 2.0

Image description: A plain white title page with a thin vertical black rule on the left, and a large bold green two-line title with a smaller black subtitle beneath it, all left-aligned in the upper-middle area of the page.

Reading notes: Trademark symbols (™, ®) are transcribed as printed; the exact superscript formatting is approximate.

Printed product names: Microsoft BASIC 2.0

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-ae9d606fa20a12b0cc73f161bf0035bb4d6c1f4034007c6341a32eb1cf3136d3)

Macintosh TM Programming Techniques

Transcribed text:

Macintosh   TM
Programming Techniques
Microsoft®   BASIC   2.0
David   C.   Willen
Howard W.   Sams   & Co.,   Inc.
A Subsidiary of   Macmillan,   Inc.
4300   West 62nd Street,   Indianapolis,   Indiana   46268   U.S.A.

Reading notes: Trademark symbols TM and ® are rendered inconsistently in the source text

Printed product names: Macintosh · Microsoft BASIC 2.0

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-9fdb738b6ee77c5d54f54e2d536118dee932e7d1cd13d730cbd72739589cbbdc)

Transcribed text:

© 1985   by   David C. Willen
FIRST EDITION
FIRST PRINTING-1985
All rights reserved. No part of this book shall be reproduced, stored in a retrieval
system, or transmitted   by   any means, electronic, mechanical, photocopying,
recording, or otherwise, without written permission from the publisher. No patent
liability is assumed with respect to the use of the information contained herein.
While every precaution has been taken in the preparation of this book, the
publisher assumes no responsibility for errors or omissions. Neither is any liability
assumed for damages resulting from the use of the information contained herein.
International Standard Book Number:   0-672-22411-9
Library of Congress Catalog Card Number: 84-51275
Printed in the   United   States of   America
Macintosh, MacPaint, MacWrite are trademarks of Apple Computer, Inc.
Multiplan is a trademark of Microsoft Corp.
American People/Link is a division of American Home Network, Inc.
Compuserve refers to the Compuserve Information Service.
Dow Jones is a trademark of Dow Jones and Company, Inc.
The Source is a trademark of Source Telecomputing, Inc.

Reading notes: Copyright and printing dates are present but the Library of Congress catalog number is partly a control number rather than a date No primary heading is printed, so headline is null

Printed product names: Macintosh · MacPaint · MacWrite · Multiplan · American People/Link · Compuserve · Dow Jones · The Source

Printed dates: 1985 · 84-51275

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-1b5a5f84ebddbb9443445a6eea64e822b5a050a0598f7255765bd75cc4828073)

Transcribed text:

v
Contents
Preface   vii
Acknowledgments   ix
Chapter   1   Introduction   1
What You Will Need-Starting up BASIC-The Three Windows-
Running a Program-Maintaining Program Files-Listing
Programs-Other   Menu   Functions-Onward
Chapter   2   BASIC   Program Structure   13
BASIC   Statements-The Assigned Statement and Expressions-
Data Types-Character   String   Data-Array Variables-Statement
Labels-Simple Input and   Output-Decision   Making-Program
Loops-Storing Data Within a Program-Built-In Numeric
Functions-Built-In   String   Functions-Summary
Chapter   3   Advanced Programming Structures   61
Program   Structure-User-Defined   Functions-Subprograms-
Program Chaining-Interrupt Driven Structures-Intercepting
Program Errors
Chapter   4   BASIC   Files   97
Types of File Access-File Access Protocols-Sequential Files-
Writing Sequential Files-Reading Sequential Files- File   Structure-
Device Independent   1/0-Accessing   the Clipboard-Accessing the
Communications Port-The Check Writing Program, Version 1-
Random Files-Defining Random Files-Accessing Random File
Data-The   LSET   and   RSET   Statements-The Appointment
Calendar Program, Version 1-File Types-The FILE$ Dialog Boxes
Chapter   5   BASIC   Graphics   JS   9
Pixels and Graphics Coordinates-Relative Coordinates-The
POINT   Function-The LINE Statement-The CIRCLE Statement-
Animating Graphics Images-Summary

Reading notes: OCR spacing and hyphenation irregularities in chapter titles, e.g. 'JS 9' likely 'J 9' or 'page 139' uncertain

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-88b863840ff1c29c5e17c8946ef1b2fec134bf8964e8623e420e2fcc9a50c07d)

Transcribed text:

vi
Chapter   6   The Mouse   189
The   MOUSE   Function-Mouse Interrupts-Controlling the Mouse
Cursor
Chapter   7   Graphics Revisited   21'9
Controlling the Appearance of Text-The   PEN   Position-Drawing
with the Graphics Pen-Additional Graphics   Pen   Options-Setting   a
Background Pattern-Drawing Shapes-The   SCROLL   Statement-
Unifying   Graphics Commands with   PICTURE$-Graphics   Images
and the Clipboard-The Appointment Calendar Program, Version 2
Chapter   8   Windows   287
The   Output   Window Revisited-The   WINDOW   Statement-
Creating Custom Dialog Boxes- Interacting with Custom Dialog
Boxes-Dialog Interrupts-Summary
Chapter   9   Custom   Pull-Down   Menus   325
The   MENU   Statement-The   MENU   Function-The Menu
Interrupt-The Terminal Program Revisited-The Check Writing
Program Revisited-The Appointment Calendar Program, Version 3
-Summary
Index   375

Reading notes: Table of contents fragment; no product names, prices, or dates are printed in the supplied copy

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-d521341db6a9d5f67226026acb83dfdaa8fecb17e692cb921868673e5eac5ca3)

Transcribed text:

vii
Preface
Apple's Macintosh is unique in the history of microcomputers.   It   is the
first machine designed to be easily used by the novice. Apple achieved this
by incorporating several special devices and concepts. Programs and data
files are represented pictorially, and they are selected and manipulated
through use of the Macintosh mouse.
Apple defined standard procedures for the user to accomplish such
basic computer activities as selecting data, modifying data, and invoking
program functions. Because these procedures are standardized, most
Macintosh applications programs can incorporate them, and anyone
familiar with Macintosh operations can easily use almost any applications
program on the machine. Therein lies the true power of Macintosh. Those
long and unwieldy manuals, a different one for each applications
program, can finally be eliminated.
The Macintosh user interface, although comfortable and easy to use,
represents an extra burden for software developers: it is very difficult to
program with. This book is intended to help simplify that task and clear
up many of the mysteries surrounding the way the Macintosh works.   It
discusses such Macintosh techniques as
•windowing
•   dialog boxes
•   pull-down menus
•   using the mouse
•graphics
and incorporates many sample programs.
This book will show you how to write Macintosh applications using
Microsoft's   BASIC   programming language. This is an excellent language
with which to begin your study of the Macintosh. The fundamental
components of the language are simple to learn and use. More important,
the language does a fine job of providing programming structures that
allow access to the Macintosh user interface mechanisms. Thus, while
learning this language, you will automatically be learning how Mac works.
This book is not a reference work; it is a tutorial. I see no point in
filling a book with hundreds of pages that list each   BASIC   keyword in
alphabetical order when Microsoft's manual provides the same
information in that very format. Rather, what I have done here is to
separate the various features of the language by function. Thus, each
chapter of this book concentrates on a different aspect of the overall
language. When you read about a particular language feature, all of the

Reading notes: Source text ends mid-sentence, suggesting truncation at the page boundary.

Printed product names: Apple's Macintosh · Macintosh · Microsoft's BASIC

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-1b7b31e6dc0582b2978aa631302d7ff1c701081fc550311111706f37d3d23909)

Transcribed text:

viii
statements and functions pertinent to that feature are also presented. This
makes the book a lot easier to work with and enjoy.   Once   you have gained
experience with the language, you can use the many tables and figures in
this book for reference. You can then use the Microsoft manual to look up
a specific keyword or statement alphabetically.
If   you are new to the   BASIC   language, do not panic. There is detailed
information on the fundamental concepts of this popular language in
Chapter 2. (The experienced   BASIC   programmer may want to skim over
this chapter.) In Chapter 3, I cover language extensions that help give
structure to your programs. Interrupt and error processing techniques are
also covered here. Chapter 4 deals with various techniques for accessing
data files, the serial communications port, and the Macintosh Clipboard.
Chapter   5   is about graphics and focuses on those statements in Microsoft
BASIC   that can be used on other computers as well as the Macintosh. In
Chapter 6, you will learn how to deal with the Macintosh's ubiquitous
mouse. Graphics are revisited in Chapter 7, where you will discover the
many powerful graphics functions that are unique to the Macintosh. Text
fonts and type styles, filled graphics shapes and patterns, and line drawing
techniques are all covered in this chapter. Chapter 8 is about windows and
dialog boxes -   how to create and use them. You will learn how to build
custom dialog boxes to make your programs look just like professional
Macintosh applications. Finally, Chapter 9 covers pull-down menus. Here
you will learn how to add your own menus to the menu bar and how to
remove existing ones.
Throughout the book I have included a great many sample programs.
These start out simple and get more and more complex as the book
progresses. I return to many of the simpler programs in later chapters,
continually refining them and making them more powerful as new
language features are added. This closely follows the way programs are
written by professional programmers.   Such   programs usually start out
representing nothing more than a basic idea that might work nicely on a
computer. Through continual refinement and the adding of new features,
the program eventually becomes a full-fledged application useable by you
or other microcomputer owners.
David   C.   Willen

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-3d13b80daca7d09282a429781aa48a1c9f946532b7a1dfe80bb2886a88dcea35)

Transcribed text:

Ix
Acknowledgments
I would like to thank   Peter   Mann for his generous and invaluable
assistance during the development of this book. Thanks go also to James
V. McCusker for his many Macintosh insights.
Most important, I must thank the Howard W.   Sams   Company for their   ·
tireless dedication to accuracy and quality. They have made this book
possible.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-38765dce3cb22b1d1251872d39e74a09eacf79e9ebb857a15cd06454181685d0)

Image description: The image shows a plain green sheet with a thin cyan vertical line near the left edge and a faint fold or border line near the right edge, with no visible artwork or text.

Reading notes: No visible text found on the scan; transcript and printed fields are left empty. The faint vertical lines near the left and right edges may be paper folds or scanner borders rather than printed content.

[Original PDF page 10](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/1#scan-0b3175e97e4feb6beb157c604c527065b3c77dd33afdc00c985fc6d8bad92adc)

Transcribed text:

Chapter 1

Introduction

Image description: A chapter opener page with a green 'Chapter 1' label and a large 'Introduction' heading beside a vertical rule, above a green-and-white framed illustration of a hatched three-dimensional cube on a light surface.

Reading notes: Faint, blurred ghost text from the reverse side of the page is visible in the left and center margins but is not legible and was not transcribed.

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/bc8347339e2d5398af4ba99e174e62d7efcd1524ba29fa7dd3397081e80036f3/SAMS_Macintosh_Programming_Techniques_1985.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-sams-macintosh-programming-techniques-1985-22464d/2.md)
