				STRING ASIS
				BLANKS OFF
				


*****************************************************************
*
*                     The Print Manager 
*                 ImageWriter Driver  v2.2
*
* Coding Started Summer 1986 by Luc Barthelet and VersionSoft
*
* Version 1.0    April 22, 1987       Suki Lee
*-------------------------------------------------------------------------------
*
* Version 1.1    May 7, 1987          Suki Lee
*
*    fPgDirty flag in status is updated correctly and is used to
*    check if a form feed should be used when user aborts.
*-------------------------------------------------------------------------------
*
* Version 1.2    June 3, 1987         Suki Lee
*
*    Fixed bug in 50% Better Text mode and 50% Landscape.
*    New features added: Condensed
*                        PrPixelMap - prints pixel maps
*                        mixed modes and color palettes on same
*                           page (Not tested)
*-------------------------------------------------------------------------------
*
* Version 1.3    July 13, 1987        Suki Lee
*
*    New style dialog - vertical sizing is now a separate section
*    with radial buttons rather than a check box under printer
*    effects.
*    Fixed line spacing bug in draft text in condensed mode.
*
*-------------------------------------------------------------------------------
* Version 2.0    November 1987        Dan Hitchens
*
*   Major revision of code.
*     -Source code was gone through and commented.
*     -Low level routines were modified, restructured or even eliminated.
*     -Elimination of access to low level routines by user
*     -Speed enhancements were incorporated (Primarily in LLD.POINT)
*     -rPage (vRes) now reflects vertical condensed printing
*     -Bugs were fixed:
*              -320 mode landscape with vertical condensed was fixed.
*              -Landscape (with vertical condensed) was always imaging off the
*               page (image was too high causing it to be chopped at the top)
*              -The Job dialogs FROM and TO line edit items were not always
*               displaying or setting the insertion point correctly.
*
* Version 2.0d5	 February 10, 1988	   Harry Yee & Steve Glass
*	The procedure PrintCheck and its corresponding routines have been commented out
*	because none of this code was really being used and it caused problems while
*	printing to a spooler.
*
* Version 2.0d6	 March 1, 1988         Suki Lee & Steve Glass
*   Bug fix: Move the code to initialize the port and to reset the printer from 
*   LLDText to LLDStartUp. Deleted the same code from InitPrinting (called at the
*   beginning of LLDBitMap). Now the port is initialized only once at startup time 
*   and not each time LLDText and LLDBitMap is called.
*   Commented out CheckPrinter routine since it is not being called by anyone.
*   Also commented out InitSSC and replaced calls to it with calls to ResetPrinter
*   since the two functions similarly.
*   The escapes codes for resetting the printer has been modified to used the 
*   default character, Elite, rather than Pica since the printer is optimized to 
*   print in Elite.
*
* Version 2.0d7   March 25, 1988		Suki Lee
*   Bug fix: added filtering of c cedilla in LLDText so the character will be
*   printed in draft mode.
*-------------------------------------------------------------------------------
*
* Version 2.1d2   May 5, 1988        Suki Lee
*   Bug fix: 
*   - Added code to check status of AppleTalk connected printer. Puts up
*     appropriate message to warn user of condition.
*   - LQ no longer ejects an extra page for each page printed.

