User Tools

Site Tools


back to blog...

Mar. 15th, 2020

I received a comment today, on the Reddit Commodore 64 feed, regarding the review I just posted for Loadstar's Two In One utility, that allows you to run two BASIC programs at once. The comment was, “wouldn't it be nice to be able to cut and paste from one environment to the other”.

I agreed; it would be really great if the utility offered this functionality. Then I started to think, what would you have to do in order to copy and paste text/code from one screen (or program) to another if all you had was Commodore's BASIC screen editor to work from?

I know that there a lot more cleaver people than me out there, in the Commodore computing community, and a problem like this would probaly be pretty simple for them to remedy. But, how would I go about doing it? I came up with the idea that, if you could “print” the lines of code you wanted to copy and paste to an SEQ file on the floppy disk, then print that SEQ file on the screen again, you'd have a primitive copy and paste method.

So, I did some tinkering around and came up with this:

Step One:

  OPEN 8,8,8,"CLIP1,S,W":CMD8    

What this does is create a file on the floppy disk, called CLIP1, and designates it as a sequential file, which you will be writing to. It then tells the computer that the output that follows will be sent to the floppy disk, rather than the screen.

Step Two:

  LIST 100 - 200    

The next step is to simply list the lines of code you wish to “copy” to the sequential file. In this case, I'm sending lines 100 thru 200 to the file. It will help to know, later on, how many lines of code that actually will be.

Step Three:


This step closes off the file and returns the output back to the screen.

Step Four:

Now you need to go to the second environment (where you want to “paste” the code) and tell the computer to read the sequential file from the disk and print it onto the screen. This takes a few more steps to accomplish, so what I did was write a very short program to do the task. It's called PASTE and can be found on this disk image.

Ideally, you would load this program first (I've numbered the line numbers starting with 10000) and then run it to bring in the code that you wanted to be copied. If you wish to use the program to copy over code for a program you've already begun to write, you can either type it in at the bottom of your program yourself, or use the “BASIC Linker” utility I previously reviewed, Here.

Run the program, enter the name of the copy file you created above and the number of lines to paste in. Once the lines are printed on the screen, cursor up to the first line, then press RETURN on each line, in order to enter them into memory. If you need to change the line numbers, before inserting into your program, to avoid overwriting exiting code, do so now, before press RETURN on the lines.

LIST your program and now you should see your new lines of BASIC entered into your program. It isn't very elegant, but it works. I'm sure someone with better skills than mine could create a much better solution than mine. An expert at this stuff, I'm not.

Here's a demo of how the process works:

blog/2020-03-15.txt · Last modified: 2020/03/16 00:17 by David