[comp.sys.amiga] Need help with printer driver

mark@unisec.UUCP (04/09/87)

Well, after fighting with Aegis Draw Plus yesterday, DMCS on several
occaisions, Deluxe Paint II, Notepad, you name it, I finally decided
that if I was going to cuss and moan every time I tried to get a
reasonable hardcopy, at least I'd be responsible.  To that end, I dug
out a copy of the Epson printer driver (a slightly modified version of
the one in the RKM) that I had snagged from Compuserve and started
preparations for building my own Epson LQ-800 printer driver.  I had
been waiting for Aztec C V3.4 which allows me to create printer drivers.
Really!  It says so, right in the book!  And that's all it says! GRRRR!

The first problem I encountered was with an undefined PrinterSegmentData
which is XREF'ed in printertag.asm, but has no other references.  So,
I commented out the XREF.  I compiled with the +A option to force
longword alignment.  My problems lie with the linking process.  I suspect
that there is a well-known (but not revealed to me) process for linking
device drivers that probably involves a flag or two and a magic library.
Right now, I'm getting some symbol overrides (library base pointers) and
an undefined _main().  I suspect that if I was doing things right, the
reference to main wouldn't be generated, right?  I'm currently linking
with c.lib.  Is there some other library (amiga.lib?) that I should use
or a different startup file that I'm supposed to include?

I've got the Amiga RKM's, AmigaDOS manual, AutoDocs, complete Manx 
documentation (hah!), and the SYBEX Amiga Programmer's Handbook.  Do I
need new glasses or is what I'm looking for not there?!?  I know I'm
certainly fallible and have missed things that were under my nose before.
If you can provide me with the info I need to get going on this, I'll
be most grateful.  Thanks.

Mark

-- 
| Mark R. Rinfret, SofTech, Inc.		mark@unisec.usi.com |
| Guest of UniSecure Systems, Inc., Newport, RI                     |
| UUCP:  {gatech|mirror|cbosgd|uiucdcs|ihnp4}!rayssd!unisec!mark    |
| work: (401)-849-4174	home: (401)-846-7639                        |

dillon@CORY.BERKELEY.EDU (Matt Dillon) (04/09/87)

	Just your luck!  I'm trying to write printer driver too (for my
Toshiba).  I've been able to get a little farther than you ... I can do
a graphics dump, but my Amiga freezes up when the dump finishes.

	
>The first problem I encountered was with an undefined PrinterSegmentData
>which is XREF'ed in printertag.asm, but has no other references.  So,

	Same here.

>longword alignment.  My problems lie with the linking process.  I suspect
>that there is a well-known (but not revealed to me) process for linking
>device drivers that probably involves a flag or two and a magic library.
>Right now, I'm getting some symbol overrides (library base pointers) and
>an undefined _main().  I suspect that if I was doing things right, the
>reference to main wouldn't be generated, right?  I'm currently linking
>with c.lib.  Is there some other library (amiga.lib?) that I should use
>or a different startup file that I'm supposed to include?

	I guess that means your using Aztec?  I am using Aztec. 
For Aztec (3.4 at least):

	-Compile with +BCD  (large model EVERYTHING), including your assembly
	 files.  The +B option tells the compiler not to generate a 
	 reference to the startup code.  Manx 3.4 has a 'super compatibility'
	 option for cc... +p , which might be good to stick in if you have 3.4.

	-When you link everything together, the TAGS.ASM file should go first.
	 In fact, you shouldn't even have to include CL.LIB (large model C.LIB)
	 unless you use support functions from that lib.

	-Don't use DOS unless you've specifically openned the DOS library

----------
BTW if anybody has any ideas on why my driver is dying after it completes 
a graphics dump... Or, even better, if somebody has got a driver for a
Toshiba P1340..

					-Matt

daveb@cbmvax.UUCP (04/09/87)