* Version 2.1d3   May 9, 1988        Suki Lee
*   Bug fix: 
*   - Added code to ask the printer for an ID which indicates if a color ribbon
*     is installed. If printing to an ImageWriter I or if no color ribbon is 
*     installed, the color selection on the job dialog is overridden. The routine
*  	  CheckPrinter which was removed in 2.0d6 has been modified and added back.
*
* Version 2.1d4	  June 8, 1988		 Suki Lee
*   Bug fix:
*	- Added error checking for opening connection to device.
*
* Version 2.1d5	  June 24, 1988		 Suki Lee
*   Bug fix:
*   - Took out branch for background printing in LLDStartup which doesn't clean 
*     up the stack properly.
*-------------------------------------------------------------------------------
*
* Version 2.2d1	  July 25, 1988		 Suki Lee
*   Bug fix:
*   - Added a flag to indicate when not to display status message, as in the case 
*     of PrPixelMap where the dialog box is not put up.
*
* Version 2.2d2	  July 26, 1988		 Suki Lee
*   Bug fix:
*	- When printing in Better Text mode, some color text were not printed when
*     color is not selected, no color ribbon is installed in an ImageWriter II,
*     or printing to an ImageWriter I. Fixed the logic in MakePattern, which 
*     calculates the dot pattern for color mapping, so the correct branch is taken
*     for 640 mode high resolution. Also changed the names of some of the branch
*     labels for clarity.
*
* Version 2.2d3   August 5, 1988     Suki Lee
*   Bug fix:
*   - AppleTalk will not return from a synchronous write if something happened to 
*     the device while the write is in progress. This poses a problem for error 
*     conditions such as out of paper for an AppleTalk connected ImageWriter. As 
*     per Greg Seitz, recovery is possible if asynchronous writes are used. This 
*     change is made in the subroutine PrDevWrite. Also rewrote the loop logic in 
*     this routine because it was wasteful.
*   - Use GetCursorAd before the WaitCursor call and use SetCursor instead of
*     InitCursor when done to restore the original cursor.
*
* Version 2.2 (Claris) October 15, 1988	Scott Lindsey (MSL)
*	Bug fix:
*	- Added code to calculate correct printer resolution for Landscape mode.
*	Hacks: (work-arounds that are really incorrect code.)
*	- PrOpenDoc no longer calls PrValidate; this so the user can poke values
*	  (such as a different page size) into the print record.
*	- So that the above is of any use, PrPrintIt looks at the first rpage
*	  instead of PrInfoPt when calculating # of bands to print per page.
*
* Version 2.2.1 (Claris) December 12, 1988	Scott Lindsey (MSL)
*	Speed Optimization:
*	- PrPicFile: Instead of always using a 10K buffer for printing the band into,
*	  as large a buffer as possible up to 64K is used.  This significantly increases
*	  the speed of printing bitmaps at the cost of some memory.
*	  This also required some code be moved from CiXMetrics to a seperate routine
*	  that can be called just after allocating the memory.
*	Safety Check:
*	- PrPicFile: Before printing, a 64K buffer is allocated then freed to see if
*	  there is enough memory for Quickdraw to (potentially) use.
*	User friendliness:
*	- An error message routine for printing 'not enough memory' type messages into
*	  the status box.  A delay loop allows the user to read the message before it
*	  continues on to whatever nastiness will follow.
*	Feature:
*	- There is now a Darker checkbox that allows the user to specify
*	  double overstrike in non-draft mode printing.
*	  This has been accomodated in the print record, etc.
*
*****************************************************************

*****************************************************************
*
*                    Copyright 1986-1988
*                    Apple Computer, Inc.
*                    All Rights Reserved
*
*****************************************************************


*               Absaddr on
*               Keep   IW
;               MCOPY  iw.macros
			 
			Print off
			if (&FINDSYM(&SYSGLOBAL,'DUMPIT')) THEN
				include 'm16.stack'
				include 'm16.cmp'
				include 'all.macros'
				include 'iw.macros'		
				DUMP 'iw.sym'
				GOTO .quit
			else
				LOAD 'iw.sym'
			endif
			Print on

;------------------------------------------------------------
;
; Global Equates
;

US             EQU    0
FR             EQU    1
Pays           EQU    US

VersionNb      EQU $0202                ; Version 2.2
 
;------------------------------------------------------------
;
; error codes
;
 
PortNotOn      EQU $1302
NoPrintRecord  EQU $1303
PntrConFailed  EQU $1308
 
