Merging BASIC programs

From BeebWiki
Jump to: navigation, search

You can merge two BASIC programs together by loading a second program at the end of the one in memory, but overwriting the end-of-program marker two bytes below TOP.

 >LOAD "part1"
 >OSCLI "LOAD part2 "+STR$~(TOP-2):END

The END is needed to tell BASIC to update its internal pointers. This method is used by the BASIC Make system commonly used with BASIC libraries such as the ones at mdfs.net/blib.