# Apple Programmer’s Handbook — source transcripts, page 2

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-apple-programmers-handbook-1984-0bfd20/2)

## 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.

### PDF page 12

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-apple-programmers-handbook-1984-0bfd20/2#scan-aba79b9a8c2bb623b0d1d4ef6d651747cbac36dd2392ea141c10faaaeb7ff107)

Transcribed text:

/0   Appl~   Programmer,s Handbook
POWER
CONNECTOR
TOP   VIEW
PERIPHERALS
!   l!   l!!!
J2   J4   J5
3   4
FRONT   OF   PC   BOARD
JS   J8   J9
A7
D KEYBOARD
CONNECTOR
7   8   9   10
Jll   J12   J14
11   12   13   14
I
AUXILIARY
VIDEO   OUTPUT
CONNECTOR
GAME   1/0
CONNECTOR
r   SPEAIIER
~   CONNECTOR
B14A
fig.   1-1.   Connector   locations   on   Apple   II   motherboard (except for   Model   lie).
computer. Even then, hardware differences may give you differences
that some Apple programs won't know about. Like missing colors or
special terminal defaults. At the time of writing this book, several
motherboards offered in the underground market have poor quality
with circuit traces that are lifting from the board either during home
assembly or afterwards in the case of preassembled boards. Caveat
emptor!
Clones that are assembled and supplied in cases are the safest. You
can run them in the dealer's store and see if it handles the features you
need. And, by asking around at computer club meetings, you can find   ·
the dealers with happy customers. With full 64K of RAM, you can
purchase   DOS   3.3 from Apple and have both Applesoft and Integer
BASICS on disk to load in place of the normal Applesoft/Monitor
firmware.   Or   you can program custom systems if you are good at ma-
chine language and can make your own   PROMs   to plug in. Most
clones provide 2716 or 2732 sockets for this purpose. Be careful of
BASIC and Monitor   PROMs   on the black market; selling or buying
copyright   material is illegal without permission   from   the owners
(Apple   C0mputer   Inc., and Microsoft).
~
i

Reading notes: Damaged or OCR-garbled characters in the connector diagram caption and adjacent labels Reading order of diagram labels is uncertain

Printed product names: Apple II · Applesoft · DOS 3.3 · Microsoft

Languages: English

