PCXWrite module for A26
by Ronnie Greene - 9/26/97

This module allows the user to perform a screen dump of the current display by
pressing the P key. It uses a variation on the PCX file format but is still
compatible with any PCX viewer. The main difference is that there is no test
for pixel values 192 and up. This is because the Atari 2600 can only produce
up to 128 colors. This allows a 320x200 screen image to be saved to a 5K or
less file (the opening screen from Pitfall! compressed to 5,045 bytes),
instead of ~65K in an identical BMP file.

The module is written to dump the contents of video memory (segment 0xa000),
but can be modified to dump a double buffer if necessary.

The key is tested for in the controls.8 file from A26, but a kludge is
necessary to keep the program from dumping the screen 3 or 4 times in a row.
In the KeyTable array, the index for the P key is immediately reset to 0 so it
won't be picked up on the next frame, instead of waiting for the break code
from the keyboard.

The module keeps up with the number of files written, and gives each one a
unique name. The naming convention, a26p####.pcx, uses hexadecimal
notation and allows for 65,536 files to be written before the names start to
repeat.

I hope that this file is helpful, since I have yet to see another Atari 2600
emulator that will do a screen dump. If you use this file, please give me
credit.

Happy emulating!

Ronnie Greene (ender@abts.net)
