# PowerPC Programmers Toolkit 1996 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/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-powerpc-programmers-toolkit-1996-603f13/1#scan-f8342e4997b0bdda0791eb8dc3de90c292fff990f330ce771e64a3c5f5520608)

Transcribed text:

PowerPC™
Programmer's
Toolkit
The definitive resource on the latest PowerPC techniques
CD-ROM includes a special version of Metrowerks CodeWarrior™ Lite
Tom Thompson

Image description: A book cover with large yellow bold sans-serif title text on a dark maroon background, a small CD-ROM disc icon at the lower left, and a faint image in the upper center.

Reading notes: The small faint image at upper center contains no legible text. The CD-ROM label and the 'includes a special version of' line are small and were read from the image at low resolution; spacing is approximate.

Printed product names: PowerPC

Languages: English

[Original Image 1](https://www.vintageapple.net/files/378f56658ca5772e5f75863dfdb08c778716fbfb6b5bfe38f7f85188163100b5/f9c045ea35ff0752ef1be5ba.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-d0db1faf747407e4e410296514b45f7217c24bc396853a36d6c2ada7e68f744e)

Transcribed text:

PowerPC™ Programmer's Toolkit

The definitive resource on the latest PowerPC techniques

CD-ROM includes a special version of Metrowerks CodeWarrior™ Lite

Tom Thompson

Image description: A book cover with bold yellow sans-serif title text on a dark red textured background, a small faded image at top center, and a CD-ROM disc icon at the lower left beside the caption.

Reading notes: The small faded image at top center has no legible text. The trademark symbols after PowerPC and CodeWarrior are small and approximated as ™.

Printed product names: PowerPC

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-9a98189fb0a1891b800169140b363b93de0d8fc2167089abdb96ef715c3c6e0f)

Transcribed text:

PowerPC Programmer's Toolkit

Image description: A gray cover page with white and dark gray gear illustrations, and a central white rectangle with a black border containing the bold black title text.

Printed product names: PowerPC Programmer's Toolkit

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-71556d609677d17dcf69d77908f552df616d4628a86af8c5d5ebe5dc07900243)

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

Reading notes: No visible text appears anywhere on the page, so the transcript and printed fields are empty.

[Original PDF page 3](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-fae16de084de5afe8db6d13f78893d8b3a4e809eda13e8631c67403f659c5429)

Transcribed text:

PowerPC Programmer's Toolkit
©1996 Hayden Books, a division of Macmillan Computer Publishing
All rights reserved. Printed in the   United   States   of   America. No part of this
book may be used or reproduced in any form or by any means, or stored in a
database or retrieval system, without prior written permission of the pub-
lisher except in the case of brief quotations embodied in critical articles and
reviews. Making copies of any part of this book for any purpose other than
your own personal use is a violation of   United   States   copyright laws. For
information, address Hayden Books,   201West103rd   Street,   Indianapolis,
Indiana   46290.
Library of Congress Catalog Number:   95-80297
ISBN:   1-56830-241-x
This book is sold as is, without warranty of any kind, either express or im-
plied. While every precaution has been taken in the preparation of this book,
the publisher and author assume no responsibility for errors or omissions.
Neither is any liability assumed for damages resulting from the use of the
information or instructions contained herein.   It   is further stated that the
publisher and author are not responsible for any damage to or loss of   your
data or your equipment that results directly or indirectly from your use of
this book.
98   97   96   4   3   2   1
Interpretation of the printing code: the rightmost double-digit number is the
year of the book's printing; the rightmost single-digit number is the number
of the book's printing. For example, a printing code of 96-1 shows that the
first printing of the book occurred in 1996.
Trademark Acknowledgments
All terms mentioned in this book that are known to be trademarks or service
marks have been appropriately capitalized. Hayden Books cannot attest to
the accuracy of this information.   Use   of a term in this book should not be
regarded as affecting the validity of any trademark or service mark.
PowerPC is a trademark oflnternational Business Machines Corporation,
used under license therefrom.
Apple, Macintosh, and the Apple logo are trademarks of   Apple Corp., regis-
tered in the   U.S.   and other countries.

Reading notes: OCR spacing and hyphenation irregularities in running text 'oflnternational' appears to be an OCR error for 'of International'

Printed product names: PowerPC · Macintosh · Apple

Printed dates: 1996 · 95-80297 · 96-1

Languages: English

[Original PDF page 4](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-260d0fc7b9b0c20b3fd1fa2076975b07a7f8c52896df6f1cebd83f25174a8b05)

Transcribed text:

The Hayden Books Team
Publisher:   Lyn   Blake
Publishing   Manager:   Laurie Petrycki
Development   Editor:   Kezia Endsley
Copy and Production Editors:   Bront Davis, Lisa Wilson
Technical   Reviewers:   Jim Trudeau, Metrowerks, Inc.
Alan Llllich, Apple Computer, Inc.
MarkAnderson, Metrowerks, Inc.
Cover Designer:   Karen Ruggles
Interior   Designer:   Sandra Stevenson
Production   Analysts:   Mary Beth Wakefield
Production Team Supervisor:   Laurie   Casey
Production Team:   Heather Butler, Angela Calvert,
Kim Cofer, Dan Caparo,
David Garratt, Aleata Howard,
Michelle Lee, Erika Millen,
Beth Rago, Erich Richter,
Karen Walsh
Indexer:   Brad Herriman
·/

