MPW A5 Driver Runtime Library
MPW A5 Driver Runtime Library
Macintosh · PDF
| Filename | MPW_A5_Driver_Runtime_Library_19860612.pdf |
|---|---|
| Size | 0.68 MB |
| Subsection | developer / MPW |
| Downloads | 0 |
Contents
4.
'•
Macintosh Programmer's Workshop
AS Driver Runtime Library
Writing a Desk Accessory or Device Driver that Uses Global Data.
Steve Hartwell
June 12, 1986
Revised July 30, 1986
Notice:
This documents the ASDRVRRuntime.o library, which is not released with MPW 1.0.
For information about writing desk accessories or drivers which don't need global data,
use the DRVRRuntime.o library provided with the MPW 1.0 release, and see the MPW
manual section on " Writing a Desk Accessory or Other Driver Resource".
The A5DRVRRuntime.o library is available internally to Apple engineers; contact the
Development Systems Group for more information.
Overview.
Desk accessories and other drivers have traditionally been written in assembly language, partly
because of the peculiar format of the 'DRVR' resource needed for drivers. Setting up the DRVR
layout header, passing register-based procedure parameters, and coping with the nonstandard
exit conventions of the driver routines has made it fairly difficult to implement drivers in
higher-level languages like Pascal or C.
The library ASDRVRRuntime.o and the resource type 'DRVW' declared in MPWTypes.r
simplifies the task of writing a desk accessory or device driver in Pascal or C. Together they
compose the driver layout header and the five entry points which set up the open, prime, status,
control, and close functions of a driver.
The advantages of using A5DRVRRuntime.o are:
•
No assembler source is required.
•
The resource compiler is an integral step in the build process, permitting the
easy addition of a desk accessory menu or other owned resources.
•
The programmer's interface to the open, prime, status, control, and close
routines use Pascal calling conventions. Since the C compiler can easily be
directed to declare functions which use Pascal calling conventions, the driver
header can by used by both languages without additional glue. Each function
returns a result code which is passed back to the system.
•
Previously, desk accessories and drivers have been required to allocate their
own storage for global data. A5DRVRRuntime uses the new A5Lib routines
which allow access to initialized global data as the languages and assembler
support them.
•
Because access to global data is available, drivers may link with the language
libraries, including routines which reference global data (but see note below}.
A5DRVRRuntime Library
•
Internal Release Only
Page
2
Drivers have peculiar exit conventions, requiring immediate calls to exit via an
RTS instruction, but non-immediate calls to JMP to the IODone routine. The
ASDRVRRuntime glue handles the proper exit conventions.
Some programming restrictions still apply to non-application code resources such as drivers.
Most notably is the restriction against the use of one variety of global data -- global variables
which are initialized to procedure pointers. Unfortunately, the 1/0 portions of the language
libraries and the Integrated Environment functions use in…
Showing first 3,000 characters of 18,634 total. Open the full document →