Let's say that I have two C128 BASIC programs stored on a diskette; one with line numbers 1000-4000 and one with line numbers 5000-10000. Is there some easy way to merge them into one single BASIC program?
Quote from: Christian JohanssonLet's say that I have two C128 BASIC programs stored on a diskette; one with line numbers 1000-4000 and one with line numbers 5000-10000. Is there some easy way to merge them into one single BASIC program?
I'm sure there is a BASIC extension with a MERGE command. Sorry I can't think of one right now.
There is a manual way and I can give you a simplified method but you will have to mess with memory:
- Find zero page "start of basic" pointer (address $002D I think). Memorize the two bytes for later (should be 1C, 00).
- Load program 1
- Change the pointer to point to the end of Program 1
(the basic program should end with 3 zeros. Point to the SECOND zero)
- Load program 2
- Restore pointer to original values
Steve
If you don't want to mess with pointers, you could do the following:
List one of the programs to a SEQ file like this, making sure the CMD and LIST are on the same line as the OPEN:
open1,8,2,"listing,s,w":cmd1:list
print#1:close1
DLOAD the other program.
Read in the SEQ file to the BASIC editor like this:
open1,8,2,"listing":sys65478,,1
close 1
You'll get an error message, but the lines from the SEQ file will be added to the program in memory as if they had been typed in.
Wondering how that works, I did a hex conversion and realised that is a call to CHKIN. Essentially it redirects input from the file. That's sooo cool :cool:
I've found the BASIC CMD n handy from time to time, and always wanted the opposite (redirected input) but thought it was too complicated and was why BASIC didn't provide it. But you've done it in a single SYS.
Thanks, nikoniko. That's SURE to be handy.
Thank you for your tips :) . This time, I transcribed the code to paper from the screen and then entered it again (took a lot of time) but I will try your tips when I get the same problem again.