[net.micro.mac] Printe available?

burger@unizh.UUCP (08/06/86)

PAP Printer Access Protocol available?
--------------------------------------
We are thinking about how to use LaserWriters attached to AppleTalk from hosts
interconnected by a Localnet20 network. Software to print documents on a
LaserWriter attached to Localnet20 via the serial line is running.
   In order to continue using this software as well as making available all the
LaserWriters to the Mac users we would like to concentrate all the LaserWriters
in the AppleTalk network. One Mac could serve as transparent gateway between the
two networks for printing purposes. On the one hand it would simulate a
LaserWriter in serial mode to the hosts on the Localnet20, on the other side it
has to establish a communication with a LaserWriter for printing service.

   The laserwriter, when attached to AppleTalk, communicates with the competing
users via the PAP protocol, which is specified in the 'Inside LaserWriter'
guide. But the vital code resources cannot be found!

???????????????????????????????????????????????????????????????????????????
??  Has anybody out there seen the PAP resource, or even worked with it  ??
???????????????????????????????????????????????????????????????????????????

   Hints of any kind will greatly be appreciated                    Cyrill

						 ...!mcvax!cernvax!unizh!burger

dolf@uva.uucp (Dolf Starreveld) (08/07/86)

In article <212@unizh.UUCP> burger@unizh.UUCP writes:
>PAP Printer Access Protocol available?
>--------------------------------------
>	.
>	.
>	.
>???????????????????????????????????????????????????????????????????????????
>??  Has anybody out there seen the PAP resource, or even worked with it  ??
>???????????????????????????????????????????????????????????????????????????


Well,  I  needed  this  code  to. It seems that the code you need can be
found  in  a  resource of type PDEF, ID=10 inside thfe LaserWriter file.
The  resource  starts  with several branch instructions to thfe code for
PapOpen,  PapRead,  PapWrite  etc..  If I remember correctly, the branch
instructions are 4 bytes apart, but it might also be 2 (I don't have the
stuff  at  hand at this moment, so I can't look it up). Use ResEd to see
what  it  actually  is.  To  call these routines, you need some assembly
glue, something like:

-----
OpenOffset	equ	0
ReadOffset	equ	1*BrSize	; BrSize is either 2 or 4 (see above)
WriteOffset	equ	2*BrSize
		...

;	Handle to PDEF 10 resource (must be locked) should be in _pdefh.
;
PapDispatch:
	move.l	_pdefh(A5),A0	; Get handle to pap code
	move.l	(A0),A0		; Ptr to code
	lea	0(A0,D0.W),A0	; Address of correct branch instruction
	jmp	(A0)		; Call the routine

_PapRead:
	move.w	#OpenOffset,D0
	bra.s	PapDispatch

_PapRead:
	move.w	#ReadOffset,D0
	bra.s	PapDispatch

	...


Set up your C declarations something like:

pascal void PapOpen();
-----

Off  course  something  similar  for  Pascal users. Let me tell you that
calling  the  routines  in this way did work for me, but I don't like it
when  an  application  which  is  bypassing the original LaserWriter (as
you're going to do and I was doing) still needs to LaserWriter file. Off
course  you can steal the PDEF resource from the LW file (use ResEd) and
put  it  in your own application. I also asked Apple what their official
way of using PAP code was. It has been three months and still no answer!
-- 
			Dolf Starreveld
			Department of Computer Science, UvA

Usenet:			dolf@uva.uucp
			{seismo,decvax,philabs}!mcvax!uva!dolf

Snail mail:		Dolf Starreveld
			Department of Computing Science
			University of Amsterdam
			Kruislaan 409
			NL-1098 SJ  Amsterdam
			The Netherlands

Telefone:		In Holland:    020-592 5137/5022
			International: 31-20-592 5137 or 31-20-592 5022

Telex:			10262 HEF NL