← Apple Machine Language 1981 (raw-bw)

Apple Machine Language 1981 (raw-bw)

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

APPLE MACHINE LANGUAGE

REWARD BOOK APPLE MACHINE LANGUAGE DON INMAN / KURT INMAN Learn machine language programming quickly and easily, using this unique and entertaining method—combines color, graphics, and sound with step-by-step, uncomplicated demonstrations.

A black book cover with yellow and red title lettering and a large maze-like geometric graphic in red, yellow, black, and white beneath the author names, with a Reward Book diamond logo in the upper left.

Reading notes: The 'REWARD BOOK' text at the top left is very small and was read with some uncertainty. The small italic words 'quickly' and 'easily' are rendered in italics in the image; the transcript preserves the words as printed.

Printed product names
Apple Machine Language
Languages
English
PDF page 1

APPLE MACHINE LANGUAGE

REWARD BOOK APPLE MACHINE LANGUAGE DON INMAN / KURT INMAN Learn machine language programming quickly and easily, using this unique and entertaining method—combines color, graphics, and sound with step-by-step, uncomplicated demonstrations.

A black book cover with yellow and red title and author text above a large square maze-like abstract pattern in red, yellow, white, and black, with a yellow star-shaped Reward Book logo in the top left corner.

Reading notes: Small 'REWARD BOOK' text at top left is tiny and was read with some uncertainty. Italic emphasis on 'quickly' and 'easily' is inferred from styling and kept as plain words.

Languages
English
PDF page 2

Apple Machine Language

1979 Apple Machine Language Don Inman Kurt Inman Reston Publishing Company, Inc. A Prentice-Hall Company Reston, Virginia

A book title page with a handwritten year in the top right corner, a horizontal rule, large bold sans-serif title text centered, two author names below, and the Reston Publishing Company logo with address lines at the bottom left.

Reading notes: The handwritten year in the top right corner is read as 1979 but the digits are stylized and may be misread. The handwritten annotation is not part of the printed copy and is included only as a visible date.

Printed product names
Apple
Printed dates
1979
Languages
English
PDF page 3

Library of Congress Cataloging in Publication Data Inman, Don. Apple machine language. Includes index. 1. Apple computer—Programming. 2. Basic (Computer program language) I. Inman, Kurt, joint author. II. Title. QA76.8.A66156 001.65'2 80-20083 ISBN 0-8359-0231-5 0-8359-0230-7 pbk. © 1981 by Reston Publishing Company, Inc. A Prentice-Hall Company Reston, Virginia 22090 All rights reserved. No part of this book may be reproduced, in any way or by any means, without permission in writing from the publisher. 10 9 Printed in the United States

A plain text-only copyright and cataloging page with bold catalog data at top, italic rights notice in the middle, and small printer's imprint at the bottom on a white background.

Reading notes: The ISBN and catalog numbers are small but appear legible; the '0-8359-0230-7' line has a faint mark before the leading zero.

Printed dates
1981 · 80-20083
Languages
English
PDF page 4

Contents PREFACE vii Chapter 1 BASIC REVIEW OF APPLESOFT II BASIC 1 Commands, 2 Assignment Statements, 6 Display Statements, 8 Loop Statements and Subroutines, 11 Graphic Statements, 13 Relational Statements, 15 Precedence of Mathematical and Logical Relationships, 15 Strings and Functions, 16 BASIC Statements of Special Importance, 17 Exercises, 20 Answers to Exercises, 21 Chapter 2 BOS CROSSING THE BRIDGE 22 Memory Use, 25 A Simple BASIC Operating System, 29 The Completed BASIC Operating System, 41 Exercises, 44 Answers to Exercises, 44 Chapter 3 BOS INSTRUCTION CODE FORMAT 46 Number Systems, 47 Accumulator, 53 Instructions in Memory, 57 Use of the BASIC-M/L Operating System, 57 Summary, 68 Exercises, 70 Answers to Exercises, 71 iii

