How to convert a Commodor 64 BASIC listing to a tokenized form
In the previous post, I linked to an article that includes a listing of a BASIC program for the Commodore 64. But how would we run this program if we don't have a Commodore 64 lying around? :left:.
The answer is, we use VICE, the VersatIle Commodore Emulator.
But it's not quite as simple as copy and paste!
So, since it took me quite a bit to find the answer, here is a simple 'how to' on the subject. :up:. …
How to convert an ascii BASIC listing to tokenized petscii
Create an empty text file in your Home diectory. name it something, I'll use the file name basic.txt for this example.
Copy and paste the listing into this file.
Since the listing is probably all uppercase, we need to convert it to all lowercase. How you do this depends on what tools you have for manipulating text files. I used gedit, the default Gnome text file editor. In Gedit, you first need to activate the uppercase to lowercase plugin. You could also use your favourite word processor, as long as it can export to unformatted text. (certain word processors are known for adding unwanted formatting to text files)
If you don't have VICE installed on your system yet, download and install in now! (Linux users should install from the repositories, however, you need to download the source tarball to get the roms. Since the roms are copyright, you may only use them if you have a real Commodore 64 :whistle:)
Open a command line, and navigate to the directory where you put the file, basic.txt
petcat -text -w2 -o basic.prg -- basic.txt
The last step is to right click on the file basic.prg and select, 'open with', then select 'use a custom command' and type x64 into the textbox. click on open and wait a few seconds while VICE launches. It will load and 'run' the basic program automatically. (The program runs entirely in the emulated Commodore 64 and is unaware of your system!)
That's it, four steps to running a BASIC program on your computer! :p.