True           EQU $FFFF
False          EQU $0000 




				ENTRY	PrintDefault		;_PrDefault
				ENTRY	PrValidate
				ENTRY	PrStlDialog
				ENTRY	PrJobDialog
				ENTRY	PrDrvrVer
				ENTRY	PrOpenDoc
				ENTRY	PrCloseDoc
				ENTRY	PrOpenPage
				ENTRY	PrClosePage
				ENTRY	PrPicFile
				ENTRY	PrError				;;;;;dummy for now;;;;;;
				ENTRY	PrError
				ENTRY	PrSetError
				ENTRY	PrChanged
				ENTRY	PrPixelMap
				ENTRY	PrPixelMap			;;;;;dummy for now;;;;;;;



	ENTRY LLDBitMap
	ENTRY LLDSetPenPos
	ENTRY LLDText
	ENTRY LLDBitMap
	ENTRY LLDSetPenPos
	ENTRY LLDText
	ENTRY LLDShutDown
	ENTRY LLDSetQuality
	ENTRY LLDSetColor
	ENTRY LLDStartup
	ENTRY LLDSetPageRect
	ENTRY LLDSetMode

	ENTRY Print_Test
;	ENTRY ButtonState
	ENTRY OpenInfoPrepare
	ENTRY OurGetHandle
	ENTRY StartLLD
	ENTRY CloseInfo
	ENTRY NewPage
;	ENTRY DeadLoc
;	ENTRY StyleRect
;	ENTRY StyleWidth
;	ENTRY JobDTemplate
;	ENTRY JDRBO
;	ENTRY JDRB10
;	ENTRY L1
;	ENTRY L2
;	ENTRY NamePos
;	ENTRY SlashStr
;	ENTRY J1StrNum
;	ENTRY J1StrList
	ENTRY JobFilter
;	ENTRY CopieFinalValue
;	ENTRY FromFinalValue
;	ENTRY ToFinalValue
;	ENTRY IfCancelled
;	ENTRY EventRecord
;	ENTRY EvtWhat
;	ENTRY EvtMsg
;	ENTRY LandSC_P
;	ENTRY Portrait_P
;	ENTRY Pixel640
;	ENTRY Pixel320
;	ENTRY Portrait_R
;	ENTRY LandSC_R
;	ENTRY DstBitR1
;	ENTRY DstBitF1
;	ENTRY DstBitR2
;	ENTRY DstBitF2
	ENTRY StyleDialog
	ENTRY JobDialog
;	ENTRY JDRBO
;	ENTRY JISTRNum
;	ENTRY JIPosList
;	ENTRY JIStrList
;	ENTRY PixelWidth
;	ENTRY Istrnum
;	ENTRY Iposlist
;	ENTRY Istrlist
;	ENTRY OKrect
;	ENTRY OKStr
;	ENTRY CancelRect
;	ENTRY CancelStr
;	ENTRY ARectList
;	ENTRY AStrList
;	ENTRY JDRB0
;	ENTRY AStrNum
;	ENTRY PP_Portrait
;	ENTRY PP_Landsc
;	ENTRY PtrList
	ENTRY StyleFilter
;	ENTRY EvtWhere
;	ENTRY InfoWidth640
;	ENTRY InfoWidth320
;	ENTRY InforRect
;	ENTRY InfoWindow
;	ENTRY InfoPort
;	ENTRY InfoStrPos
;	ENTRY InfoStrPrep
;	ENTRY InfoStrDraft
;	ENTRY InfoDPort
;	ENTRY PrintProcess
;	ENTRY EraseInfoRect
;	ENTRY InfoStrBuffer
	ENTRY PrPrintIt
	ENTRY PrAbortCheck
	ENTRY CallIdleProc
	ENTRY InsertPaperAlert
