Classic Computer Magazine Archive COMPUTE! ISSUE 11 / APRIL 1981 / PAGE 117

THE PET® GAZETTE

Partition and Load

R. D. Young
Ottawa, Ontario

And another mystery is solved. This one began where I left off in "Relocate" (COMPUTE!, Issue 9, Feb. 1981, p. 103). I think that I have now consolidated Harvey B. Herman's memory partitioning and Charles Brannon's "Quadra-PET" into one routine that makes use of "Relocate" as well. I must acknowledge with gratitude Jim Butterfield's most helpful hints, particularly the various memory maps published over the months, and Harvey B. Herman's memory partitioning challenge in the first place, coupled with his version of "Relocate" that helped to translate for the Upgrade ROM Version.

Note that I have provided two listings to accomodate original and upgrade ROMs. I have not attempted to provide for the 80-column machine. The BASIC program performs two functions: it places a machine language program into the second cassette buffer, and it initializes the partitions and the pointer storage locations (1010 to 1017 decimal). The BASIC program ends with a NEW statement, leaving the PET in the lowest partition which is equivalent to the old standard 8K PET (FRE(0) = 7164).

I chose to use a BASIC program for this loading and initialization after trying several other alternatives. Its main advantage is that the machine language program could be made small enough to fit in the second cassette buffer with the advantages that second cassette buffer use offers. Some problems with loading and initialization were also alleviated. However, because of space restrictions, error checking of user input is not performed. In other words, if you exceed the input limits * * * CRASH * * *.

The machine language program provides control over four (4) memory partitions. It will function with 16K, 24K, or 32K PETs, providing, of course, that the proper inputs are used. That's twice now that I've mentioned inputs. Here is how the routine is used:

  1. The BASIC program has left you in Area 1 (low).
  2. Use SYS 826 to call the routine. A flashing cursor will appear below the SYS826 on the screen. This is asking you for your input (number 1 to 7) according to the following options:
    1 - go to Area 1 (low 7K)
    2 - go to Area 2 (next 8K)
    3 - go to Area 3 (next 8K)
    4 - go to Area 4 (high 8K)
    5 - load Area 2
    6 - load Area 3
    7 - load Area 4
    
  3. To load Area 1, go to Area 1 and LOAD in the normal way.
  4. Key in and SAVE programs from Area 1.
  5. Clear all partitions by POKE 135,maximum:POKE 123, 4 : NEW — or upgrade ROM equivalents.

There are a few precautions to be observed. Load/Verify and device flags are not set by this routine. To load from Tape #1, for example, you must set these flags manually (see "Hooray for SYS", COMPUTE!, Issue 8, Jan. 1981, p. 96), or you must have previously loaded a program from Tape #1. This routine assumes that BASIC pointers in locations 122 and 134 (original ROM) are never changed. And lastly, going from one partition to another will result in the loss of your program if the program is less than 256 bytes long. Also remember to observe the input limits for the memory size in your machine.

Should you want or need to find out where the partitions are, the pointers to the end of BASIC in each partition restored in locations 1010 to 1017 decimal as follows (original ROM):

1010 124  Area 1
1011 125  Area 1
1012 124  Area 2
1013 125  Area 2
1014 124  Area 3
1015 125  Area 3
1016 124  Area 4
1017 125  Area 4

In fairness to all, I should mention that my PET is equipped with the original ROM only, and has 16K of memory. The routine functions with my PET, but there could still be some bugs remaining for obvious reasons.

I am looking forward to seeing any comments on the routine in COMPUTE!. For now, I'm fresh out of mysteries.

Last Minute Correction From R. D. Young

With reference to my program, "Partition and Load", dated February 15, 1981, there is a correction to be made in the program listings. In the DATA statement at line 1030 of both listings, the '4' between '224' and '16' must be changed to a '5'.

There is also one other precaution to be observed, although it is a function of the imbedded "Relocate" routine. A program loaded with this routine should not have a line 77 as part of the program. Any line 77 will be deleted because of the dynamic RETURN feature used to reset line links after the LOAD.