A black-and-white printed table of contents page with a large bold centered heading 'Contents', a horizontal rule at top, chapter labels on the left with boxed tags reading BASIC and BOS, and page entries listed in the right column with page numbers.

Reading notes: Chapter 3 entry 'Instructions in Memory, 57-' has a small trailing mark that may be a dash or artifact. Boxed tags BASIC and BOS are rendered as outlined labels; transcribed as printed. Page number 'iii' at bottom is italic and small.

Languages
English
PDF page 5

Chapter 4 BOS SIMPLE GRAPHICS 72 Plotting a Point on the Screen, 73 Four-Corner Plot, 79 Drawing a Horizontal Line, 83 Drawing Vertical Lines, 86 Drawing a Rectangle, 89 Summary, 92 Exercises, 93 Answers to Exercises, 94 Chapter 5 BOS DISPLAYING TEXT 95 Displaying a Character, 95 Discussion of the New Instructions, 99 Running Through the Alphabet, 106 Displaying ASCII Codes, 109 Running the Program, 112 Displaying More Than One Line, 113 Summary, 120 Exercises, 122 Answers to Exercises, 124 Chapter 6 BOS APPLE SOUNDS 125 Modification to the BASIC Operating System, 127 Description of the Tone Experiment Program, 128 Executing the Program, 130 How Sections 2 and 3 Work, 136 Summary, 138 Exercises, 140 Answers to Exercises, 141 Chapter 7 BOS MORE SOUNDS AND GRAPHICS 142 Combining the Speaker and Video Display, 142 Entering and Running the Program, 147 Using the Keyboard to Play the Notes, 148 Description of the Program, 151 Entering and Running the Program, 155 Summary, 156 Exercises, 158 Answers to Exercises, 159 Chapter 8 SM THE APPLE SYSTEM MONITOR 160 The Processor Status Register, 167 Subtraction, 172 Summary, 176 Exercises, 177 Answers to Exercises, 178 iv

A black-and-white book table of contents page listing chapters, section titles, page numbers, and boxed BOS and SM tags beside chapter headings.

Reading notes: The boxed tags 'BOS' and 'SM' are abbreviations shown in outlined boxes; their meaning is not printed on the page. Headline is taken as the first chapter title 'SIMPLE GRAPHICS' since the page is a table of contents rather than an ad.

Languages
English
PDF page 6

Chapter 9 SM MULTIPLE PRECISION AND NEGATIVE NUMBERS 179 Two-Byte Addition, 179 Two-Byte Subtraction, 184 Negative Numbers, 186 A Number Guessing Game, 189 Summary, 200 Exercises, 201 Answers to Exercises, 202 Chapter 10 SM MORE MONITOR MAGIC 203 Hexadecimal Addition—Immediate Mode, 203 Hexadecimal Subtraction, 206 Decimal Arithmetic, 208 Examining and Altering Registers, 217 Summary, 223 Exercises, 224 Answers to Exercises, 225 Chapter 11 MINI-ASSEMBLER AND ADDRESSING MODES 227 MA SM Using the Mini-Assembler, 228 Indexed Addressing, 234 Zero Page Indexing, 235 Absolute Indexed Addressing, 240 Indexed Indirect Addressing, 244 Indirect Indexed Addressing, 251 Summary, 255 Exercises, 257 Answers to Exercises, 258 Chapter 12 PUTTING IT ALL TOGETHER 259 BASIC BOS SM MA 8-Bit Multiplication, 259 Multiplication Directly From BASIC, 265 Multiplication Using the BASIC Operating System, 266 Multiplication Using the System Monitor, 268 Multiplication Using the Mini-Assembler, 269 8-Bit Division, 271 Summary, 276 Exercises, 277 Answers to Exercises, 279 Appendix A-1 BASIC STATEMENTS 280 A-2 MACHINE LANGUAGE INSTRUCTIONS 281 A-3 BUILT-IN SUBROUTINES 282 v

