🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #39269

Re: DeskJet Plus speed

#39269
From: Paul Close
Date: Tue, 06 Jun 1989 17:25
159 lines
5310 bytes
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
Technical Details
Message-ID: <1031@cacilj.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!cacilj!paul
References: <8905311606.AA18007@ucbvax.Berkeley.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!cacilj!paul
From: paul@cacilj.UUCP (Paul Close)
Newsgroups: comp.sys.atari.st
Subject: Re: DeskJet Plus speed
Keywords: speed-demon parallel printer program
Message-ID: <1031@cacilj.UUCP>
Date: 6 Jun 89 17:25:39 GMT
References: <8905311606.AA18007@ucbvax.Berkeley.EDU>
Reply-To: paul@cacilj.UUCP (Paul Close)
Organization: CACI Products Company, La Jolla, CA
Lines: 159