Date : Fri, 16 Dec 1988 22:16:53 GMT
From : uop!mrapple@ucdavis.ucdavis.edu (Nick Sayer)
Subject: A PCPI revolution
For the longest time, I have been unhappy with the way that
overlays and inserts for serial I/O under Apple CP/M were written.
No installation file seemed to be right without being hacked
to bits to make it fit. PCPI CP/M has such a nice drivers
facility, it seems a waste not to put it to full use. I
discovered the trouble with this idea is that the drivers don't
include proper calls for setting baud rate, sending breaks, and
checking carrier (among other things), so alas, we're back
to peeks and pokes again.
Well, since writing the patches to get MEX, BYE and IMP talking
to my IIgs modem ports (which require firmware calls, and really
don't allow direct hardware access), I decided to try writing a
driver with some extended commands to deal with those non-standard
requests, such as setting baud, PSW (parity, stop and wordlen),
checking carrier, sending break, lowering DTR momentarily, and
dialing.
For my idea to be of any use at all, it seems to me we ought to
set a standard about this sort of thing. If we all agree on how the
extra commands are to be called, we can wrap this whole thing up
quickly. The advantage is that overlays for MEX, BYE, IMP and other
such programs will have only one overlay for PCPI CP/M -- and it
won't take an inordinant amount of hacking to get it to work.
I therefore propose that such drivers be the same as ordinary character
drivers (to insure backwards compatability) except for some changes:
1. the character write routines should be transparant -- they should
not respond to "Ctrl-A" type commands.
2. Character drivers have "other" commands available that are usually
not implemented. Let's implement them like this:
COMMAND E5 - check driver. This command should return an 80H if
the driver conforms to this standard, except for the pickup and dial
calls (it is a serial port and can't by itself do such things) or
81H if it will pickup and dial also (as is the case for the Apple Cat
Micromodem, or other such devices).
COMMAND 10 - set baud rate. This command takes 1 byte paramater -
the baud rate to set as in the table below. Returns non-zero if the
baud rate requested is not available.
01 - 50 baud 08 - 1200 baud
02 - 75 baud 09 - 1800 baud
03 - 110 baud 10 - 2400 baud
04 - 134.5 baud 11 - 3600 baud
05 - 150 baud 12 - 4800 baud
06 - 300 baud 13 - 7200 baud
07 - 600 baud 14 - 9600 baud
15 - 19200 baud
COMMAND 11 - set PSW. This command takes 1 byte paramater - the
PSW settings. The hi nibble is the data format (stop and wordlen)
and the lo nibble is the parity setting.
hi nibble lo nibble
00 - 8 bits, 1 stop 00 - no parity
01 - 7 bits, 1 stop 01 - odd parity
02 - 6 bits, 1 stop 03 - even parity
03 - 5 bits, 1 stop 05 - mark parity
04 - 8 bits, 2 stop 07 - space parity
05 - 7 bits, 2 stop
06 - 6 bits, 2 stop
07 - 5 bits, 2 stop
These values were chosen because they conform nicely to the 6551
and the IIgs firmware request values (same with the baud values)
COMMAND 12 - check carrier. No paramaters. return non-zero if carrier
OK.
COMMAND 13 - send break. No paramaters. return 0 if completed ok
COMMAND 14 - hangup. No paramaters. Return 0 if completed ok. for
serial ports, lower DTR for 300 msec.
The following commands active only if command E5 returned 81
COMMAND 15 - pickup. one paramater. if non-zero, establish
answer mode. If 0, originate.
COMMAND 16 - dial. 1 byte paramater. ASCII character to dial.
I suggest that if the ascii character "T" is sent, switch to
tone if available, "P" for pulse. characters "0"-"9", "*" and "#"
represent legal digits. Other commands may be added (such as
a flash-hook command, or a pause, etc).
To dial a number, pickup in originate mode, dial, then wait for
the carrier to appear. If no carrier before timeout, hangup.
-----
I have such a driver available for the IIgs serial port, the
Super Serial card, as well as a MEX overlay for such a driver.
BYE is coming soon. If someone with an Applecat and PCPI and
someone else with a Micromodem and PCPI would write one too,
we could get this whole thing off the ground nicely. The driver
facility is just too convenient and useful for this sort of thing
to let it go unused.
Thanks for reading this whole thing. Both of you. :-}
Nick Sayer | Packet Radio: N6QQQ @ W6FGC-2 | Fido: 161/31
uucp: ...!sdcsvax!ucbvax!ucdavis!uop!mrapple
Disclaimer: "The BBC would like to appologize for that last announcement."
cat flames > /dev/null