Reading notes: Source lists a credits page with no advertised products, prices, or dates; headline is not explicitly printed

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-a995a0dbdc1bc4235b0c4899816033611241381c64e7520cf8de406afcbf4e0e)

Transcribed text:

Dedication
To my wife, Brenda Jean, and my children, John and Evelyn.
About the Author
Tom Thompson has a   BSEE   degree and bought his first 128K Macintosh in
early 1984. He is a Senior Tech Editor at Large for   BYTE   magazine and has
been covering the Mac for over ten years. He is an Associate Apple Devel-
oper, and has substantial programming experience, including authoring
several shareware utilities. He has also researched and written numerous
articles on programming and hardware technology.

Reading notes: Source text is a dedication and author biography with no explicit advertised products or prices; primary heading not present in supplied copy.

Printed product names: Macintosh

Printed dates: 1984

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-aeebc28d0faf6f83c3d3769daab71b1cee5547e8c9e1e04397cf0e6c07276b7c)

Transcribed text:

Acknowledgments
A book is a lot like a programming project.   It   involves a lot of people working
in concert to achieve the final outcome-all on budget and on schedule.
While publishing doesn't normally involve writing code and using
debuggers, in some ways it is more work because you have to explain things
in a way that makes the most sense to the most people. People are pretty
imprecise beings, unlike computers.   Of   course, this is a programming book
where you do have to write code, use debuggers, as well as   try   to make things
sensible.   It   can be done, but not without the capable assistance of many
good people whom I'd like to thank.
To Karen Whitehouse at Hayden Books for her support for the second edition
of this book. Thanks to Llsa Wilson and Bront Davis for making my prose
sensible.   An   award to my editor Kezia Endsley, for tirelessly shepherding this
book into reality.
To Greg Galanos, Jean Belanger, Dan Podwall, John McEnemey, Berardino
Baratta, and the rest of the Metrowerks gang for providing timely support
and updates to their excellent CodeWarrior software during the course of
writing this book. To Jordan Mattson at Apple for his support and access to
PowerPC material.
To Eric   Shapiro   of Rock Ridge Enterprises for his valuable code contributions
and suggestions. Eric taught me everything about 68K trap patching, and did
it again for PowerPC trap patching. A lot of his code appears in the FlipDepth
Extension shown in Chapter 6, and he made many recommendations that
improved the SwitchBank application. Without his efforts and timely sup-
port, Chapter 6 would not have been possible.
Thanks to Roger Goode for the improved graphics. Thanks to my tech
reviewer, Jim Trudeau, for his perceptive remarks.   Special   thanks to Richard
Hooker and Marvin Denman for checking over the cache descriptions.
Special   thanks to Randy Thelen for his insights into the Power Mac run-time
architecture, which helped shape Chapter 4.
Thanks to   Steve   Jasik for providing a copy of The Debugger, software that   will
really make a difference in debugging PowerPC programs.
Last but not least, I would like to thank my wife Brenda for her patience
during the long nights I spent toiling away on this new edition.
I

Reading notes: OCR-style spacing and character errors such as 'Llsa' and 'Bront' and 'McEnemey' may be misreadings of names. Reading order of the final line 'I' is uncertain.

Printed product names: CodeWarrior · The Debugger · Power Mac

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-f591c5875ade685fb52e9a8822694c60b10c0b9df597415e67a032b4ed9b31a0)

Transcribed text:

Overview
Front Matter
Introduction
Chapter 1: The Power Macs and a Brief History
Chapter 2: Beginning Programs
Chapter 3:   Using   the Toolbox
Chapter 4: The PowerPC Software Architecture
Chapter 5: Putting ItAll Together
Chapter 6: The Art of Debugging
Chapter 7: Performance and Processors
Appendix A: The PowerPC   RISC   Processor Family
Appendix B: Porting to the PowerMac
Appendix C: Program Llstings

Reading notes: "Llstings" in Appendix C may be an OCR error for "Listings" "ItAll" in Chapter 5 appears to be missing a space

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-a6d0c03e6ae2aacee1040a2acba0ce5f4e33f3ec7d3841e9ef024ea33fd05b67)

Transcribed text:

Contents
Introduction   1
What You'll Need   .................................................................................. 2
The Road Map ...................................................................................... 2
The Metrowerks CodeWarrior Lite on the   CD   ................................... 4
Additional Notes .................................................................................. 5
1   The Power Macs and a Brief History   7
History of the   Power   Macs ................................................................... 7
The Early Mac .............................................................................. 8
The First-Generation   Power   Macs ...........................................   10
Apple and IBM: Who   Could   Have Imagined   It?   ....................•..........   13
Time for a Change (to   Power   Mac) ................................................... 25
2   Beginning Programs   27
Beginning Programs .......................................................................... 27
About the Toolbox   .............................................................................. 28
Munge It .............................................................................................. 29
Getting Started ...................................................................................   30
The   Code   Tour .................................................................................... 32
Making Munger .................................................................................. 35
Running Munger ................................................................................   40
Where's the Mac? ............................................................................... 42
Processes Revealed ............................................................................ 43
Gathering Processes ........................................................................... 45
A Word of Caution .............................................................................. 47
Just the Beginning............................................................................. 48
3   Using the   Toolbox   49
Meet Some Managers ........................................................................ 51
Initializing Managers ......................................................................... 54
Run the   Code   ...................................................................................... 58
The Fork   in   the File ............................................................................ 59
Making Resources .............................................................................. 61
Making Menus .................................................................................... 63

Reading notes: Table of contents formatting contains stray characters such as '•' and '.....' that may be OCR artifacts

Printed product names: Metrowerks CodeWarrior Lite · Power Mac

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-510a5ede1134a3a92c9518c0e50407831738f3f3acf6d7afc892f4f899c61574)

Transcribed text:

0- ~!"!'   ~'~'"'~":!.'C'   !~~"-   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Making Dialog Boxes ......................................................................... 68
Editing Dialog Boxes .................................................................   70
Adding Buttons .......................................................................... 72
Numbering Dialog Items .......................................................... 73
Status   Display ..................................................................................... 74
Adding Alerts ...................................................................................... 76
Saving   Resource Data as Text ............................................................ 82
Some   Words on Events ...................................................................... 83
Code at Last ........................................................................................ 85
The First Function .............................................................................. 88
Munger Code, Revisited .................................................................... 89
Input and   Output   Filenames ............................................................. 92
Basic Application Functions ............................................................. 96
Main Event Loops ............................................................................   100
The Initialization Function .............................................................   106
Build Munger ....................................................................................   108
High-Level Events ............................................................................   110
Make Munger Handle High-Level Events ...................................... 111
Modifying the Event Loop Code ..................................................... 112
Delivering High-Level Events .......................................................... 113
Writing the Handlers ........................................................................ 116
Making   SonOMunger   High-Level
Event Savvy..................................................................................... 123
New Alerts ......................................................................................... 124
Bundle Resource .............................................................................. 125
Finishing   Up   ....................................................................................   130
The Fork in the Road ........................................................................ 131
4   The PowerPC Software Architecture   133
The   680x0   Application Run-Time Architecture ............................. 135
The PowerPC Application Run-Time Architecture ....................... 144
Segue:   The Care and Feeding of   Stack   Frames .............................. 153
680x0   Function Calls ............................................................... 154
PowerPC Function Calls ...........   ......................................   ........ 156
Mode Mixing..................................................................................... 162
A Tale of Two Processors .................................................................   170

Reading notes: Table of contents format with page numbers; headline taken as first chapter entry Some characters are garbled (e.g. 'SonOMunger' in an entry), possibly OCR damage

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/1#scan-d9851a9ea18dd72e67baefc6485f7f75a496bdac4887fbb5992c03f103115d69)

Transcribed text:

________________________________________________   <e.o~te~"   -0
5   Putting   It   All   Together   171
SwitchBank: Initial Investigation and Design................................ 173
Building Resources with Rez .....................   ........... ..   ......................... 175
Using   Rez with the ToolServer ............................................... 188
Using   Rez from Inside CodeWarrior ...................................... 193
The SwitchBank   Program   ................................................................ 196
Making a Fat Binary ......................................................................... 222
Handling a Code Fragment ............................................................. 228
Interlude: The Anatomy of a Trap ................................................... 229
Writing a Fat Trap ............................................................................ 234
Building a Fat Trap ........................................................................... 265
Building a Fat Resource ................................................................... 276
Showlnitlcon Code .......................................................................... 278
Compiling the Fat Resource ............................................................ 287
Summary   ........................................................................................... 295
6   The Art of Debugging   297
About Debuggers .............................................................................. 298
Using   the CodeWarrior Debugger ..................................................   302
Low-Level Debuggers ...................................................................... 321
MacsBug .................................................................................. 321
The Debugger .......................................................................... 326
Debugging Techniques .................................................................... 332
A Bug Taxonomy ..................................................................... 334
Debugging Miscellany ............................................................   340
Enough Debugging .......................................................................... 343
7   Performance and Processors   345
Planning and Profiling ..................................................................... 346
Profiling for a   Purpose   ............................................................ 346
Performance Issues ................................................................. 347
Code Tuning ..................................................................................... 348
A Word about Caches ....................................................................... 349
Cache Operation ....................................................................   :   350
Cache Details ........................................................................... 351
General Caching Principles ............................................................. 353

Reading notes: Source appears to be a table of contents with OCR noise such as '<e.o~te~"' and '~' characters Primary heading not clearly identifiable from the supplied copy

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/409a935f75dc23dab47a597a79e6b5c2171279b560b5b455e034c45f684cff58/PowerPC_Programmers_Toolkit_1996.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-powerpc-programmers-toolkit-1996-603f13/2.md)