A black-and-white table of contents page with chapter headings, italic and boxed mode tags such as SM, MA, BASIC and BOS in the left margin, and a small page number v at the bottom.

Reading notes: Boxed tags SM, MA, BASIC and BOS are small and their exact boxing is approximate; the leading 'Chapter' labels are set in a left margin column. Reading order follows the left-to-right chapter layout row by row.

Languages
English
PDF page 7

A-4 DISPLAY SYMBOLS 282 A-5 PROGRAMS 283 Appendix B HEX EQUIVALENTS FOR DECIMAL NEGATIVES 284 Appendix C-1 VIDEO MEMORY 285 C-2 ASCII SCREEN CODES 287 C-3 COLOR CODES FOR LOW RESOLUTION GRAPHICS 288 Appendix D 6502 INSTRUCTION CODES 289 INDEX 294 vi

A printed table of contents page with black sans-serif text listing appendix entries, page numbers, and a lowercase Roman numeral 'vi' centered at the bottom on a plain white background.

Reading notes: Table of contents layout uses two columns of labels and titles with page numbers aligned to the right of each entry; reading order follows top to bottom.

Languages
English
PDF page 8

Preface The purpose of this book is to introduce Apple computer users, who have a knowledge of BASIC language, to machine language programming. The transition from BASIC is made in small, easy steps. Color, graphics, and sound are used early in the book to make the demonstration programs interesting and action-packed. Each new instruction is explained, and the demonstration programs are discussed step-by-step in functional sections. The reader first uses the BASIC statements POKE, PEEK, and CALL to enter and execute machine language programs from within a BASIC language program. A BASIC Operating System is then developed from which machine language programs can be entered and executed. The introduction from BASIC, a language the reader already knows, provides a natural approach that leads to the use of the Apple System Monitor. The System Monitor allows the reader to enter, examine, and execute machine language programs directly. The time used by the computer to interpret BASIC statements is thus eliminated. The final step in the transition is to the Apple's Mini-Assembler, which relieves the programmer of many of the tedious details involved with direct machine language programming. Approaching machine language through BASIC provides a means for the reader to use his or her previous knowledge as a stepping stone to explore a new area. You will proceed through this book in four definite stages. Machine language programs are entered and executed by four distinct methods. One method is introduced at each stage of the book. 1. [BASIC] Introduced in Chap. 1. Machine language programs are under full control of BASIC, using the instructions POKE, CALL, and PEEK. 2. [BOS] Introduced in Chap. 2. Machine language programs are controlled by a BASIC Operating System. vii

A typeset book page with a large bold sans-serif heading 'Preface' under a horizontal rule, followed by justified body paragraphs and a numbered list with boxed labels BASIC and BOS, ending with a centered page number vii.

Reading notes: Boxed labels BASIC and BOS are rendered as outlined boxes; bracket notation used in transcript is representational. Page number vii is printed centered at the bottom.

Languages
English
PDF page 9

3. [SM] Introduced in Chap. 8. Machine language programs are hand-assembled and entered directly from the Apple System Monitor. 4. [MA] Introduced in Chap. 11. Machine language programs are assembled by the Apple Mini-Assembler. The [BASIC], [BOS], [SM], and [MA] logos appear in the table of contents and in the appropriate chapter headings where they are used. viii

A plain white text page with numbered entries, boxed logo labels (SM, MA, BASIC, BOS), and a small italic page number 'viii' at the bottom center.

Reading notes: Boxed logo labels are rendered as outlined text and transcribed in brackets; exact box shapes are not preserved. Hyphenated line breaks 'Sys-tem' appear in the source and were joined as 'System' in the transcript only in the reading; the printed hyphen is kept in the transcript as Sys-tem.

Printed product names
Apple System Monitor · Apple Mini-Assembler
Languages
English
PDF page 10

