A2B.EXE - Converting Apple HGR screens to IBM CGA .PIC format

Compiled with:  Turbo C++ v1.00


NOTE:  This file is *very* similar to a companion archive HGR2PCX.ZIP.
       Basically, the overall program structure is the same, just the
       video modes and output files are different.  You may want to
       get both files to compare screen handling across two different
       video modes.


This converter was the result of a project that had me translating some
existing Apple// graphics into IBM format.  Granted, I could have performed
the translation on my //gs first (into .GIF format), then ported to IBM,
then translated .GIF to .PIC, I decided to try to unscramble the Apple
video memory map on the PC.  This was done for a couple of reasons:

1)  I use Cross-Works (a 19200 baud null-modem Apple// <-> IBM link
    designed for porting) to move files between my PC and //gs development
    systems.  Cross-Works allows me to flag a batch of files and port
    them all at once.  Since the Apple// series (even the //gs) is so
    intrinsically slow, it made sense to do the major number crunching
    on the PC side, where I could batch the files easily.

2)  The images I was given to work with were in the form of BSAVEs from
    the Apple HGR screen (basically, the equivalent of an IBM BSAVE in
    BASIC).  Since Apple has no built-in method of reading pixel color
    *from* the HiRes screen, and I was too lazy to write one (I prefer
    PC's...really...besides, Borland has no development products for the
    Apple// series, so why bother?), again I wanted to get *off* the
    Apple and into the IBM as fast as possible.

3)  The client wanted the resulting images in a form that could be read
    by BASIC using the standard BLOAD memory trick.


A2B assumes that the input file is a "raw" Apple BSAVE file that has
been ported (somehow) to the PC.  It loads the file, unscrambling Apple's
funky video memory mapping scheme, and then translates it onto the CGA
screen in mode 4 (320x200x4), displaying the conversion as it goes.  It
then saves out the screen in BLOAD PIC format.  Finally, the screen is
cleared and the just-created PIC file is loaded in as a check.

To use A2B, just type:

	a2b <filename> [WAIT]

where:

	<filename> - Name of raw Apple file.  If no extension is given
		     .RAW is assumed.

	[WAIT]     - Optional parameter to beep and wait before clearing
		     the screen and exiting on completion.  Leave this
		     off if you're running a2b via the RAW2PIC.BAT file
		     (for multiple conversions).

The coded is heavily commented, so it should be interesting reading.  This
little adventure serves several purposes:

1) It gives you a look at the Apple memory map, both from the unscrambling
   side and from the pixel color computation side (which is almost as
   confusing).

2) You get a look at several CGA manipulation routines.  A neat start for
   people who want to mess around with PIC files on the CGA screen.  You
   also get an example of a faster CGA-screen RAM accessing system,
   utilizing a "pointer table".  Feel free to try this idea and expand
   on it, as it makes working with the "split-plane" CGA memory map
   relatively transparent.

3) You get an example of using Turbo C++ pseudo variable to access the
   CPU registers directly.

If you have any comments (please, nothing about the value of this program.
If it's worthless to you, I'm sorry.  I probably won't use it again myself
. . . but then, you never know), drop me a line.


Scott J. Walter
GEnie:  S.Walter4
