[comp.sys.atari.st] how do I print-screen

SYSTEM@UVPHYS.BITNET (NIK ZAPANTIS) (04/28/88)

I would like to use the print-screen (Alt<help>) feature of the ST for fast
dumps of graphics to an Epson LQ-500 printer. Since the TOS printer driver
is for an Epson fx/mx printer, it does not work with the LQ-500--I guess the
two printers use different esc. sequences for graphics--.
Is there a way to somehow install an LQ-500 driver (in GDOS?) and re-direct
the output thru this driver instead of the default WITHOUT going thru one of
the progrmas that do use such drivers (eg. DEGAS ELITE).
Bear in mind that, although I know how to write a DEGAS printer driver, I have
no information on how to write the driver and install it, so that TOS can
use it.
Is there anyone who could help me solve this problem? Some code in C would be
of great help as well.

Thank you in advance

Nik Zapantis
UVIC,Physics and Astronomy
Victoria,BC
V8W 2Y2
(604)721-7729

zapantis@uvphys.bitnet
system@uvphys.bitnet
41337::zapantis   (HEPnet/SPAN)

euloth@dalcsug.UUCP (George Seto) (04/30/88)

In article <8804281839.AA00314@ucbvax.Berkeley.EDU>, SYSTEM@UVPHYS.BITNET (NIK ZAPANTIS) writes:
> 
> I would like to use the print-screen (Alt<help>) feature of the ST for fast
> dumps of graphics to an Epson LQ-500 printer. Since the TOS printer driver
> is for an Epson fx/mx printer, it does not work with the LQ-500--I guess the
> two printers use different esc. sequences for graphics--.
> Is there a way to somehow install an LQ-500 driver (in GDOS?) and re-direct
> the output thru this driver instead of the default WITHOUT going thru one of
> the progrmas that do use such drivers (eg. DEGAS ELITE).
> use it.

I know that there is a program that does exactly that. I can't remember the
name, but I think it might have appeared in Start. I have seen it posted on
BBS's several places in the US. I assume it is possible to find over there.
If I see this driver loader I will download and send to Steve Grimm as well
as yourself. Might be a few days though. My phone bills have been pretty
atrocious.

George Seto - Using a friend's account.


-- 
*******************************************************************************
* euloth@dalcsug.uucp  || Disclaimer: All opinions are my own unless other-   *
* /\/\/\/\/\/\/\/\/\/\ ||             wise noted.			      *
****AKA: Atari Nut*************************************************************

Thomas_E_Zerucha@cup.portal.com (04/30/88)

A while ago, STart magazine had an accessory, which could use any Degas
printer driver and replace the alt-help vector (which is what you need to
do, change alt-help to point to your routine).  I have some source based
loosely on that accessory in MadMac/ALN (it uses ALN's  include data file
to import the Degas driver directly in) if that would help.

leo@philmds.UUCP (Leo de Wit) (05/03/88)

In article <8804281839.AA00314@ucbvax.Berkeley.EDU> SYSTEM@UVPHYS.BITNET (NIK ZAPANTIS) writes:
>
>I would like to use the print-screen (Alt<help>) feature of the ST for fast
>dumps of graphics to an Epson LQ-500 printer. Since the TOS printer driver
>is for an Epson fx/mx printer, it does not work with the LQ-500--I guess the
>two printers use different esc. sequences for graphics--.
>Is there a way to somehow install an LQ-500 driver (in GDOS?) and re-direct
>the output thru this driver instead of the default WITHOUT going thru one of
>the progrmas that do use such drivers (eg. DEGAS ELITE).
>Bear in mind that, although I know how to write a DEGAS printer driver, I have
>no information on how to write the driver and install it, so that TOS can
>use it.
>Is there anyone who could help me solve this problem? Some code in C would be
>of great help as well.
>[...rest of message deleted...]

A few suggestions:
    1) Alter the bios, as follows. Save the old bios vector. The new bios vector
must point to a function that does the following:
        a) If the bios function is not conout (3 I guess??) jump to the old
vector.
        b) If the output device is not the printer jump to the old vector.
        c) Now if the character to be printed is one of the graphic esc. sequences for an Epson fx/mx printer, note this (in variable(s)). Other characters
must be printed using the old vector.
        d) At the end of a graphic sequence (use the variable(s)) you print the
corresponding sequence for the LQ-500, using the old vector. You will have to
fiddle somewhat here, because you can't use the old vector as a subroutine 
(having a RTE at the end). Et voila! If you want some more detailed information,I suggest you read the book Tips und Tricks ... from Data Becker; it contains a
bios 'redirection' in the way I just described.
    2) Catch the Alt-Help combination yourself, by adding a VBL (vertical blank) interrupt. Find an empty slot in the list of vertical blank vectors 
