[net.micro.pc] Printer-Code Interceptor

ccastkw@gitpyr.UUCP (KENNETH E. WALKER) (03/19/86)

(* EAT ME *) or don't (* EAT ME *)

I'm looking for a daemon or some such thing to sit out in the memory of
an IBM PC-XT and intercept-then-translate characters being sent to the 
printer.

What the story is, is that a friend bought his son an XT and a Toshiba
"3-in-one" printer. The printer does great letter-quality stuff, but
we're talking a 15 year old who wants something FUN and neat with graphs
and pictures etc.... The printer emulates a QUME "Sprint" (I've never heard
of it...) and doesn't like the output of most graphics printing programs.
Therefore I was elected (my friend's company is going to pay for my next

The daemon seems to be it in my experience, yet I don't know how to write
them. If anyone out there has such a wonderful device, I would be very happy
if I could get a hold of it> I will also be joyous if someone can just
point me in the right direction and explain what I need to do to create one.

Thanks in advance.


-- 
KENNETH E. WALKER
Office of Computing Services
Georgia Insitute of Technology, Atlanta Georgia, 30332
...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!ccastkw

gpw@ihlpf.UUCP (Wilkin) (03/20/86)

> I'm looking for a daemon or some such thing to sit out in the memory of
> an IBM PC-XT and intercept-then-translate characters being sent to the 
> printer.
> 
> What the story is, is that a friend bought his son an XT and a Toshiba
> "3-in-one" printer. The printer does great letter-quality stuff, but
> we're talking a 15 year old who wants something FUN and neat with graphs
> and pictures etc.... The printer emulates a QUME "Sprint" (I've never heard
> of it...) and doesn't like the output of most graphics printing programs.
> Therefore I was elected (my friend's company is going to pay for my next
> 
> KENNETH E. WALKER
> Office of Computing Services
> Georgia Insitute of Technology, Atlanta Georgia, 30332
> ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!ccastkw

Qume is the name of an outfit that sold many many daisy wheel printers.
There is a company which I have seen in PC or BYTE, which makes a 
software program to download the IBM fonts. They also allow graphics
to be printed. Maybe someone could post the name, DTI ????
-- 

   ____   _______   _____   _______     -------      George Wilkin
  / __ \ |__   __| /   _ \ |__   __|  -====------    AT&T Network Systems
 | (__) |   | |    \  \ \_\   | |    -======------   ...!ihpn4!ihlpf!gpw
 |  __  |   | |    /   \ __   | |    --====-------   IH 4A-157
 | |  | |   | |   |  (\ / /   | |     -----------    work 312-979-4???
 |_|  |_|   |_|    \_____/    |_|       -------      Naperville, IL 

dmt@mtgzz.UUCP (d.m.tutelman) (03/20/86)

A classical daemon would be a process that runs concurrently,
an impossibility in MSDOS, an operating system with no real notion
of "process".  However, there's a much simpler strategy that
may solve your problem.

The approach:
   -	All printer calls in a well-behaved DOS program eventually
	call the printer BIOS routine (INT 17H).
   -	You can write a terminate-and-stay-resident program that,
	when called, installs itself as the INT 17 handler.
   -	It would be called at boot time from the autoexec.bat file.
   -	It would be activated at its HANDLER entry point whenever
	an application made a call to INT 17 (print a character).
   -	It would decide whether it has any graphics mapping to do.
	If so, do it.  Whether mapped or not, pass it on to the
	real INT 17 handler, whose address you noted and saved
	at installation.  That will put it out to the printer.

The potential pitfalls:
   -	Not all programs are well-behaved in their use of the BIOS
	(though I know of no specific offenders in the case of
	printing; lots of them in the cases of diskette I/O, keyboard,
	and especially screen).  A program that has its own printer
	handler built in and bypasses the BIOS won't get intercepted.
	(But of course it wouldn't have been intercepted by a
	REAL daemon in a REAL OS either.)
   -	Depending on how different the Toshiba graphics printing is
	from the Epson, you may have to keep a lot of state information
	around.  I seriously doubt that the calls to your handler
	will be one-to-one with actual characters printed, but it
	may be much worse than that.  For instance, the you may have to
	construct several lines of pixels in a buffer,  and put
	them out in a batch.

I've used this approach in making a BIOS patch for a Hercules graphics
board, with success that can be gauged by the cautions I've noted.
Good luck, and please let us know what you do and how it works out.

       ---===		Dave Tutelman
    -------=====	Physical - AT&T Information Systems
  ----------======		Room 1H120
 ==--------========		Juniper Plaza, Route 9
  ====---=========		Freehold, NJ 07728
    ============	Logical  - ...ihnp4!mtuxo!mtuxt!dmt
       ======		Audible  - (201)-577-4232
---------------------------------------------------------------

keifer@uiucdcs.CS.UIUC.EDU (03/21/86)

I would like to have the same sort of translator program to use my IDS
Micro Prism printer.  I've heard of something around to do this, but I
don't remember what it was called or who wrote it.  Please post it if
you find out.

Thanks.

Gunnar Seaburg
Engineering Psych. Research Lab
c/o keifer@uiucdcs

tj@utcs.uucp (tj) (03/21/86)

LPTX is a memory resident program that takes stuff and puts it in
a file. Could just as easily filter it and send it off to printer.

brown@nicmad.UUCP (03/22/86)

In article <1565@gitpyr.UUCP> ccastkw@gitpyr.UUCP (KENNETH E. WALKER) writes:
>(* EAT ME *) or don't (* EAT ME *)
>
>I'm looking for a daemon or some such thing to sit out in the memory of
>an IBM PC-XT and intercept-then-translate characters being sent to the 
>printer.
>
>What the story is, is that a friend bought his son an XT and a Toshiba
>"3-in-one" printer. The printer does great letter-quality stuff, but
>we're talking a 15 year old who wants something FUN and neat with graphs
>and pictures etc.... The printer emulates a QUME "Sprint" (I've never heard
>of it...) and doesn't like the output of most graphics printing programs.

A Qume Sprint printer is a daisy-wheel, letter quality printer.  We have
two Qume Sprint 9s here.  That is one reason why it doesn't like graphics,
as it doesn't support graphics.  If the Toshiba is a dot-matrix printer,
you will need to find the mode that is NOT Sprint compatible.

Sorry that I can't give you any more information, as I don't know the
Toshiba printer.  Just wanted to tell you about the Qume printer.
-- 

              ihnp4------\
            harvard-\     \
Mr. Video      seismo!uwvax!nicmad!brown
              topaz-/     /
             decvax------/

connery@bnrmtv.UUCP (Glenn Connery) (03/22/86)

> (* EAT ME *) or don't (* EAT ME *)
> 
> I'm looking for a daemon or some such thing to sit out in the memory of
> an IBM PC-XT and intercept-then-translate characters being sent to the 
> printer.
> 
> What the story is, is that a friend bought his son an XT and a Toshiba
> "3-in-one" printer. The printer does great letter-quality stuff, but
> we're talking a 15 year old who wants something FUN and neat with graphs
> and pictures etc.... The printer emulates a QUME "Sprint" (I've never heard
> of it...) and doesn't like the output of most graphics printing programs.
> Therefore I was elected (my friend's company is going to pay for my next
> 
> The daemon seems to be it in my experience, yet I don't know how to write
> them. If anyone out there has such a wonderful device, I would be very happy
> if I could get a hold of it> I will also be joyous if someone can just
> point me in the right direction and explain what I need to do to create one.
> 
> Thanks in advance.
> 
> 
> -- 
> KENNETH E. WALKER
> Office of Computing Services
> Georgia Insitute of Technology, Atlanta Georgia, 30332
> ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!ccastkw

See PC Magazine Sept 17, 1985 page 245.  It has a listing for such a
resident utility to translate graphics characters to other printer
codes, but could obviously be extended to translate escape codes or
whatever.  If you have a modem you can download the source from the
pc magazine bulletin board at (212) 696-0360... 300/1200-8-N-1.
-- 

Glenn Connery, Bell Northern Research, Mountain View, CA
{hplabs,amdahl,3comvax}!bnrmtv!connery

dlsutton@uok.UUCP (03/25/86)

Here is a simple interrupt handler that I have written to translate
fx80 codes to caompatible mx80 codes for the IBM in graphics mode.
It should be easily modifiable for your project.  Have fun, and
call if you have any questions.
    It is written in TURBO PASCAL (v3.0).:

-----------------------------(CUT HERE OR DIE)----------------------

program gp(input,output);
{$C-}
{$K-}


{VARIABLE SECTION FOR 'GP'}

type 
     RegType         = record
                         ax,bx,cx,dx,bp,si,di,ds,es,flags : integer
                       end;
     HalfRegType     = record
                         al,ah,bl,bh,cl,ch,dl,dh : byte
                       end;
     IntrType        = record
                         ip,cs : integer
                       end;

const 
      UserInt         = $61;                  { ***HERE IT IS*** }
      {if GP will not work with your other
       resident stuff, change this number to
       a free interrupt}
      PrtInt         = $17;
      ProgSize : integer = $3000;             { approx. program size in bytes }

      Regs    : regtype = (ax:0;bx:0;cx:0;dx:0;bp:0;si:0;di:0;ds:0;es:0;flags:0)
      ;
      SaveDS  : integer  = 0;
      flags   : integer  = 0;


var 
    SaveReg    : RegType;
    SaveHalf   : HalfRegType absolute SaveReg;
    HalfReg    : HalfRegType absolute regs;
    esc_flg : boolean;
    count     : integer;
    bv  : byte;
    sl,through : boolean;



procedure ProcessInt;                  { Start of interrupt service }
begin
{when invoked, this procedure saves the registers into the structured constant

 'REGS' and restores the ds from the previously saved integer constant 'saveds'}

  inline(
         $53/                               {PUSH BX}
         $BB/regs/                          {MOV BX,OFFSET REGS}
         $2E/$89/$47/$00/                   {CS:MOV [BX]0,AX}
         $58/                               {POP AX}
         $2E/$89/$47/$02/                   {CS:MOV [BX]2,AX}
         $2E/$89/$4F/$04/                   {CS:MOV [BX]4,CX}
         $2E/$89/$57/$06/                   {CS:MOV [BX]6,DX}
         $2E/$89/$6F/$08/                   {CS:MOV [BX]8,BP}
         $2E/$89/$77/$0A/                   {CS:MOV [BX]A,SI}
         $2E/$89/$7F/$0C/                   {CS:MOV [BX]C,DI}
         $2E/$8C/$5F/$0E/                   {CS:MOV [BX]E,DS}
         $2E/$8C/$47/$10/                   {CS:MOV [BX]10,ES}
         $9C/                               {PUSHF}
         $58/                               {POP AX}
         $2E/$89/$47/$12/                   {CS:MOV [BX]12,AX}
         $2E/$8E/$1E/saveds                 {CS:MOV DS,SAVEDS -- PUT PROPER DS}
  );
  if ((through) and (count = 0) and (esc_flg)) then
    esc_flg:= false;                           {turn off esc flag}
  if (halfreg.ah = 0)                          {check for print request}
    then
    if not(esc_flg) 
      then
      if (halfreg.al = $1B)                    {if esc in al then set esc flag}
        then                                   {and notify program that task is}
        begin                                  {not finished by setting through}
          esc_flg:= true;                      {to false.}
          through:= false
        end
      else
        Intr(userint,regs)                     {if not a print request, send it to BIOS}
    else
      if (count > 0 )                          {if skipping, sub one from skip count}
        then
        count:= count - 1
      else
        case halfreg.al of
          $33 : begin                          {set line spacing}
                  halfreg.ah:= $00;
                  halfreg.al:= $1B;
                  intr(userint,regs);
                  halfreg.ah:= $00;
                  halfreg.al:= $33;
                  intr(userint,regs);
                  halfreg.ah:= $00;
                  halfreg.al:= $18;
                  intr(userint,regs);
                  through:= true;
                  count:= 1
                end;
          $51 : begin                          {skip this mode - gp doesn't support it}
                  count:= 1;
                  through:= true
                end;
          $2A : begin
                  halfreg.ah:= $00;            {set to 960 dot mode, and send dot data}
                  halfreg.al:= $0A;
                  intr(userint,regs);
                  halfreg.al:= $0D;
                  halfreg.ah:= $00;
                  intr(userint,regs);
                  halfreg.ah:= $00;
                  halfreg.al:= $1B;
                  through:= true;
                  intr(userint,regs);
                  halfreg.ah:= $00;
                  halfreg.al:= $4C;
                  Intr(userint,regs);
                  count:= 1
                end;
        else
          begin                                {else send request to BIOS}
            bv:= halfreg.al;
            halfreg.ah:= $00;
            halfreg.al:= $1B;
            intr(userint,regs);
            halfreg.ah:= $00;
            halfreg.al:= bv;
            through:= true;
            intr(userint,regs)
          end
        end
  else
    Intr(userint,regs);
{when invoked this routine restores the registers from the structure constant}

  inline(
         $BB/REGS/                          {MOV BX,OFFSET REGS}
         $2E/$8E/$47/$10/                   {CS:MOV ES,[BX]10}
         $2E/$8E/$5F/$0E/                   {CS:MOV DS,[BX]0E}
         $2E/$8B/$7F/$0C/                   {CS:MOV DI,[BX]0C}
         $2E/$8B/$77/$0A/                   {CS:MOV SI,[BX]0A}
         $2E/$8B/$6F/$08/                   {CS:MOV BP,[BX]08}
         $2E/$8B/$57/$06/                   {CS:MOV DX,[BX]06}
         $2E/$8B/$4F/$04/                   {CS:MOV CX,[BX]04}
         $2E/$8B/$47/$00/                   {CS:MOV AX,[BX]00}
         $2E/$FF/$77/$12/                   {CS:PUSH [BX]12}
         $9D/                               {POPF}
         $2E/$8B/$5F/$02/                   {CS:MOV BX,[BX]02}
         $5D/                               {POP BP}
         {restore the stack pointer}
         $5D                                {POP BP}
  );

  inline ($CA/$02/$00
  )               {RETF 02}


end;


{ PROGRAM 'GP' }
{ Program installation }
begin
  SaveDS := dseg;
  count:= 0;
  esc_flg:= false;
  through:= false;
  SaveReg.ax := $3500 + UserInt;
  Intr($21,SaveReg);                   { get user interrupt }

  if SaveReg.es <> $00 then
    writeln('User Interrupt in use -- cant install GP.')
  else

    begin
      writeln('Installing GP');
      savereg.ax := $3500 + PrtInt;
      Intr($21,savereg);                 { get keyboard interrupt }

      savereg.ax := $2500 + UserInt;
      savereg.ds := savereg.es;
      savereg.dx := savereg.bx;
      Intr($21,savereg);                 { put in user interrupt }

      savereg.ax := $2500 + PrtInt;
      savereg.ds := cseg;
      savereg.dx := ofs(ProcessInt);
      Intr($21,savereg);                 { install our interrupt processor }

      savereg.dx := ProgSize;
      Intr($27,savereg);                 { terminate and stay resident }
    end;
  inline($CD/$20);                       { terminate if interrupt in use }
end.
------------------------(CUT HERE AGAIN)-------------------------------
		Sincerely,
			David L. Sutton
			(405)787-1880
 "if you can't flame em, join em," (1985, "the adventures of NETMOUSE")

john@moncol.UUCP (John Ruschmeyer) (04/02/86)

In article <4900019@uok.UUCP>, dlsutton@uok.UUCP writes:
> 
> Here is a simple interrupt handler that I have written to translate
> fx80 codes to caompatible mx80 codes for the IBM in graphics mode.
> It should be easily modifiable for your project.  Have fun, and
> call if you have any questions.

Well, due to distance, I'd rather not call Mr. Sutton, so I was
wondering...

Could someone possibly send me a summary of how fx80 and mx80 graphics
work? I'd like to convert this program to an equivalent for my Tandy
printer.

Thanks in advance.
-- 
Name:		John Ruschmeyer
US Mail:	Monmouth College, W. Long Branch, NJ 07764
Phone:		(201) 571-3451
UUCP:		...!vax135!petsd!moncol!john	...!princeton!moncol!john
						   ...!pesnta!moncol!john

"I killed him... and he thanked me. Why did he have to be so nice about it?"