Classic Computer Magazine Archive ANTIC VOL. 3, NO. 12 / APRIL 1985

PICTURE SHOW

"Price's Picture Painter" gets friendlier!
by PATRICK DELL'ERA

Two modifications of "Price's Picture Painter", the popular graphics utility from the September 1984 issue of Antic.  The original program allowed users to change all four colors on every scan line of Micropainter style pictures.  These two new programs make the original a little friendlier and allow you to load and display your pictures from BASIC.  These BASIC programs will run on any Atari computer with a disk drive.  But you need the original "Price's Painter" to use them.  (Send $5 to Antic for the back issue of your choice.)

In our September1984 issue, Antic published a pair of very successful machine language graphics programs, "Price's Color Picture Painter"and "Fader".  In both cases, these programs were sent to us as binary files with no source code and we rushed them into print because they were such effective graphics tools.
  At a recent meeting of ABACUS, the San Francisco Atari users 'group, we met Patrick Dell'Era who had just finished disassembling and modifying "Fader" very effectively. His easier-handling picture fadeout program will appear in the next Antic. This month we present the modifications of "Price's Painter" which Dell'Era swiftly produced to our specifications. -ANTIC ED

PRICELESS PICTURES
Patrick's Priceless Picture Show (PPPS) is a BASIC program that will display pictures designed by "Price's Color Picture Painter." Type in listing 1 and check it with TYPO II before you SAVE a copy to a disk with some "Price's Painter" files. When PPPS is RUN, it creates a Graphics 7 + screen. It also creates a Graphics 0 screen. They both reside in memory simultaneously and page flipping is utilized as appropriate.

PROGRAM OPERATION
The first things you see are a title and the disk directory of drive 1. The user is then prompted to type in the picture file to be displayed. If the file you want does not appear on the current disk, another disk can be put in the drive. Pressing [RETURN] will show the directory of the new disk.
  When the desired file is found, type in its name. The device specifier "Dl:" should not be typed. Drive 1 is assumed. PPPS will load the files indicated if no errors are encountered. Otherwise, the disk directory is redisplayed and the process begins again.
  Once PPPS finds and loads the picture file, it will then search for its related paint pot files (filename.P0, filename.Pl, etc.). Note, if there are no paint pot files, PPPS will just use the default colors. No damage done.
  The Graphics 7+ screen is then turned on. The display list interrupts are enabled. And...Voila! A pretty picture just like you created on Philip Price's color manipulation system.
  When another picture is desired, press [START] to get back to the input screen. The directory will be displayed. And you will be prompted to type in another file. At this point, the existing picture may be called again by pressing [OPTION]. Return to the PPPS input page by pressing [START].

TECHNICAL NOTES
The essential program components needed to display these pictures are:

Routine to create 7 + display list
Display List Interrupt service routine
Binary get routine
Paint Pot buffers

  The Graphics 7 + display list routine is straightforward and entirely in BASIC. The display list interrupt service routine in PPPS is placed in page 6. It is relocatable and could be tucked away anywhere safe, including a string. The binary get routine is held in BGET$. It too could be put anywhere safe because it is relocatable. The paint pot buffers are probably best used in strings as done here, although other methods could be used to create safe buffers. Each paint pot buffer must be 192 contiguous bytes long.
  The BGET$ routine was, frankly, inspired by the BGET function in BASIC XL (OSS., Sunnyvale, CA). It is used in exactly the same fashion. First, a channel must be opened for reading. Then a USR call is made to the address of the BGET routine. The following parameters must be passed in the given order:

Channel number times 16(1 * 16, 2 * 16, etc.)
Address of the buffer
Length of the buffer

  If an improper number of variables are passed, nothing will be done and a 255 will be returned to the variable.  Any other error number will be returned. If the number is greater than 3, you have a problem.
  The display list interrupt service routine needs to know the addresses of the paint pots. Put the address of pot 0 at the start of the routine plus 31; pot 1 at plus 10; pot 2 at plus 19; pot 3 at plus 25. Of course these addresses are stored in lo byte/hi byte fashion.
  Having created a 7+ screen, a DLI routine, paint pots, and having loaded a picture, the only thing left to do is turn on the show. This is done by making sure locations 560 and 561 point to the 7 + display list. Then POKE 512 and 513 with the LO/HI address of the DLI service routine. Then POKE 54286 with 192 to allow DLI's. If all is done correctly, you get the picture.

PAINTER PATCH
As mentioned previously, the original "Price's Painter" was rushed into publication and not particularly user friendly. When entering a file name, you could not edit and if you gave it the wrong file name, a screen of garbage appeared. After you finished with your picture, you had to reboot the program to load another picture.
  PATCH.BAS will rearrange a few bytes of your original "Price's Painter" binary file. Type in listing 2, checking it very carefully with TYPO II, and then SAVE at least one copy on a disk that also contains the binary file of "Price's Painter", called PAINTER. EXE.
  When PATCH.BAS is RUN it tries to open a channel to "D1:PAINTER. EXE". It then reads the file into a buffer where the patching takes place. The buffer is then written to the disk as "PATCHED.EXE", which is your new "PAINTER.EXE". You may change the name later if you wish.
  When PATCHED.EXE is loaded, the user is presented with a slightly modified input screen. Other than putting my own name up in lights, the major difference is that the 'PlC' extender is missing from the prompt. This is because a picture need not have that specific extender. In fact, no extender at all is now okay. This will make it unnecessary to rename an un-compacted Micro Illustrator PICTURE file in order to use "Price's Painter."
  This patch is more than skin deep, however. For instance, now you can type in letters and delete backspaces and cursor control keys until the cows come home. When you have the filename just the way you want it, press [RETURN]. If somehow you still got it wrong, not to worry. You will simply be brought back for another try.
  When you finally do get it right, the picture will be loaded. The paint pots with the same filename (remember, the extender is meaningless), will be loaded. You are then ready to do what you want to your picture.
  After your picture is just right, pressing [START] will save the paint pots as they are. CAUTION: The previous pots will be replaced. If you want both, use another disk. You can rename everything later. When you have completed saving the paint pots, lo and behold, you wind up back at the input screen, ready to load another picture or reload the picture just saved. O happy day!

Patrick Dell'Era is a field technician for Pacific Gas & Electric and lives in Northern California 's Marin County.

Listing 1 PATCHED.BAS Download
Listing 2 PRICELES.BAS Download