;	ENTRY EvtMods
;	ENTRY AlertTemp640
;	ENTRY AlertTemp320
;	ENTRY InfoRect
	ENTRY NoShowMessage
	ENTRY GetStatus
	ENTRY PStatus
	ENTRY ShowErr

	ENTRY ProcsTable
	ENTRY DraftFlag
	ENTRY iPrErr
	
    IMPORT INFORECT
    IMPORT ALERTTEMP320
    IMPORT ALERTTEMP640
    IMPORT EVTMODS
    IMPORT INFOSTRBUFFER
    IMPORT ERASEINFORECT
    IMPORT PRINTPROCESS
	IMPORT CancelStrPrint
	IMPORT CancelStrPos
	IMPORT LOWMEMMSG
    IMPORT INFODPORT
    IMPORT INFOSTRDRAFT
    IMPORT INFOSTRPREP
    IMPORT INFOSTRPOS
    IMPORT INFOPORT
    IMPORT INFOWINDOW
    IMPORT INFORRECT
    IMPORT INFOWIDTH320
    IMPORT INFOWIDTH640
    IMPORT EVTWHERE
    IMPORT PTRLIST
    IMPORT PP_LANDSC
    IMPORT PP_PORTRAIT
    IMPORT ASTRNUM
    IMPORT JDRB0
    IMPORT ASTRLIST
    IMPORT ARECTLIST
    IMPORT CANCELSTR
    IMPORT CANCELRECT
    IMPORT OKSTR
    IMPORT OKRECT
    IMPORT ISTRLIST
    IMPORT IPOSLIST
    IMPORT ISTRNUM
    IMPORT PIXELWIDTH
    IMPORT JISTRLIST
    IMPORT JIPOSLIST
    IMPORT JISTRNUM
    IMPORT DSTBITF2
    IMPORT DSTBITR2
    IMPORT DSTBITF1
    IMPORT DSTBITR1
    IMPORT LANDSC_R
    IMPORT PORTRAIT_R
    IMPORT PIXEL320
    IMPORT PIXEL640
    IMPORT PORTRAIT_P
    IMPORT LANDSC_P
    IMPORT EVTMSG
    IMPORT EVTWHAT
    IMPORT EVENTRECORD
    IMPORT IFCANCELLED
    IMPORT TOFINALVALUE
    IMPORT FROMFINALVALUE
    IMPORT COPIEFINALVALUE
    IMPORT J1STRLIST
    IMPORT J1STRNUM
    IMPORT SLASHSTR
    IMPORT NAMEPOS
    IMPORT L2
    IMPORT L1
    IMPORT JDRB10
	IMPORT JDRB11
    IMPORT JDRBO
    IMPORT JOBDTEMPLATE
    IMPORT STYLEWIDTH
    IMPORT STYLERECT
    IMPORT DEADLOC
    IMPORT BUTTONSTATE
	IMPORT JIPosList
	IMPORT CoverOpenStr
	IMPORT OffLineStr
	IMPORT PaperJamStr
	IMPORT PaperOutStr
	IMPORT MyStdText



IWD            PROC
 
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
;
;
; Vector to appropriate printer driver routine based on value passed in X-Reg.
;
;
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
               jmp (PrProcList,x)           ;Vector to correct routine


PrProcList		DC.L	PrintDefault		;_PrDefault
				DC.L	PrValidate
				DC.L	PrStlDialog
				DC.L	PrJobDialog
				DC.L	PrDrvrVer
				DC.L	PrOpenDoc
				DC.L	PrCloseDoc
				DC.L	PrOpenPage
				DC.L	PrClosePage
				DC.L	PrPicFile
				DC.L	PrError				;;;;;dummy for now;;;;;;
				DC.L	PrError
				DC.L	PrSetError
				DC.L	PrChanged
				DC.L	PrPixelMap
				DC.L	PrPixelMap			;;;;;dummy for now;;;;;;;

InvalidPr		rtl


				ENDP

				include 'e16.dialog'

				include 'LLD.ASM'
				include 'HLD.ASM'
				
.quit			
				
				END