In article <457@unisec.USI.COM> mark@unisec.USI.COM (Mark Rinfret) writes:
$preparations for building my own Epson LQ-800 printer driver.  I had
$been waiting for Aztec C V3.4 which allows me to create printer drivers.
$Really!  It says so, right in the book!  And that's all it says! GRRRR!
$
$The first problem I encountered was with an undefined PrinterSegmentData
$which is XREF'ed in printertag.asm, but has no other references.  So,
$I commented out the XREF.  I compiled with the +A option to force
$longword alignment.  My problems lie with the linking process.  I suspect
$that there is a well-known (but not revealed to me) process for linking
$device drivers that probably involves a flag or two and a magic library.
$Right now, I'm getting some symbol overrides (library base pointers) and
$an undefined _main().  I suspect that if I was doing things right, the
$reference to main wouldn't be generated, right?  I'm currently linking
$with c.lib.  Is there some other library (amiga.lib?) that I should use
$or a different startup file that I'm supposed to include?
$

	I have successfully written a printer driver under Manx.

1. The XREF can be commented out.

2. You have use the compiler +B option to tell the system that you don't
   want a 'public .begin' generated.  This will get rid of your _main
   problem.

3. Unless you REALLY know what you doing (and up against) I HEAVILY
   recommend that you use the large code/data option.  If you don't
   be warned that you'll have to write little stub interface routines
   for those routines that get called by the system (ie. Render, DoSpecial,
   Open, Close, and Expunge).  This is necessary as the small module uses
   A4 for data references.  ie. You'll have to save A4, init A4, call the
   specific routine, restore A4.  You'll ALSO have to save/restore A6
   before/after calling the specific routine.  By now you've probably guessed
   that my printer driver was written using the small code/data option.

4. The first object file should be printertag.o.

	Good luck!  (At least now you know it CAN be done).

daveb@cbmvax.UUCP (04/10/87)

In article <8704092013.AA20195@cory.Berkeley.EDU> dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
>
>>3. Unless you REALLY know what you doing (and up against) I HEAVILY
>>   recommend that you use the large code/data option.  If you don't
>
>	I'm also using 32-bit ints.  Is this correct?
>
>					-Matt


	The printer driver that I wrote used 16-bit ints (I just had to
cast every thing).  There should be no problem (in fact it should be easier)
with 32-bit ints.

mark@unisec.UUCP (04/10/87)

In article <8704090805.AA09163@cory.Berkeley.EDU>, dillon@CORY.BERKELEY.EDU (Matt Dillon) writes:
> 
> 	Just your luck!  I'm trying to write printer driver too (for my...
> 
> 	I guess that means your using Aztec?  I am using Aztec. 
> For Aztec (3.4 at least):
> 
> 	-Compile with +BCD  (large model EVERYTHING), including your assembly
                    ^^
Thanks!  I forgot all about the A4 problem!  I had rediscovered +B
yesterday, but that obviously was not enough to keep the Guru away.  I'm
also compiling with the +L option.  This code is (was) a 99.9% carbon
copy of the stuff in the RKM V2.  I assume that even though there are
UBYTE and UWORD declarations scattered throughout, everything (parameters)
wants to be 32 bits, right?

> 	 files.  The +B option tells the compiler not to generate a 
> 	 reference to the startup code.  Manx 3.4 has a 'super compatibility'
> 	 option for cc... +p , which might be good to stick in if you have 3.4.
                                                           ^^^^^^^^^^^^^^^^
I do, and I might try that if all else fails.
> 
> 	-When you link everything together, the TAGS.ASM file should go first.
Yeah...I picked that up right away from the manuals.

> 	 In fact, you shouldn't even have to include CL.LIB (large model C.LIB)
> 	 unless you use support functions from that lib.
The driver uses AllocMem for the double boofers and it does call OpenLibrary.

> 	-Don't use DOS unless you've specifically openned the DOS library
This one still bugs me a little.  There are some XDEF's for _SysBase, 
_Open, _Close (no-ops), etc., that over-ride equivalents in the Aztec
library.  I am assuming that this is ok, as long as the linker REALLY IS
over-riding all references.  
> 
> 					-Matt

Mark
-- 
| Mark R. Rinfret, SofTech, Inc.		mark@unisec.usi.com |
| Guest of UniSecure Systems, Inc., Newport, RI                     |
| UUCP:  {gatech|mirror|cbosgd|uiucdcs|ihnp4}!rayssd!unisec!mark    |
| work: (401)-849-4174	home: (401)-846-7639                        |