10 REM *** PARTITION & LOAD LOADER ***
20 REM *** AND INITIALIZATION ***
25 REM *** ORIGINAL ROM VERSION ***
30 REM *** BY R.D.  YOUNG ***
40 REM
50 REM
100 REM *** LOAD 2ND CASSETTE BUFFER ***
110 PRINT "A"
120 FOR I = 826 TO 990 : READ A : POKE I, A : NEXT
130 REM
140 REM *** INITIALIZATION ***
150 POKE 1012, 4 : POKE 1014, 4 : POKE 1016, 4
160 POKE 1013, 32 : POKE 1015, 64 : POKE 1017, 96
170 POKE 135, 32 : POKE 8192, 0 : POKE 16384, 0 : POKE 24576, 0
180 NEW
190 REM
1000 DATA 32, 223, 241, 56, 233, 48, 170, 141, 241, 3, 189, 215, 3, 133, 123, 188
1010 DATA 201, 3, 32, 176, 3, 165, 124, 157, 241, 3, 165, 125, 157, 242, 3, 152
1020 DATA 170, 189, 241, 3, 133, 124, 189, 242, 3, 133, 125, 174, 241, 3, 189, 208
1030 DATA 3, 133, 135, 224, 4, 16, 12, 165, 125, 197, 123, 240, 3, 76, 106, 197
1040 DATA 76, 83, 197, 169, 147, 32, 234, 227, 32, 174, 245, 173, 126, 2, 56, 237
1050 DATA 124, 2, 141, 241, 3, 165, 123, 141, 124, 2, 24, 109, 241, 3, 141, 126
1060 DATA 2, 169, 55, 141, 24, 129, 141, 25, 129, 169, 1, 141, 13, 2, 169, 13
1070 DATA 141, 15, 2, 76, 195, 243, 165, 135, 201, 32, 208, 3, 162, 1, 96, 201
1080 DATA 64, 208, 3, 162, 3, 96, 201, 96, 208, 3, 162, 5, 96, 162, 1, 96, 201
1090 DATA 1, 3, 5, 7, 3, 5, 7, 32, 64, 96, 128, 64, 96, 128, 4, 32
1100 DATA 64, 96, 32, 64, 96
10 REM *** PARTITION & LOAD LOADER ***
20 REM *** AND INITIALIZATION ***
25 REM *** UPGRADE ROM VERSION ***
30 REM *** BY R.D.  YOUNG ***
40 REM
50 REM
100 REM *** LOAD 2ND CASSETTE BUFFER ***
110 PRINT "A"
120 FOR I = 826 TO 989 : READ A : POKE I, A : NEXT
130 REM
140 REM ***  INITIALIZATION ***
150 POKE 1012, 4 : POKE 1014,4 : POKE 1016, 4
160 POKE 1013, 32 : POKE 1015, 64 : POKE 1017, 96
170 POKE 53, 32 : POKE 8192, 0 : POKE 16384, 0 : POKE 24576, 0
180 NEW
190 REM
1000 DATA 32, 207, 255, 56, 233, 48, 170, 141, 241, 3, 189, 214, 3, 133, 41, 188
1010 DATA 200, 3, 32, 175, 3, 165, 42, 157, 241, 3, 165, 43, 157, 242, 3, 152
1020 DATA 170, 189, 241, 3, 133, 42, 189, 242, 3, 133, 43, 174, 241, 3, 189, 207
1030 DATA 3, 133, 53, 224, 4, 16, 12, 165, 43, 197, 41, 240, 3, 76, 117, 197
1040 DATA 76, 93, 197, 169, 147, 32, 216, 227, 32, 166, 245, 173, 126, 2, 56, 237
1050 DATA 124, 2, 141, 241, 3, 165, 41, 141, 124, 2, 24, 109, 241, 3, 141, 126
1060 DATA 2, 169, 55, 141, 24, 129, 141, 25, 129, 169, 1, 133, 158, 169, 13, 141
1070 DATA 111, 2, 76, 185, 243, 165, 53, 201, 32, 208, 3, 162, 1, 96, 201, 64
1080 DATA 208, 3, 162, 3, 96, 201, 96, 208, 3, 162, 5, 96, 162, 7, 96, 1
1090 DATA 3, 5, 7, 3, 5, 7, 32, 64, 96, 128, 64, 96, 128, 4, 32, 64
1100 DATA 96, 32, 64, 96