Chapter 1 Review of Applesoft II Basic BASIC Several assumptions are made in writing this book. The authors felt this to be necessary because of the numerous versions of Apple computers presently in use. 1. You have made the necessary hardware connections. If not, see the reference manuals provided with your Apple computer. 2. The authors have used a version of the Apple that has: a. Applesoft II BASIC on a plug-in ROM printed circuit card. b. A switch on the card to select either Applesoft II or Integer BASIC. 3. You will read and use the Apple manuals pertinent to your particular machine. 4. You know how to switch back and forth between the programming languages available to you. The Apple computer can speak several languages. The prompt character indicates which language your Apple is currently ready to understand. The asterisk (*) indicates that you are in the machine language mode. This language is always in the computer and does not have to be "loaded" (entered from an external source) from a cassette or diskette. The machine language monitor that controls the use of this language is discussed in the latter part of this book (from Chap. 8 on). Asterisk prompt When using Machine Language Cursor If your Applesoft is on the plug-in ROM pc card, your Apple also contains a high-level English-oriented language called Integer BASIC* stored permanently *BASIC was developed at Dartmouth College by John Kemeny and Thomas Kurtz as an all-purpose computer language suitable for beginning programmers with diverse educational backgrounds. 1

A printed book page with a chapter heading at top right, a large bold section title, a boxed BASIC label, numbered body text, a small diagram of an asterisk prompt and cursor, and a footnote with page number 1 at the bottom.

Reading notes: The final body sentence is cut off at the bottom of the page and continues beyond the visible area. Diagram labels were placed in reading order after the body text; their spatial relation is approximate. The footnote marker and page number are small and may be slightly imprecise.

Languages
English
PDF page 11

in its ROM memory. ROM, which is an abbreviation for Read Only Memory, can be "read" (used by your programs), but cannot be "written into" (changed by you). The prompt character for Integer BASIC is a right facing arrow (>). Integer BASIC is not discussed in this book. For more information, see the Apple II BASIC Programming Manual (Apple product #A2L005X). Applesoft II is Apple's extended BASIC language. The prompt character of Applesoft II is a right square bracket (]). This extended BASIC is now available in three forms: 1. The Apple II Plus System with the Autostart Monitor ROM 2. The Applesoft plug-in interface card 3. The Apple Language System The Apple II Plus System has Applesoft II BASIC in ROM. Therefore, the Apple Mini-Assembler, the Floating Point Package, and the SWEET-16 interpreter (which are stored in the Integer BASIC ROMs) are not available on the Apple II Plus system. Since we will be using the Mini-Assembler later in the book, we will focus on the system containing the Applesoft II ROM card rather than the Apple II Plus system. Right bracket prompt APPLESOFT II Cursor This book is designed to provide a bridge over which the reader may cross from programming in BASIC to programming in the computer's native machine language. While the book assumes a background knowledge of Applesoft II BASIC, a brief review of BASIC statements used by the Apple computer is presented in this chapter. If you feel confident of your knowledge of Applesoft II BASIC, feel free to move on to Chap. 2. However, if your BASIC is rusty, spend some time reviewing the material here. Although this material is not a complete discussion of Applesoft capabilities, all those statements and commands necessary for understanding the remaining chapters of the book are given. An Apple computer with 16K of RAM, a tape recorder or disk drive, and Applesoft II BASIC are all that are necessary to perform the demonstrations and exercises presented. COMMANDS Certain fundamental commands are necessary in preparing, debugging, and executing a program. Those discussed here are NEW, LIST, RUN, TEXT, GRaphics, LOAD, SAVE, CONTinue, TRACE, and NOTRACE. 2

A printed book page of body text with a numbered list, a small diagram labeled Right bracket prompt, APPLESOFT II, and Cursor showing a bracket and cursor, followed by a COMMANDS heading and page number 2.

Reading notes: Diagram labels and reading order around the illustration may be approximate. Some small characters such as the 'Apple product #A2L005X' code and the ']' and '>' prompt symbols should be verified against the original.

Printed product names
Apple II Plus System · Applesoft II · Apple Mini-Assembler · Floating Point Package · SWEET-16 · Apple Language System · Applesoft plug-in interface card
Languages
English