mattd@Apple.COM (Matt Deatherage) (04/15/89)
I've been promising Michael Pender for about two weeks that I'd post this as
soon as I could find it, so here goes:
The BASIC Protocol is very simple; it requires that three entry points be found
at fixed locations for a card in slot s:
_______________________________________________________________________________
Address: Contains:
$Cs00 initialization routine entry point
$Cs05 input routine entry point
$Cs07 output routine entry point
_______________________________________________________________________________
[Note: All cards that have ROM on them that follow no other recognizable
protocol are assumed to follow the BASIC protocol.]
The Pascal 1.0 Protocol [Note: This is about as obsolete as you can get, but
some people might like to know just for fun] also has three entry points for firmware cards:
_______________________________________________________________________________
Address: Contains:
$C800 initialization routine entry point
$C84D read routine entry point
$C9AA write routine entry point
_______________________________________________________________________________
New peripheral cards can be "accepted" into the Pascal 1.0 [OBSOLETE!] system
by using these entry points, as well as having the values $38 at location
$Cs05 and $18 at $Cs07 (see Device ID discussion below).
Pascal 1.1 has a more flexible setup and supports more input/output functions
than BASIC or Pascal 1.0. It makes indirect calls to the firmware in a (new)
peripheral card through addresses in a branch table in the card's firmware.
It also has facilities for identifying new peripheral I/O devices.
The I/O routine entry point branch table is located near the beginning of the
$Cs00 address space, where s is the slot number where the peripheral card is
installed. This space was chosen instead of the $C800 space, since under
BASIC protocol the $Cs00 space is required, while the $C800 space is optional.
The branch table locations that Pascal 1.1 uses are:
_______________________________________________________________________________
Address: Contains:
$Cs0D initialization routine offset (required)
$Cs0E read routine offset (required)
$Cs0F write routine offset (required)
$Cs10 status routine offset (required)
$Cs11 $00 if optional offsets folow, non-zero if not
$Cs12 control routine offset (optional)
$Cs13 interrupt handling routine offset (optional)
_______________________________________________________________________________
Notice that $Cs11 contains $00 only if the control and interrupt handling
routines are supported by the firmware. Apple Pascal 1.0 and 1.1 do not
support control and interrupt requests, but such requests may be implemented
in future versions of the Pascal BIOS and other future Apple II operating
systems.
Here are the entry point addresses, and the contents of the 6502 registers
on entry to and exit from Pascal 1.1 I/O Routines:
_______________________________________________________________________________
Address: Offset for: X Reg. Y Reg. A Reg.
$Cs0D Initialiation
On entry $Cs $s0
On exit error code $s0 (unchanged)
$Cs0E Read
On entry $Cs $s0
On exit error code $s0 character read
$Cs0F Write
On entry $Cs $s0 character to write
On exit error code $s0 (unchanged)
$Cs10 Status
On entry $Cs $s0 request (0 or 1)
On exit error code (changed) (unchanged)
_______________________________________________________________________________
Notes: Request code 0 means "are you ready to accept output?" Request code
1 means "Do you have input ready?" On exit, the reply to the status request
is in the carry bit: carry clear means "no", carry set means "yes".
Pascal 1.1 uses four firwmare bytes to identify the peripheral card. Both
the identifying bytes and the branch table are near the beginning of the $Cs00
ROM space. The identifiers are:
_______________________________________________________________________________
Address: Value:
$Cs05 $38 (standard BASIC requirement)
$Cs07 $18 (standard BASIC requirement)
$Cs0B $01 (generic signature of firmware cards)
$Cs0C $ci (device signature, see below)
_______________________________________________________________________________
The first digit, c, of the device signature byte identifies the device class:
_______________________________________________________________________________
Digit: Class:
$0 reserved
$1 printer
$2 joystick or other X-Y input device
$3 serial or parallel I/O card
$4 modem
$5 sound or speech device
$6 clock
$7 mass storage device
$8 80-column card
$9 network or bus interface
$A special purpose (none of the above)
$B-$F reserved
_______________________________________________________________________________
The second digit, i, of the device signature byte is a unique identifier for
the card, assigned by Apple Developer Technical Support. For example, the
Apple IIe 80-column Text Card has a device signature of $88.
Although version 1.1 of Pascal ignores the device signature, applications
programs can use them to identify specific devices.
Comments:
The above is all taken from "Apple IIe Design Guidelines", circa 1982. The
protocol descriptions are correct, but DTS no longer registers "i" digits
for peripheral cards. I *strongly* advise anyone interested in this to
read and digest Apple II Miscellaneous Technical Note #8 before attempting
to use this information.
-----------------------------------------------------------------------------
Matt Deatherage, Apple Computer, Inc. | "The opinions expressed in this tome
Send PERSONAL mail ONLY (please) to: | should not be construed to imply that
AppleLink PE: Matt DTS GEnie: AIIDTS | Apple Computer, Inc., or any of its
CompuServe: 76703,3030 | subsidiaries, in whole or in part,
Usenet: mattd@apple.com | have any opinion on any subject."
UUCP: (other stuff)!ames!apple!mattd | "So there."
-----------------------------------------------------------------------------