[Original PDF page 12](https://www.vintageapple.net/files/1373516fba53021d86f42f78a2586e99fc7ccb69e4d6fdd14a0bc88bac70e225/Apple_Programmers_Handbook_1984.pdf#page=12)

### PDF page 22

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-apple-programmers-handbook-1984-0bfd20/2#scan-e368f4aa1f26437e4507effaab33eb01cc37b26dbe4244fb9775dfcb840d5141)

Transcribed text:

20   Appl~   Programmer's Handbook
For programming, you use a type of editor called a   line editor.
The Apple Monitor has a line input that is the heart of the built-in
programming editors.   It   lets you enter a line of text before turni ng it
over to BASIC or to its own interpreter. You type in what you wish,
use the forward and backward arrows for corrections, and then press
RETURN   to enter the line. You can quit the line at any time with a
ctrl/X. As a minimum editor it works well but there are better ways to
program.
For instance, when you change previously entered Applesoft lines,
the extra spaces a t the right of the screen mess up any strings that are
within quotes. The old trick of typing   POKE   33,33 helps, but before
long a more sophisticated line editor is often needed.
One   solution is an extension to the built-in editor called   Program
Line Editor.   It   gives you cursor search and edit features one line at a
time, as well as a listing control for Standard Monitors without ctrl/ S.
You can add your own commands as well. See Appendix B.
The best solution is to get a text file editor like the ones that come
w ith an Assembler. This way you get an Assembler, with an editor as a
bonus, that you can use right away, and you don't have to know As-
sembler programming to make good use of the editor for   BASIC   pro-
gramming. Then when you get into Assembler, you have a familiar
editor to use.
Such   a text file line editor will give you the features you need. It wi ll
let you enter lines and will number them for you . You can search for
line numbers or for text strings; then the search lets you replace or list
what it finds.   Separate   instructions are included to run the Assembler.
In this book , all examples of Assembler routines are written for the
DOS Toolkit Assembler   from Apple.
To load a   BASIC   p rogram written as a TEXT fi le, you use the
EXEC command instead of the   LOAD   command. This reads your
text in just as if you were typing it at the time. To make corrections to
the disk copy, however, you will have to go back to your line editor
a nd make the correction to the TEXT file.
If you have a program already in a   BASIC   file, but wan t to convert
it to a TEXT file for editing, use the CAPTURE routine. Make one by
creating a one-liner with your text line editor:
0   PRINTCHR$(4)''0PENXXXX":PRINTCHR$(4)''WRITEXXXX":
LIST1,32767 :PRINTCHR$(4)"CLOSEXXXX":END
-
-
-
n

Reading notes: Possible OCR spacing errors such as 'turni ng', 'Appl~', and 'w ith' in the source text

Printed product names: Apple Monitor · Applesoft · Program Line Editor · DOS Toolkit Assembler

Languages: English

[Original PDF page 22](https://www.vintageapple.net/files/1373516fba53021d86f42f78a2586e99fc7ccb69e4d6fdd14a0bc88bac70e225/Apple_Programmers_Handbook_1984.pdf#page=22)

### PDF page 23

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-apple-programmers-handbook-1984-0bfd20/2#scan-3fed36e2daffc2df02abf9220d3631a7eee244bf557cb5aabe165afca89cd682)

Transcribed text:

Getting It Together   21
Save   it as   CAPTURE.
To use   CAPTURE,   search   and   replace   XXXX to your program's
text   file   name.   For   exampie,   your   program   in   BASIC   called
PHASORZAP   could have a text file name of   PHASORZAP.TEXT.
Save   this version of CAPTURE as, say,   CAPTURE.PHASORZAP.
Quit the editor and load the   BASIC   program,   PHASORZAP.   Then
EXEC   CAPTURE.PHASORZAP   to add the capture line to the pro-
gram in memory. Typing the   RUN   command will cause the text file
called   PHASORZAP.   TEXT to be created on disk. Notice that you
can't use Line Zero in any of your   BASIC   programs for any other pur-
pose or this trick will wipe it out.
In addition to editors, several other utilities are useful.   You   will
want them to help in program development and maintenance of your
files.
You   can use various   disk zaps.   FID is the most common one. The
COPY   program on the   System   Master disk will back up or copy entire
disks, not just files like FID. And   MUFFIN   will copy files from earlier
DOS   disks in thirteen-sector format to the   DOS   3.3 sixteen-sector for-
mat disks. For advanced use, a disk-zap utility for working with disk
sectors is given in Chapter   Seven.
Such   sector-type disk zaps are quite powerful. They have different
names; the one in Chapter   Seven   is just called   DISK   ZAP. They let
you read and write from the disk by   track   and   sector numbers   and
examine the bytes of data within each 256-byte sector.   You   can change
the bytes and replace the altered sector on disk.   You   use this utility to
recover crashed disks, find   hidden   files, see special characters on disk,
and learn how   DOS   works.   You   can create special disks and customize
DOS.   See   Chapter   Seven   for details.
If   you do a lot of Assembler programming, get a   debugger,   some-
times called DDT. This will give you step and trace capability, let you
set breakpoints, examine both registers and memory, and other de-
bugging routines.   It   may come with your Assembler, but there are
separately supplied debuggers available. They can make your program
debugging much easier.
COPY   programs are available besides the one on the   DOS   3.3
System Master disks.   Use   it or another   COPY   utility to keep your
daily work backed up. Copy program disks when you get them and
use the copy as the working disk; keep the original archived in case

Reading notes: Original text reads 'exampie' and 'PHASORZAP.   TEXT' with irregular spacing, possibly OCR artifacts Heading 'Getting It Together   21' is a running header with page number; no distinct primary headline

Printed product names: BASIC · PHASORZAP · CAPTURE · FID · COPY · MUFFIN · DOS 3.3 · DISK ZAP · DDT · System Master

Languages: English

[Original PDF page 23](https://www.vintageapple.net/files/1373516fba53021d86f42f78a2586e99fc7ccb69e4d6fdd14a0bc88bac70e225/Apple_Programmers_Handbook_1984.pdf#page=23)

### PDF page 24

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-apple-programmers-handbook-1984-0bfd20/2#scan-8f291ee3b5fff063f90f13a330135a9d12344718ef3993f0d09e7027a7c9bd00)

Transcribed text:

22   Apple®   Programmer's Handbook
you lose your working copy. A more powerful   COPY   routine may
work with an   uncopyable   disk supplied in a nonstandard disk format.
Many manufacturers use different schemes to protect their interests
against software piracy. Unfortunately, this makes it difficult for you
to have backups.
One   solution is not to buy   uncopyable   disks. They are fragile and
often expensive. Another answer might be to find the scheme used to
alter the   DOS   and write a special   COPY   routine. This takes time and
skill. A third solution is to write your own version of the program you
want. These programs are not always as complicated as they appear;
much time and effort in commercial packages goes into the   bells and
whistles   to make them look slick.
If   you simply must have the program to use and don't have the time
to develop an alternative, then buy it.   Often   you can obtain a replace-
ment disk during a warranty period by sending in the original.   Some
suppliers will replace out-of-warranty disks for a fee.
1.2 PROGRAMMING
1.2.1 BASICs
Applesoft has an extensive command set.   Of   these,   a   few are
learned very quickly, some are learned only by a few people, and some
aren't learned at all.   If   you have practiced with Applesoft or taken a
course, you are familiar with the common ones. Specialized com-
mands are simple to understand and use because of their specific
nature. For example, the   SPC(   function inserts spaces when used with
a PRINT statement. The few remaining difficult ones are rarely used,
but are quite useful.   See   Table 1-3.
One   pair of commands that you should play with is the TRACE and
NOTRACE. They are   BASIC   line number tracing features that let you
see where your program is going as it runs. You can use them easily
when debugging.
A little-used command is the WAIT instruction.   It   does bit testing
that lets you examine hardware locations and then waits until the
device being tested does something.   Such   a device may be the key-
board. For example, you WAIT for a keypress, or you could WAIT
for a pushbutton.   Some   uses for the WAIT instruction appear in this
book, but there are others.
The   ONERR   GOTO   ... statement is used, but not often enough.
All programs that access disks should use this error-trapping feature

Reading notes: Headline not clearly identifiable; page header reads 'Apple® Programmer's Handbook' and section header '1.2 PROGRAMMING' may be treated as primary heading

Printed product names: Apple® · Applesoft · DOS · BASIC · PRINT · TRACE · NOTRACE · WAIT · ONERR GOTO

Languages: English

[Original PDF page 24](https://www.vintageapple.net/files/1373516fba53021d86f42f78a2586e99fc7ccb69e4d6fdd14a0bc88bac70e225/Apple_Programmers_Handbook_1984.pdf#page=24)

[Previous transcribed scans](https://www.vintageapple.net/transcripts/media/va-apple-programmers-handbook-1984-0bfd20/1.md)
