Path: utzoo!mnetor!uunet!mcvax!philmds!leo
From: leo@philmds.UUCP (Leo de Wit)
Newsgroups: comp.sys.atari.st
Subject: Re: how do I print-screen (Alt) on Epson LQ-500/800?
Message-ID: <481@philmds.UUCP>
Date: 6 May 88 11:08:30 GMT
References: <8804281839.AA00314@ucbvax.Berkeley.EDU> <476@philmds.UUCP> <4675@batcomputer.tn.cornell.edu>
Reply-To: leo@philmds.UUCP (L.J.M. de Wit)
Organization: Philips I&E DTS Eindhoven
Lines: 69

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).