# How To Write Macintosh Software 1988 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/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-how-to-write-macintosh-software-1988-54f7a8/1#scan-99d025a5ba169a1b2a4986dc8b1bf9e18b7225d5520d880eabb8711a4433c1c6)

How to Write Macintosh Software

Transcribed text:

HAYDEN Macintosh Library BOOKS 48429

How to Write Macintosh® Software

The Debugging Reference for Macintosh®

Updated for Macintosh SE and II

Second Edition

Scott Knaster

Image description: A book cover with a green gradient background, a magenta top band, and a central framed illustration of open blue arched windows revealing a red cube, a gold twisted helix, and a tiled white floor, with a red wavy line across the sides.

Reading notes: The number 48429 near the top right is small and its meaning is not labeled, so it is transcribed as printed. The series name 'Macintosh Library' appears in a red script style and may be read with some stylization.

Printed product names: Macintosh · Macintosh SE

Languages: English

[Original Image 1](https://www.vintageapple.net/files/02ac5bc78dc61ff449cbec3f695de2552bdfc8196ae04a791199559706f72408/b605131766e534e634f5a4be.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-af5c337ba094cb2a6700065c219c84fce3985645ee359033a94c85ce6f831885)

How to Write Macintosh Software

Transcribed text:

HAYDEN Macintosh Library BOOKS 48429

How to Write Macintosh® Software

The Debugging Reference for Macintosh®

Updated for Macintosh SE and II

Second Edition

Scott Knaster

Image description: A book cover with a green gradient background, a magenta top band, an open arched window framing a golden twisted tube and red and purple blocks against a blue sky over a tiled floor, with a red wavy line crossing the sides.

Reading notes: The top-band script reading 'Macintosh Library' is stylized and partly interpreted from the logo; the 'Macintosh' word in it is rendered in red script.

Printed product names: Macintosh SE

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-038481b9935c4439ceacfece6e5f56aa258034d5087a6ec2f244a40d4063aa6f)

Image description: The image is a entirely blank white page with no visible artwork, layout, or text.

Reading notes: No visible text or imagery was found in the scan, so the transcript and all printed fields are empty.

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

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-b6b5a332bd6865fe268dc5b369ebe1821431d56b0b058777d1b6f6b1297c381b)

Macintosh Revealed

Transcribed text:

HAYDEN
Macintosh® Revealed
Volume   One:
Unlocking   the Toolbox
Second Edition
Stephen Chernicoff
Volume Two:
Programming with the
Toolbox
Second Edition
Stephen Chernicoff
Volume Three:
Mastering the Toolbox
(forthcoming)
Stephen Chernicoff
Volume Four:
Programming the
Macintosh® II (forthcoming)
Stephen Chernicoff and Geri
Younggren
Advanced Macintosh®   Pascal
Paul   Goodman
Basic Microsoft® BASIC for
the Macintosh®
James   S.   Coan and Louisa Coan
MPW   and Assembly
Language Programming
Scott Kronick
Introduction to Macintosh®
Pascal
Jonathon Simonoff
BOOKS
Object-Oriented
Programming for the
Macintosh®
Kurt J. Schmucker
HyperTalk   ™   Programming,
(Version 1.2), Revised Edition
Dan Shafer
HyperTalk   TM   Tips and
Techniques
Dan Shafer
The Waite Group's
HyperTalk   TM   2.0   Bible
The Waite Group
IBM®   PC   and Macintosh®
Networking: Featuring   TOPS
and AppleShare   TM
Steve Michel
Macintosh® Hard Disk
Management
Bencion J. Calica and Charles Rubin
Nonlibrary Titles
Artificial Intelligence
Pro~amming   on the
Macmtosh®
Dan Shafer
Understanding HyperTalk   TM
Dan Shafer
For the retailer nearest you, or to order directly from the publisher,
call   800-428-SAMS.   In Indiana, Alaska, and Hawaii   call   317-298-5699.

Reading notes: Reading order of the book series listing is uncertain Some title fragments appear split across lines

Printed product names: Macintosh · Macintosh II · Macintosh Pascal · Microsoft BASIC · HyperTalk · TOPS · AppleShare · Macintosh Hard Disk Management

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-01258f2567dd08e687444c93412d6db647d047a88e4d9ca73322903a5006a0a3)

How to Write Macintosh® Software

Transcribed text:

How   to Write
Macintosh®
Software
Second Edition
Scott   Knaster
HAYDEN   BOOKS
A Division of Howard   W.   Sams   &   Company
4300   West 62nd Street
Indianapolis. Indiana 46268   USA