(a nil pointer). Make it point to a routine of yours that checks on Alt-Help
pressed (this info is kept in a system variable, 0x4??). If so, reset this flag
and print the screen. There is a problem however: you cannot use bios, being in
a interrupt (would cause problems with interrupted bios calls). So you have to
do it using I/O addresses and the like: nice and dirty! I've done something
similar: I use the Alt-Help for a quick dump of my screen. The program is
called FASTDUMP and I'm planning to forward it to the comp.sources.atari.st
group. It scans the screen memory and tries to match on the TOS characters.
If the character matches, it is send out as an ASCII character to the printer.
If not, a space is send (or CR-LF if more appropriate). It is as fast as
printing a file (and thus much faster than graphic dumping). It is very nice
for programs that do not have a printer option or for catching e.g. the output
of a compiler (or printing a page whilst in the editor). It is also suitable
for any printer that can do ASCII characters (and which cannot?); only graphics
cannot be printed. If you will have a little patience??

		leo.

P.S.: Now I come to think of it, altering the bios won't help if you use 
Alt-Help; maybe it does when you use the Print File option? I dunno...

braner@batcomputer.tn.cornell.edu (braner) (05/04/88)

In article <476@philmds.UUCP> leo@philmds.UUCP (L.J.M. de Wit) writes:
>    1) Alter the bios, as follows...  (much follows)

- actually replacing the screen dump routine is rather simple, since there
is a vector to it (albeit not well publicized).  The LONG at the address
$502 points to the standard routine, called by both the Alt-Help mechanism
and the XBIOS Scrdmp() function (in turn called by various paint programs).
You can simply replace the contents of that vector with the address of your
custom screen dumper, which should be a Terminate-and-stay-resident TOS
program you can place in the auto folder.  You have to do something to avoid
reentry of the actual dump code if one presses Alt-help while the dump
is in progress.  Also, you should provide for abortion on request or if
the printer does not respond.

I have actually written such a beast for my printer (an Apple Dot Matrix,
no kiddin!) (which is really a modified NEC 8023), so if there is much demand
I can post the source code.  Warning: it is in assembly language.

- Moshe Braner

leo@philmds.UUCP (Leo de Wit) (05/06/88)

In article <4675@batcomputer.tn.cornell.edu> braner@tcgould.tn.cornell.edu (braner) writes:
>In article <476@philmds.UUCP> leo@philmds.UUCP (L.J.M. de Wit) writes:
>>    1) Alter the bios, as follows...  (much follows)
>- actually replacing the screen dump routine is rather simple, since there
>is a vector to it (albeit not well publicized).  The LONG at the address
>$502 points to the standard routine, called by both the Alt-Help mechanism

So I got curious. Disassembled the relevant parts yesterday, and guess what?
Scrdmp (the XBIOS entry):              In VBL:
    movea.l $502, a0                   tst.w $4ee(a5)
    jsr     (a0)                       bne.s no_dump
    move.w  #-1, $4ee                  bsr Scrdmp
    rts                        no_dump:

Hey, this guy seems right. But reading a disassembly from D.B.'s book:
Scrdmp (the XBIOS entry):              In VBL:
    clr.w   $4ee                       tst.w $4ee(a5)
    bsr     $5a60                      bne.s no_dump
    move.w  #-1, $4ee                  bsr $5a60
    rts                        no_dump:

The last fragments, which are used in the disk-based TOS versions, are
obviously hard-coded. Seems the TOSses are incompatible in this respect.
Very likely an old TOS will throw bombs when using $502 (or just completely
reset by jumping to address 0); but who wants old TOS, anyway?
Maybe you or others know of other compatibility problems? I would like to
registrate these. Use e-mail to send them to me; I will forward them to the
net if there is some response (probably the guys at Atari Corp. already have
some info?).
    
>program you can place in the auto folder.  You have to do something to avoid
>reentry of the actual dump code if one presses Alt-help while the dump
>is in progress.  Also, you should provide for abortion on request or if
>the printer does not respond.

Actually, the VBL itself prevents re-entrance by setting the vertical blank
semaphore:
vbl:
     addq.l  #1, $466      # frclock (increment frames counter)
     subq.w  #1, $452      # vblsem  (decrement vbl semaphore)
     bmi.s   vbl_ex
  ...
vbl_ex:
     addq.w  #1, $452      # vblsem  (increment vbl semaphore)
     rte

Mostly the skip is not performed; vblsem's value is 1, 0 within the routine.
A screen dump takes a lot of time (many, many VBL's!), so when interrupts come
while performing a screen dump, the vbl just skips to vbl_ex (leaving with a
value of 0 in vblsem).
You should however test the value in the word at $4ee (Alt-Help pressed) to
abort the dump when the key was pressed (for compatibility with the 'standard
routine').

>I have actually written such a beast for my printer (an Apple Dot Matrix,
>no kiddin!) (which is really a modified NEC 8023), so if there is much demand
>I can post the source code.  Warning: it is in assembly language.
>
>- Moshe Braner

I've got one in C (with a tiny bit of assembly coded in); it does not dump in
graphics mode, but scans the screen and tries to interpret pixels as TOS
characters. It is much faster than graphic dumps, and useful for programs that
generate TOS character output (editors, compiler output, etc.), not for GEM.
It is about 290 lines of code. If you or other people are interested, please 
e-mail.
(Maybe we can make it a combined posting, Moshe?).

        Leo. (C for yourself).