Commodore 64 Computed Restore in BASIC

COMPREST
Copy, paste, and tokenize the code from the text area below to COMPREST

The above program was intended to demonstrate a simple technique for leaving array-oriented data records in DATA statements. Records are sought by using a computed RESTORE.

The computed RESTORE itself is performed entirely in BASIC.

The subroutine at line 50 searches from the beginning of BASIC's program storage to it's end via traversing the linked-list of program lines. As it traverses, it will stop if the line-number matches the variable RO.

The DATA statements are left at the top of the program so that they can be found quickly using this sequential searching technique.

A user-defined function DEEK is created in line 310 to perform a double-byte peek for the search routine.

Line 110 implements a computed-RESTORE in BASIC. The address of the BASIC statement with the found data-line number is incremented by 4 ( to skip past the 16-bit link and the 16-bit line-number ) and is then POKE'd into locations 65 and 66 so that READ will pick up this line.


Back to Jimbo's Demented Software

Back to Jimbo's Home Page