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.
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.
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
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
Rem -- Error Trap Handler -- close #1: a = -1: return
rem -- Restore the Basic Text Screen -- a = usr( adr( dlioff$ ) ) poke 560,oldscl: poke 561,oldsch return
Make sure all information typed in is capitalized.