Storing and Recalling Screens

See all articles from ZX-Appeal Sept 87
Author(s): Jay Mundy
Publication: ZX-Appeal
Pub Details: ZX-Appeal Sept 87
Date: September 1987
Pages: 8-9

Here is a fairly short but extremely powerful machine code utility that enables you to instantly store and recall up to five screens (including attributes) at the touch of a button.

Listing 1 sets up the BASIC variables and pokes the machine code routine into memory. It will automatically be erased when you type in Listing 2.

After RUNning Listing 1, type in Listing 2 and ENTER GOTO 9000. (RUN must not be used because it will wipe out the BASIC variables)

You are presented with a menu which gives you the option to either “L”- load a screen from tape, “S”- store the current screen to one of 5 memory banks, or “R”- recall one of the 5 memory banks to the screen.

Although this program uses all 24 lines of the screen, the bottom two lines are occupied by the menu.

This routine can be easily implemented into other programs but uses quite a considerable chunk of memory (about 35K).

The program and screens can by SAVEd on tape by using GOTO 9400. If you just wish to SAVE the utility (no screens), use GOTO 9500.

In case you decide to modify this program (perhaps to save memory by storing fewer screens), I have included a table indicating where the utility and various screen banks are stored in memory.

Listing 1

9000 CLEAR 30788
9100 FOR f=65350 TO 65361
9110 READ x
9120 POKE f,x
9130 NEXT f
9140 DATA 33,0,64,17,80,195,
1,0,27,237,176,201
9200 DIM a(5)
9210 FOR f=1 TO 5
9220 READ a(f)
9230 NEXT f
9240 DATA 228,201,174,147,
120

Listing 2

9000 PRINT #1;"L- LOAD    S-
STORE R- RECALL"
9010 LET i= PEEK 23556
9020 GOTO 9010+(90 AND i=76)
+(190 AND i=83)+(290
AND i=82)
9100 REM LOAD SCREEN
9110 BEEP .2,30: INPUT ;
9120 PRINT #1; TAB 8; FLASH
1;"LOADING SCREEN"
9130 LOAD "" SCREEN$
9140 GOTO 9000
9200 REM STORE SCREEN
9210 BEEP .2,30: INPUT ;
9220 PRINT #1;"STORE IN WHIC
H BANK? (1-5)"
9230 LET i$= INKEY$
9240 IF i$<"1" OR i$>"5"
THEN GOTO 9230
9250 POKE 65351,0:
POKE 65352,64
9260 POKE 65354,69:
POKE 65355,a( VAL i$)
9270 INPUT ;
9280 RANDOMIZE USR 65350
9290 GOTO 9000
9300 REM RECALL SCREEN
9310 BEEP .2,30: INPUT ;
9320 PRINT #1;"RECALL WHICH
BANK? (1-5)"
9330 LET i$= INKEY$
9340 IF i$<"1" OR i$>"5"
THEN GOTO 9330
9350 POKE 65351,69:
POKE 65352,a( VAL i$)
9360 POKE 65354,0:
POKE 65355,64
9370 INPUT ;
9380 RANDOMIZE USR 65350
9390 GOTO 9000
9400 REM SAVE PROGRAM
9410 SAVE "Scrnstore" LINE
9600: SAVE "Scrnbanks"
CODE 30789,34573
9420 GOTO 9000
9500 REM SAVE ROUTINE
9510 SAVE "Scrnstore" LINE
9600: SAVE "Scrncode"
CODE 65350,12
9520 GOTO 9000
9600 LOAD "" CODE
9610 GOTO 9000

Storage table

Utility   65350 - 65361
Bank #1   58437 - 65348
Bank #2   51525 - 58436
Bank #3   44613 - 51524
Bank #4   37701 - 44612
Bank #5   30789 - 37700

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.