Classic Computer Magazine Archive COMPUTE! ISSUE 65 / OCTOBER 1985 / PAGE 10

Readers Feedback

The Editors and Readers of COMPUTE!

Saving Atari Screens
I am currently working on an Atari program that lets me create high-resolution drawings in graphics mode 8. However, it lacks one important function. How do you save and reload a graphics screen? I have an 800XL and 1050 disk drive.
Albert Newball

The following program uses the computer's input/output routines to save a block of memory. To use it, put lines 1-2 at the start of your program. These lines create a short machine language routine in memory page 6. Line 10 shows how to save or load a screen. Set the variable NAME$ equal to the name of the file you want to save or load (include D: for disk or C: for cassette). Set the variable AUX to 4 when you want to load a graphics screen, or set AUX to 8 to save a screen. Once NAME$ and AUX are defined, GOSUB 1000 does the job.

EO 1 DIM NAME$(15):FOR A=153
     6 TO 1542:READ B:POKE A
     ,B:NEXT A
CC 2 DATA 104,104,104,170,76
     ,86,228
OL 10 NAME$="D:NAME":AUX=4:G
      OSUB 1000:END
CO 1000 OPEN #1,AUX,0,NAME$
KE 1010 POKE 852,PEEK(88):PO
        KE 853,PEEK(89):POKE
         856,220:POKE 857,30
        :POKE 850,AUX+3
PC 1015 A=USR(1536,16)
KH 1020 CLOSE #1:RETURN

You can use this routine in other graphics modes by changing the values POKEd into locations 856 and 857 in line 1010. Determine the total number of bytes used for the screen in that graphics mode, then break the number down into low byte/high byte format. POKE 856 with the low byte value and POKE 857 with the high byte. The following line shows how to convert the value of the variable VA into low byte (LO) and high byte (HI) values:

HI=INT(VA/256):L0=VA-(HI*256)