[comp.sys.atari.st] DeskJet Plus speed

HOESEL@HGRRUG52.BITNET (05/31/89)

Hi,

I tried to do some graphics with the DeskJet Plus printer. First using
Signum2 and printed a small picture. This went terribly slow, inspite the
fact that they claim that this printer is 5 times faster with graphics.
(you must take the word 'slow' seriously). I first thought that this was
caused by Signum2, so I wrote a small C-program that just did send of
300 dotlines of 225 bytes each, using the subroutine Bconout (in Turbo-C)
This to went *very* slow. If I send the output to the screen instead of
the printer the output takes appr. the same time. This gave me the impression
that Bconout together with turbo-C are the speed-limiting problems.

The question is: is there any method (preferrable in C, but assembler will
do as well) that allows one to send of characters faster.

Another question is: What is the time one should expect for printing
graphics of 300 * (225*8) dots on the deskjet, without any compression
of transmitted data?

                     frans van hoesel

HOESEL@HGRRUG52 or HOESEL@HGRRUG5

neff@hpvcfs1.HP.COM (Dave Neff) (06/02/89)

> The question is: is there any method (preferrable in C, but assembler will
> do as well) that allows one to send of characters faster.

> Another question is: What is the time one should expect for printing
> graphics of 300 * (225*8) dots on the deskjet, without any compression
> of transmitted data?
>
>                     frans van hoesel
>
The DeskJet+ will print a page of 300 DPI graphics compressed or otherwise
when using the parallel port in about 1 minute 15 seconds.  I can have a
1 Meg bitmap on an 8 megahertz IBM PC compatable and using the standard
copy program (copy /b) the copy program just barely sends the data fast
enough for the DeskJet+.  When compressions modes are used the PC has no
trouble keeping up with the DeskJet+.

Now the 1 minute 15 second figure does not take into account the time
required by an application to build a page.  Obviously the DeskJet+ has
no control of this and this will generally be the limitting factor.
We tell our software vendors to try to create and dump a page of graphics
in under 2 minutes in order to have "acceptable" performance.  Many
programs on an 8 megahertz IBM compatable have no problem doing
this (i.e. Lotus and others).  If this kind of speed is possible on
an 8 megahertz brain damaged CPU one would thing it could be done on
an 8 megahertz reasonable CPU :-).

I'm not an Atari user so I don't know the fastest way to shove out
bytes on an Atari.  I have had contact with some Atari users that have
dumped out uncompressed bitmaps from their Atari to the DeskJet+
in about 1 minute 30 seconds but I don't know how they were using
it.  I would guess the fastest way of course is to bypass the OS and
ROM and write to the parallel IO port, but I don't believe the MS-DOS
copy program does this (I would assume it does a DOS file open on
both the source and the destination then does reads and writes).

Dave Neff
hplabs!hpvcfs1!neff

paul@cacilj.UUCP (Paul Close) (06/07/89)

Frans van Hoesel writes:

> I tried to do some graphics with the DeskJet Plus printer. First using
> Signum2 and printed a small picture. This went terribly slow, inspite the
> fact that they claim that this printer is 5 times faster with graphics.
> (you must take the word 'slow' seriously). I first thought that this was
> caused by Signum2, so I wrote a small C-program that just did send of
> 300 dotlines of 225 bytes each, using the subroutine Bconout (in Turbo-C)
> This to went *very* slow. If I send the output to the screen instead of
> the printer the output takes appr. the same time. This gave me the impression
> that Bconout together with turbo-C are the speed-limiting problems.

Bconout is the culprit.  Turbo-C can hardly be blamed (turbo-C slow?? naw :-)
I have written the following program that blasts the characters to the
parallel port faster than the DeskJet Plus can print.  I found this program to
be *much* faster, and I can easily print a page of graphics in under 2
minutes.  The commented asm() code is not strictly necessary, but if you don't
modify the C-generated assembler to include it, your floppy drive lights may
get stuck on.  The reason for this is Atari's technique of checking the
floppies for disk change events.  The parallel port on the atari uses the
sound chip, as do the floppies, thus the conflict.  Reading drive A should
shut the light off.

