Three Way Save With Verify

Authors

Publication

Pub Details

Date

Pages

See all articles from Extensions issue 1

On the original PRO/FILE you could only save the data with the basic part of the program. It required you to load in a master program at first to get the machine code section but didn’t have the speed advantage of only saving the data. This section allows you to save ALL (including machine code so you don’t need a separate master), or the basic with data as is done on the original, or just the DATA itself. In fact, it doesn’t even save all he data, but essentially only the part of D$ actually filled. If you only used a few thousand bytes of D$ then that’s all you save. This cuts way down on loading and saving time. This is done by saving the data as CODE instead of as DATA.

To do this I changed the order of the initial set-up so that P=20 is first and DIM D$(28020) is second. The reason D$ was originally first was simply so that it would be in a known position (the start of the variable space). Putting P first still leaves D$ in a known position because any numeric variable takes 5 bytes plus one for each letter in the name. Therefore D$ will now be at the start of the variables + 6. When put in before any string variables, your numeric variables, DIM strings and arrays do not move around because their length never changes. However, string variables (the undimensioned type) can change length and so move around.

These additions should be done after you have saved your files as described at the beginning of this newsletter. Then break in and CLEAR the program.

60 Same as verify in PRO/FILE manual.
107 IF X$="SAVE" THEN GO TO 8200
1080 IF PEEK 64026+256*PEEK 64027<>PEEK 23627+256*PEEK 23628+1 AND (Y$="D" OR Y$="E") THEN GO TO 4000
5505 PRINT AT 16,1;" LOAD DATA ONLY? (Y OR N) ": PAUSE 0: LET X$=INKEY$: IF X$="Y" THEN LOAD ""CODE PEEK 23627+256*PEEK 23628: LET F$=D$(P+1 TO P+10): BEEP .5,40: GO TO 1
5506 IF X$<>"N" THEN GO TO 5505
8000 Same as for verify in PRO/FILE manual.
8100 POKE 23750,255: POKE 23731,247: IF PEEK 64268<>205 THEN LOAD ""CODE 63488,2046
8110 BEEP .5,30: BORDER 0: PAPER 0: INK 7: GO TO 1
8200 CLS : PRINT AT 7,0;"SAVE: A)LL"''TAB7;"B)ASIC WITH DATA"''TAB 7;"D)ATA ONLY": PAUSE 0: LET X$=INKEY$: IF X$<>"A" AND X$<>"B" AND X$="<>"D" THEN GO TO 8200
8205 CLS : ON ERR GO TO 8000: IF X$="D" THEN LET D$(P+1 TO P+10)=F$: SAVE F$CODE PEEK 23627+256*PEEK 23628,P+22: GO TO 8220
8210 SAVE F$ LINE 8100: IF X$="A" THEN BEEP .5,30: SAVE F$CODE 63488,2046
8220 BEEP .5,30: PRINT AT 20,0;"REWIND TO VERIFY/BREAK TO STOP ": IF X$<>"D" THEN VERIFY F$
8225 IF X$<>"B" THEN VERIFY ""CODE
8230 BEEP .5,30: GO TO 1
9850 PRINT "FILE: ";INK 7;F$; INK 3;" ORDER: "; INK 7;S, INK 3;"OPEN: "; INK 7;LEN D$-P-10;: PRINT " bytes";TAB 0;: PRINT "FORMAT:"; INK 7;A$,,, TAB 0;: RETURN
9996 LET P=20: DIM D$(28020) etc
9997 PRINT AT 19,2; INK 7;"Press ""C"" to CREATE a new file or ""L"" to LOAD an existing one": INPUT Y$: PRINT AT 19,0;D$(100 TO 164): IF Y$="L" THEN GO TO 5505

Now as a direct command enter POKE 64095,12. If you have added the machine code sort you must also POKE 64754,12. If you add the mc sort later be sure to make the poke after you add it but before you use it!

When you SAVE ALL you will actually be making two saves. The second will save the machine code. After the first part is saved a beep will sound. You must then press a Key to save the second part. Another beep sounds when done.

When using the DATA save remember that you can only load data into a program if the length of D$ is the same for both. The only way to move data into a different size of D$ is described at the beginning of this newsletter for the saving instructions and at the end for loading the data back in.

There is one unusual aspect of the SAVE routine. If you load in an empty master tape (described later) and immediately opt to load a data tape you will not be able to find a file on the initial search (you will just get “SEARCH IS COMPLETE”). If you then press “R” to restart the search or enter another search command everything works fine. If you loaded a master tape and created a new file first and then load a data tape it also works fine. I can find no reason for this and have suffered no ill effects from it, but it is very puzzling. Anyway, it only occurs the first time you load it in. If it really bothers you you can add a line 1 LET Ti=0. This solves the problem for me but for no logical reason I can see.

Products

Downloadable Media

 
Scroll to Top