From an insert included with the Fun With Art manual
How to Use Pictures from "Fun With Art"
in Your Own Basic Programs

In order to use pictures created using Fun With Art in your Atari BASIC programs, it is necessary to understand the various components of the picture file itself. A picture file contains the following elements listed in order of appearance.

$fe , $fe:Two bytes of identification meaning 'This is a Picture'.
COLBK:A byte for the Background Color register.
COLORs 0..2:3 bytes, one for each of the playfield colors 0 through 2.
256 bytes:The display list and supporting code to be loaded to memory Page 6 ($600).
7696 bytes:Memory Image of Screen data (pixels).
2 bytes:Length of Display List Interrupt routines (Altered Colors), low order first then high order.
Max 2300 bytes:The Display List Interrupt routines.

On the back page is provided a group of three subroutines to be used within an Atari BASIC program to load and show pictures. When using the routines there are only a few limitations as to what the rest of your BASIC routine can do while the picture is showing on the screen. These limitations are listed below.

  1. You cannot use the Display List Interrupt facility. If you do the routines changing the colors will get lost and havoc will result.
  2. You cannot use an Immediate Vertical Blank routine. The symptons of doing so will be identical to #1.
  3. If you want to use the Player/Missile facility you may have to steal extra memory from BASIC though this is not always necessary. If your 'Altered Colors' on the picture are few enough that the required DLI routines are 1k less than maximum (as is almost always the case) you can use the unused memory for Player/Missile data. For high resolution players, the nearest 2k boundary is DLIBAS + 1. For low resolution the value to stick into PMBASE ($d407 54279) is DLIBAS + 5 and the data will start at page DLIBAS + 7. DLIBAS contains the lowest memory page used by the Fun With Art picture.

The four routines listed on the back page are written for Atari BASIC and will initialize the environment for a Fun With Art picture (29000), load a picture into memory and show it on the screen (29100), and return to the unaltered BASIC text screen (29200). For ease of reading, line numbers are omitted where they are unecessary.

29000
Rem -- Init for a Fun With Art Picture --
Rem        -- Call me only Once --
mx = 7: dim cio$(mx)
for i = 1 to mx: read j: cio$(i) = chr$(j): next i
data 104,169,16,170,76,86,228
mx=15: dim pic$(mx): rem Use PIC$ to hold filename!
dim dlion$(mx)
for i = 1 to mx: read j: dlion$(i) = chr$(j): next i
data 106,169,192,141,232,6,162,6,160,221
data 169,6,76,92,228
mx = 18: dim dlioff$(mx)
for i = 1 to mx: read j: dlioff$(i) = chr$(j): next i
data 104,169,64,141,232,6,141,14,212,162
data 228,160,95,169,6,76,92,228
rem
rem Init variables and steal some memory from BASIC
rem
iocb = 848: oldscl = peek(560): oldsch = peek(561)
picbas = ( int( peek(742) / 16 ) - 2 ) * 16
dlibas = picbas - 9: poke 741,0: poke 742,dlibas
return
29100
Rem -- Load and Show a Fun With Art Picture --
Rem Note: This subroutine returns A = -1 if something
rem     is wrong with the picture file.
gosub 29200: trap 29190: Rem - Make sure DLIs are OFF
open #1,4,0,pic$: get #1,a: get #1,b: rem ID bytes.
if a <> b then close #1: a = -1: return: rem Not a PIC
if a <> 254 then clsoe #1: a= -1: return: rem Ditto
rem - Get Playfield Colors -
get #1,a: poke 712,a: rem COLBK
for i = 0 to 2: get #1,a: poke 708 + i,a: next i
rem - Read Display List into Page 6 -
poke iocb + 4,0: poke iocb + 5,6
poke iocb + 8,0: poke iocb + 9,1
a = usr( adr( cio$ ), 16 )
rem - Read Screen Data -
poke iocb + 4,0: poke iocb + 5,picbas
poke iocb + 8,16: poke iocb + 9,30
a = usr( adr( cio$ ), 16 )
rem - Read DLI Routines -
poke iocb + 4,0: poke iocb + 5,dlibas
poke iocb + 8,0: poke iocb + 9,9
a = usr( adr( cio$ ), 16 )
close #1: oldscl = peek(560): oldsch = peek(561)
rem - Show Picture on Screen -
poke 1541,picbas: poke 1645,picbas + 16
poke 1758,2: poke 1763,dlibas
poke 560,0: poke 561,6
a = usr( adr( dlion$ ) )
a = 0: return
29190
Rem -- Error Trap Handler --
close #1: a = -1: return
29200
rem -- Restore the Basic Text Screen --
a = usr( adr( dlioff$ ) )
poke 560,oldscl: poke 561,oldsch
return
NOTE:
Make sure all information typed in is capitalized.