I don't know how you can use this with signum2 without replacing Bconout
(Bconprt?), which I don't have the GEMDOS expertise to do.  (Any takers?)  If
signum2 uses gdos, you should consider one of the DeskJet driver programs (I
forget their names).  These driver programs work well, but only with gdos.

Here's the program:

(apologies to non-unix people for the shar.  It's easy enough to edit....
 Further apologies to those who dislike source postings.  I figure this is
 short enough....  Enough disclaimers? :-)

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	prt.c
# This archive created: Tue Jun  6 10:12:49 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'prt.c'" '(1901 characters)'
if test -f 'prt.c'
then
	echo shar: will not over-write existing file "'prt.c'"
else
sed 's/^X//' << \SHAR_EOF > 'prt.c'
X/*
X *	Speed-demon parallel printer program
X */
X
X#include <stdio.h>
X#include <osbind.h>
X
X#define BLKSIZ 1024
X
Xchar buff[BLKSIZ];
Xint  nbytes;
X
Xvoid print_block();
X
X
Xmain(argc, argv)
Xint argc;
Xchar ** argv;
X{
X    char *name;
X    int nbufs=0;
X    int n=0;
X    FILE *in;
X
X    if (argc < 2) {
X	fprintf(stderr, "print what?\n");
X	exit(1);
X    }
X
X    name = (char * )malloc(256);
X    strcpy(name, argv[1]);
X
X    if ((in = fopen(name, "rb")) == 0) {
X	strcat(name, ".dsk");
X  	if ((in = fopen(name, "rb")) == 0) {
X	    fprintf(stderr, "print: can't open %s or %s.  Giving up.\n",
X		    argv[1], name);
X	    exit(2);
X	}
X    }
X
X    while ( (nbytes = fread(buff, 1, BLKSIZ, in)) > 0 ) {
X	Supexec(print_block);
X	printf("%3dK ", ++nbufs);
X	if (!(nbufs%15))
X	    putchar('\n');
X    }
X    putchar('\n');
X
X    fclose(in);
X}
X
Xvoid
Xprint_block() {	/* uses globals buff and nbytes as "arguments" */
X    register unsigned char *lbuff=buff;
X    register unsigned int lnbytes=nbytes;
X    register unsigned int i;
X    register unsigned char *busy_addr;
X    register unsigned char *sound_chip;
X    register unsigned char val;
X
X    busy_addr=(char *)0xffffa01L;
X    sound_chip=(char *)0xffff8800L;
X    
X    *sound_chip=7;			/* register 7 */
X    val=*sound_chip;			/* set centronics output */
X    val |= 0x80;
X    *sound_chip=7;
X    sound_chip[2]=val;
X
X    for (i=0; i < lnbytes; i++) {
X
X	do {
X	    val=*busy_addr;
X	} while ( val&1 );		/* wait until printer not busy */
X
X	/* asm(" move.w sr,-(sp)"); *	 * disable interrupts */
X	/* asm(" ori.w #$700,sr"); */
X
X	*sound_chip=15;
X	sound_chip[2]=*lbuff++;		/* write data byte */
X
X	*sound_chip = 14;
X	val = *sound_chip;
X	val &= 0xdf;			/* set strobe low */
X	*sound_chip = 14;
X	sound_chip[2] = val;
X
X	*sound_chip = 14;
X	val = *sound_chip;
X	val |= 0x20;			/* set strobe high */
X	*sound_chip = 14;
X	sound_chip[2] = val;
X
X	/* asm(" move.w (sp)+,sr"); *	 * enable interrupts */
X	
X    }
X}
SHAR_EOF
if test 1901 -ne "`wc -c < 'prt.c'`"
then
	echo shar: error transmitting "'prt.c'" '(should have been 1901 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
Paul Close	paul@cacilj.CTS.COM 	...!{uunet, ucsd, crash}!cacilj!paul

    The Obi-wan Kenobi method:  "Use the Source, Luke"	-Jim Fulton