Reading notes: Title spacing in source appears irregular; headline normalized to standard word spacing

Printed product names: Macintosh®

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-11ee434731bfa3c01929058adc1f81013ed26aaf11aed6b3093a1cf714e2ea79)

Transcribed text:

@   1988   by   Hayden Books
A Division of Howard   W.   Sams   &   Company
SECOND   EDmON
FIRST PRINTING-1988
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   peimission   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   from the
use   of   the   information   contained herein.
International Standard Book Number:   0-672-48429·3
Llbnuy   of   Congress   Number: 88-61959
Acquisitio:is   Editor:   Greg   Michael
Developmental Editor:   C.   Herbert Feltner
Production Coordinator:   Maijori.e   Colvin
Cover   Art:   Celeste Design
Composition:   McFarland.   Graphics   &   Design,   Inc.
Printed in the   United   States of America
Macintosh is a trademark of Mcintosh   Laboratory.   Inc., licensed to Apple
Computer,   Inc. Lisa,   Finder,   Inside Macintosh,   MacWrite, MacPaint, and
MacDraw are trademarks   of   Apple   Computer,   Inc. TMON is a trademark
of ICOM Simulations, Inc.

Reading notes: Garbled characters such as 'peimission', 'Llbnuy', 'Acquisitio:is' and 'Mcintosh' suggest OCR errors. '0-672-48429·3' and 'Library of Congress Number' values may be partially damaged.

Printed product names: Macintosh · Lisa · Finder · Inside Macintosh · MacWrite · MacPaint · MacDraw · TMON

Printed dates: 1988 · 88-61959

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-6d45c775d540f9866a512a9e407b48355e969f12552309c94ca9d2f6e1c6adbf)

Image description: The image is a entirely blank white page with no visible artwork, layout, or text.

Reading notes: No visible text or imagery found; returned empty printed fields.

[Original PDF page 6](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-b610e864c0fd3733f1ccac0f55c6b91c961e039049fa1471479c7ac25e166d8e)

Transcribed text:

Contents
Acknowledgments   xi
Introduction   xiii
About This Book   xv
PART   ONE   How It All Works   1
Chapter 1   Getting   Started   3
Different   3
The ROM   5
Everything   You Know Is Wrong   7
How to Get There from Here   10
Resources   12
Building Our Application   13
Other Kinds of Programs   17
Power   Tools   18
Chapter 2   Things in Memory   23
Fables   23
That Amazing Moving   Memory   24
Allocating   Memory   28
Heaps   29
Purging   36
How Relocation Works   38
Explicit Dereferencing   43
Implicit Dereferencing   49
vii

Reading notes: Table of contents fragment; heading may not be the primary title of the source.

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-784b0e32ddde110cabddd560ea17d39008455b5de1d14ab8b1853cc79ae683cd)

Transcribed text:

...   How to Write Macintosh Software VIII
Chapter 3   More about Heaps and Fragmentation   59
What Does   "Out   of   Mem01y"   Really Mean?   59
Objects   in Heaps   66
Heap Zone Header   67
Heap Block Header   68
Master Pointers   71
Using   the   Memoiy   Manager   73
Reducing Fragmentation   75
Segmenting Your Application   78
Unloading   Your Segments   80
PART   TWO   Debugging   83
Chapter 4   Debugging   Macintosh   Software
Bugs   85
Kinds of Bugs   86
Why System Errors Don't Tell   You   Veiy   Much   88
The Art of Debugging   89
Debugging   Questions   90
Debugging   Tools   96
Hardware Debuggers   120
Common Crashes   121
Some Advice on   Debugging   126
Chapter 5   Examining Compiled Code   129
Compilers   129
Allocating Space for Data   132
Stack Frames   137
Statements and Variables   150

Reading notes: Table of contents text with garbled characters (e.g., 'Memoiy', 'Veiy', '01y') and spacing artifacts No primary heading is visibly printed in the supplied copy

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-b3ae85d6b296a74175cbd9efe34364128d36978c25f68341975b04e704a8bb02)

Transcribed text:

. IX   Contents
Chapter 6   More About Compiled Code   169
Procedure and Function Calls   169
Conditional Statements   190
Repetitive Statements   196
With Statements   200
Linked Routines   201
Standard   Library   Routines   204
ROM   Interlace   Routines   204
The Jump Table   211
Format of Jump Table Entries   212
Miscellaneous Things in Your   Object   Code   216
Summary   217
Chapter 7   Real Live   Debugging   219
What We'll Do   219
Running the Program   230
Watching More Closely   240
Looking for the Address Error   247
Finding the Text Bug   252
Finding the Window-erase Bug   254
Looking for More Bugs   256
Optimizing   with the Debugger   267
Objects   in the Heap   279
Looking at Resources   284
Identifying the Remaining Heap   Objects   285
Special Free Bonus   286
PART THREE   Tips,   Tricks,   and Techniques   299
Chapter 8   General Techniques   301
Preflighting   301
How to Get Around Pascal's   'fype   Checking   304
Patching Traps   307
Updating   Your   Menu Items   308
Which Registers   You   Can   Use   319

Reading notes: Source is a table of contents, not advertising copy; no headline or product or price data present Some table-of-contents entries contain irregular spacing and possible OCR spacing artifacts

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-0d2f6c510f4906ab0dd464532b77093a01f8e1de4b2f63239d9787dac37ad40d)

Transcribed text:

Chapter 9
Chapter   10
APPENDICES
X   How to Write Macintosh Software
Toolbox Techniques
Writing a Definition Function in a High-level   Language
Logical Clipping
Using   ResEITProC
Moving a Resource from   One   File to Another
The   Poor   Man's Way to Smooth Animation
Automatic Window   Updating
TextEdit Hooks
Using   "Real"   Fonts
Resuming from System   EITors
Operating   System   Techniques
High-level and Low-level Calls
Printing   Bitmaps
How   ROM   Calls Work
Random Access File   1/0
When   Your   Application Ends
Keeping Things Around between Applications
Appendix   A   Assembly   Language   Overview
Appendix   B   Common Problems
Appendix C   A Guided Tour of Macsbug
Appendix   D   Ancient   Histoiy
Appendix   E   Debugging   Quick Reference Guide
Glossaiy
Index
323
323
326
327
328
334
337
350
352
368
371
371
372
373
374
380
381
387
417
429
453
473
497
507

Reading notes: OCR errors such as 'EITors' for 'Errors' and 'Histoiy' for 'History' in the table of contents Page number column alignment is uncertain

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/1#scan-d07c0c0830dbdb5f448137cb6e0737b1318d1f05939ba3d0d5cbe0e259ef3baf)

Transcribed text:

Acknoftlledgntents
without these people, this book would not exist, and you would
now be staring at nothing and looking   very   silly.
Jim Friedlander of Macintosh Technical   Support   provided massive
help. He read the entire manuscript several times and kept me honest;
he wrote most of the programs in   Part   Three; and he helped me keep up
my energy level with his enthusiasm.
Martha   Steffen,   Apple Publishing Evangelist, helped me figure out
how to get started and what was happening to me along the way.
Scot   Kamins, Writeur, encouraged me, told me funny jokes, and gave
me a great   review.   I also stole ideas from his books.
Caroline Rose inspired me by being the best technical writer I've ever
known, and by writing Inside Macintosh, without which no other
Macintosh technical books would be possible.
Cacy   Clark and Russ Daniels were   very   smart (and still   are)   and
taught me a lot of the stuff that appears in this book.
Bryan   Steams,   Ginger Jernigan, Mark Baumwell, Louella Pizzuti, .Bill
Dawson, and Rick Blair of Apple Technical   Support   put up with me
whenever   I   rambled on about this book.
Chris Espinosa invented the tree-crash metaphor used in Chapter 4,
which is used with his   permission,   whether he knows it or not.
Alain Rossmann gave me valuable ideas for the   "Techniques"   section
and provided lots of enthusiasm.
Brian McGhie, the Gatekeeper of Low   Memory,   helped me figure out
what was going on in system globalville.
Mike McGrath gave me great advice on how to write a book and get
it published and loaned me his copy of   Author Law.
Jean-Louis Gassee has encouraged creativity and fun at Apple in the
post-Steve Jobs era.
Guy Kawasaki changed my life, and   I   have the bumper sticker to
prove it.
Barbara   Krlaster   created many of the   figures,   constructed Appendix
E, fixed lots of   stuff,   and, most important, told me to do it and made me
do it.
xi

Reading notes: Some words may be run together or misspelled due to OCR, such as 'Acknoftlledgntents' and 'globalville' Name 'Barbara Krlaster' may be an OCR error

Printed product names: Macintosh · Inside Macintosh · Author Law

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/2cd2f74038224866b01113baf00c8d8f9b78d52a667e67390f0d54329737b13a/How_To_Write_Macintosh_Software_1988.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-how-to-write-macintosh-software-1988-54f7a8/2.md)
