nakada@husc4.HARVARD.EDU (Paul Nakada) (01/25/89)
Comments: Originally-From: delaneyg@wnre.aecl.cdn
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#0: About Apple II Sample Code Notes September 1988
_____________________________________________________________________________
Sample Code Note #0 (this document) accompanies each release of Apple II
Sample Code. This release includes Sample Code 1-13. If there are any
subjects which you would like to see treated in Sample Code (or if you have
any questions about existing Sample Code), please contact us at one of the
following addresses:
Apple II Sample Code
Developer Technical Support
Apple Computer, Inc.
20525 Mariani Avenue, M/S 51-T
Cupertino, CA 95014
AppleLink: AIIDTS
MCI Mail: AIIDTS (264-0103)
We want Sample Code to be distributed as widely as possible, so it is sent to
all certified developers at no charge. You can also order it through APDA. As
an APDA customer, you have access to the tools and documentation necessary to
develop Apple-compatible products. For more information about APDA, contact:
APDA
Apple Computer, Inc.
20525 Mariani Avenue, M/S 33-G
Cupertino, CA 95014
(800) 282-APDA or (800) 282-2732
Fax: (408) 562-3971
Telex: 171-576
AppleLink: APDA
You can also get Apple II Sample Code on AppleLink in the Developer Services
Bulletin Board, as well as on other electronic services and from users groups.
We place no restrictions on copying Sample Code, with the exception that you
cannot resell it.
We have put these programs through extensive review by Developer Technical
Support and Apple Engineering, so we feel the quality of the code is very
high. Of course, we are human, so it is likely there are still some bugs that
we have overlooked. We would appreciate hearing from you about Sample Code,
especially about any bugs you might find. If you are the first to report a
particular bug, you will be the lucky recipient of a Genuine Developer
Technical Support Kudos.
Following is a complete list of all released Apple II Sample Code.
_____________________________________________________________________________
Released Apple II Sample Code Notes September 1988
New ***
Revised *R*
Number Machine Title Languages Date
_____________________________________________________________________________
*** 1 IIGS Shell 65816 9/88
*** 2 IIGS C.Shell C 9/88
*** 3 IIGS AnimDemo 65816 9/88
*** 4 IIGS Custom.Control 65816 9/88
*** 5 IIGS Custom.Window 65816 9/88
*** 6 IIGS DLog 65816 9/88
*** 7 IIGS Jiffy.Windows 65816 9/88
*** 8 IIGS List.Line.Edit 65816 9/88
*** 9 IIGS Lister C 9/88
*** 10 IIGS PlaySound 65816 9/88
*** 11 IIGS Print.Spy 65816 9/88
*** 12 IIGS Menus 65816 9/88
*** 13 IIGS Math 65816 9/88
_____________________________________________________________________________
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#1: Shell
Version: 1.0 September 1988
APW Components: Shell.Aii 30 Aug 88
Shell.Macros 18 Aug 88
Shell 30 Aug 88
MPW Components: Shell.Aii 10 Aug 88
Makefile 08 Jul 88
Shell performs a minimal set of tasks fundamental to virtually any Apple IIGS
desktop application, including displaying an empty desktop with a menu bar and
basic recommended menu options and supporting About... and Quit menu items.
_____________________________________________________________________________
The 65816 assembly language source code in Shell.Aii demonstrates standard
data constructs, how to load and start tools in correct sequence, how to code
a main event loop, how to close in sequence, and how to quit an application.
Error handling is included, as well as support for desk accessories. (This is
currently the only example with proper support for desk accessories with
respect to enabling and disabling the Edit menu.)
Shell.Aii and Shell.Macros have been used as a foundation for several of the
other Sample Code applications. We hope the Shell source code proves useful
as a basis for your Apple IIGS software as well.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the Shell file
included with the APW-compatible source code files. To create a load file
under APW, issue the following command: ASML Shell.Aii Keep=Shell.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is Shell.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#2: C.Shell
Version: 1.0 September 1988
APW Components: Shell.C 18 Aug 88
Shell 30 Aug 88
MPW Components: Shell.C 01 Sep 88
Makefile 17 Jun 88
Like the Shell load file created from Shell.Aii, this C-produced version of
Shell performs a minimal set of tasks fundamental to virtually any Apple IIGS
desktop application, including displaying an empty desktop with a menu bar and
basic recommended menu options (with a few variations to distinguish it from
the assembly-language version), generating an About box, and supporting both
mouse-selected and keyboard-selected Quit functions.
_____________________________________________________________________________
The source code in Shell.C demonstrates standard desktop data constructs in C,
how to load and start tools in correct sequence, how to code a main event
loop, how to dispatch, and how to shutdown an application and tools in
sequence in C. Error handling is included, but the Edit menu is not enabled
for desk accessories in this version.
For learning purposes, Shell.C is, for the most part, a direct translation of
the 65816 assembly language Shell.Aii source code, so it is not optimized for
C. Shell.C can be used as a template for your Apple IIGS applications in C.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the Shell file
included with the APW-compatible source code files. To create a load file
from APW C files, issue the following command: CMPL Shell.C Keep=Shell.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and MPW IIGS C. The program
name needed by the MPW Build menu's Build option is C.Shell.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#3: AnimDemo
Version: 1.0 September 1988
APW Components: AnimDemo.Aii 18 Aug 88
AnimDemo.Macros 18 Aug 88
AnimDemo 18 Aug 88
MPW Components: AnimDemo.Aii 29 Jul 88
Makefile 28 Jun 88
AnimDemo shows three different Apple IIGS animation techniques. The source
code also demonstrates the only supported way to access screen memory
directly, bypassing QuickDraw II.
_____________________________________________________________________________
The appearance of horizontally and vertically moving marquee lights is
achieved by modifying color table entries using heartbeat (VBL) tasks.
Horizontal scrolling of the text in the marquee box is handled via heartbeat
tasks. Pixel block transfers create the effect of a bouncing color object.
These three animation techniques are meant to give you an idea of what can be
done to animate Apple IIGS graphics. Other techniques will be illustrated in
subsequent Sample Code releases. We would like to hear about your methods
too.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the AnimDemo
file included with the APW-compatible source code files. To create a load
file under APW, issue the following command: ASML AnimDemo.Aii Keep=AnimDemo.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is AnimDemo.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#4: Custom.Control
Version: 2.0 September 1988
APW Components: BoxCtrl.Src 18 Aug 88
BoxCtrl.Std.Src 18 Aug 88
DefProc.1.Src 18 Aug 88
DefProc.2.Src 18 Aug 88
BoxCtrl.Macros 30 Aug 88
BoxCtrl 30 Aug 88
MPW Components: BoxCtrl.Aii 01 Sep 88
BoxCtrl.DefProc.Aii 01 Sep 88
BoxCtrl.Stds.Aii 09 Jul 88
Makefile 08 Jun 88
This sample program addresses the art of creating and supporting custom
controls. BoxCtrl generates a rectangle with small marks at each midpoint and
corner. Clicking and dragging the mouse when the cursor is over a mark causes
the rectangle to shrink, grow, and move.
_____________________________________________________________________________
The 65816 assembly language source code shows how to define both a custom
control and a simple button control, and how to use the custom control to move
and resize the button control. The demo was written in response to a number
of developer requests for more information on how to support custom controls.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the BoxCtrl
file included with the APW-compatible source code files. To create a load
file under APW, issue the following command: ASML BoxCtrl.Src Keep=BoxCtrl.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is BoxCtrl.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#5: Custom.Window
Version: 1.0 September 1988
APW Components: CustWind.Src 18 Aug 88
CW.Inits.Src 18 Aug 88
DefProc.1.Src 18 Aug 88
DefProc.2.Src 18 Aug 88
New Macros 18 Aug 88
CustWind.Macros 18 Aug 88
CustWind 30 Aug 88
MPW Components: Custom.Window.Aii 01 Sep 88
Custom.Window.Inits.Aii 07 Jul 88
RoundRect.Window.Aii 18 Aug 88
Makefile 08 Jun 88
This assembly language sample program generates two custom roundRect windows
along with a standard window. To illustrate how to specify different window
attributes in source code, we designed the first window without a close box
and do not allow it to be dragged.
_____________________________________________________________________________
The sample program also demonstrates how to use NULL events to maintain a
clock in the menu bar. Three Window Manager calls new to the Apple IIGS
System Disk 3.2 are used in the demo as well: AlertWindow, StartFrameDrawing,
and EndFrameDrawing. Several TaskMaster features are implemented in the
definition procedures (DefProcs). Frame grow boxes and scroll bars are not
supported in this version of the Custom Window demo.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the CustWind
file included with the APW-compatible source code files. To create a load
file under APW, issue the following command: ASML CustWind.Src Keep=CustWind.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is Custom.Window.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#6: DLog
Version: 1.0 September 1988
APW Components: DLog1.Aii 30 Aug 88
DLog1.Macros 16 Aug 88
StandardLib.Aii 16 Aug 88
DLog1 30 Aug 88
MPW Components: DLog1.Aii 29 Jul 88
StandardLib.Aii 29 Jul 88
Makefile 29 Jul 88
DLog1 generates and updates two dialog boxes-one modal and the other modeless.
The modal dialog example contains fully supported buttons, radio buttons, a
check box, and a line edit box, while the modeless dialog example supports
line editing, buttons, and a close box.
_____________________________________________________________________________
The 65816 assembly language source code in DLog1.Aii and its library files can
be used to learn how to create and update both kinds of dialog boxes. The
dialog box source code also can be ported to other applications.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the DLog1 file
included with the APW-compatible source code files. To create a load file
under APW, issue the following command: ASML DLog1.Aii Keep=DLog1.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is DLog1.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#7: Jiffy.Windows
Version: 1.0 September 1988
APW Components: Jiffy.Src 30 Aug 88
Jiffy.Stds.Src 18 Aug 88
Jiffy.Macros 18 Aug 88
Jiffy 30 Aug 88
MPW Components: Jiffy.Windows.Aii 01 Sep 88
Jiffy.Stds.Aii 14 Jul 88
Makefile 08 Jun 88
This assembly language program presents a technique for updating windows
quickly, using window contents that have been drawn beforehand then cached in
off-screen bitmaps. Both the standard windows and the window content caching
method are used in this demo for performance comparison.
_____________________________________________________________________________
Jiffy.Src and Jiffy.Stds.Src are expanded from Shell.Aii. The InitApp and
CloseApp procedures in Jiffy.Src show how application-specific source code can
be added to the empty InitApp and CloseApp procedures provided in Shell.Aii.
The sample program also shows how to use AlertWindow, a new Window Manager
call supported on Apple IIGS System Disk 3.2 and later. A fast way to
shutdown the Window Manager is included as well.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the Jiffy file
included with the APW-compatible source code files. To create a load file
under APW, issue the following command: ASML Jiffy.Src Keep=Jiffy.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is Jiffy Windows.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#8: List.Line.Edit
Version: 1.0 September 1988
APW Components: Lists.Aii 18 Aug 88
Lists.Inits.Aii 18 Aug 88
Lists.Macros 18 Aug 88
Lists 18 Aug 88
MPW Components: Lists.Aii 01 Sep 88
Lists.Inits.Aii 08 Jul 88
Makefile 08 Jul 88
This sample program illustrates how to handle lists and line editing in an
Apple IIGS application. It shows how to call most List Manager and LineEdit
procedures in 65816 assembly language, as well as how to handle events
relating to both tool sets. It also performs several operations within dialog
boxes, such as placing controls in a window without using the Dialog Manager.
This is the only Sample Code which currently supports Edit menu items Cut,
Copy, Paste, and Clear.
_____________________________________________________________________________
The demo generates a window containing a user-definable list, a box for
creating a new list entry, and several buttons for manipulating the list: New
Entry, Remove, Replace, UnHilite, and Sort. LineEdit tools are used to create
and edit a new line for the list in response to keyboard and mouse events,
while List Manager tools are used to create and update the list in response to
clicking on a line or a button. Sorting is done in reverse order to
demonstrate a custom sort routine.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the Lists file
included with the APW-compatible source code files. To create a load file
under APW, issue the following command: ASML Lists.Aii Keep=Lists.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is Lists.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#9: Lister
Version: 1.0 September 1988
APW Components: Lister1.C 16 Aug 88
Lister2.C 16 Aug 88
Lister3.C 16 Aug 88
Lister.H 16 Aug 88
Lister 30 Aug 88
MPW Components: Lister.C 01 Sep 88
Makefile 08 Jun 88
Lister not only shows how to make Print Manager calls from a C application and
how to work around some Print Manager anomalies, it also can be used to print
your source code listings on an ImageWriter or a LaserWriter.
_____________________________________________________________________________
Lister supports up to four columns per page and allows you to specify borders
and fonts of any size and include special headings, but this version does not
clip to the column boundary. Lister also demonstrates how to work around a
known ChooseFont problem.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the Lister file
included with the APW-compatible source code files. To create a load file
from the APW C files, issue the following command: CMPL Lister1.C
Keep=Lister.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and MPW IIGS C. The program
name needed by the MPW Build menu's Build option is Lister.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#10: PlaySound
Version: 1.0 September 1988
APW Components: PlaySound.Aii 18 Aug 88
Plays.Init.Aii 18 Aug 88
Plays.Macros 18 Aug 88
PlaySound 18 Aug 88
Sample.Sound 30 Aug 88
MPW Components: PlaySound.Aii 11 Aug 88
PlaySound.Init.Aii 11 Aug 88
Makefile 12 Jul 88
This sample program demonstrates how to use the Apple IIGS freeform sound
playback capability. It can be used to test digitized sound files which have
been ported to the Apple IIGS .
_____________________________________________________________________________
The PlaySound window includes buttons for loading and playing digitized sound
files. The user can adjust the frequency and amplitude of the sample. The
files listed in response to clicking on the Load button are not limited to
sound files, because existing third-party Apple IIGS sound applications use
different file types for saving sound samples. Sample.Sound can be used to
experiment with PlaySound's features.
Additional Apple IIGS sound demos will be included in the next release of
Sample Code.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the PlaySound
file included with the APW-compatible source code files. To create a load
file under APW, issue the following command: ASML PlaySound.Aii
Keep=PlaySound.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is PlaySound.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#12: Menus
Version: 1.0 September 1988
APW Components: Menus.Aii 18 Aug 88
Menus.Inits.Aii 18 Aug 88
Menus.Macros 18 Aug 88
Menus 30 Aug 88
MPW Components: Menus.Aii 11 Aug 88
Menus.Inits.Aii 11 Aug 88
Makefile 14 Jul 88
Menus demonstrates the various actions that can be applied to menus and menu
items. Three application-specific menu options are provided: Actions, Test,
and Custom. Experiment with these menus, then examine the 65816 assembly
language source code to see how menu handling can be implemented.
_____________________________________________________________________________
The demo uses many Menu Manager calls to add, manipulate, and delete menus and
menu items. Its custom menu code can be incorporated into other applications.
The sample program also demonstrates how to generate 320-mode Super Hi-Res
graphics.
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the Menus file
included with the APW-compatible source code files. To create a load file
under APW, issue the following command: ASML Menus.Aii Keep=Menus.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is Menus.
Apple II
Sample Code Notes
_____________________________________________________________________________
Developer Technical Support
#13: Math
Version: 1.0 September 1988
APW Components: Math.Aii 30 Aug 88
Math.Init.Aii 18 Aug 88
Math.Root 30 Aug 88
Math.Macros 18 Aug 88
Math.A 30 Aug 88
Math 30 Aug 88
MPW Components: Math.Aii 29 Jul 88
Math.Init.Aii 14 Jul 88
Makefile 15 Jul 88
This sample program demonstrates how to use the Apple IIGS Integer Math and
SANE tools in a 65816 assembly language application.
_____________________________________________________________________________
Math produces graphical displays of four waveforms: a sine curve generated
from Integer Math Frac numbers, an integer Fast Fourier Transform, a sine
curve generated via SANE, and a SANE FFT. SANE operations favor numerical
accuracy over speed, so the two SANE waveforms take time to calculate. The
SANE FFT takes over a minute (no, the demo hasn't crashed).
Use APW 1.0 and Apple IIGS System Disk 3.2 or later to execute the Math file
included with the APW-compatible source code files. To create a load file
under APW, issue the following command: ASML Math.Aii Keep=Math.
MPW IIGS users need MPW 2.02, MPW IIGS Tools 1.0, and any version of the MPW
IIGS assembler. The program name needed by the MPW Build menu's Build option
is Math.
__
| Paul Nakada '89 #8-) |
North House | nakada@husc4.HARVARD.EDU
Harvard College | seismo>!harvard!husc4!nakada.UUCP
Cambridge, MA 02138 | rutgers/ nakada@husc4.BITNET
617/498-6255 || 6264 | __|