Page 1 of 1

Typing in & tokenizing Basic (was: Space Rescue)

Posted: Sat Feb 06, 2010 7:52 pm
by GreyGhost
Here's another one, Space Quest. Its from the July 84 issue of RUN magazine.

http://www.freedrive.com/file/1107431,s ... cue_0k.zip

OK, I used cut and paste on this one, It still took a couple of days to edit this thing, but I wanted to talk about something else.

When I cut and paste, the text that I paste is capitals, and pasting them in VICE garbles up the screen. It wants lower case letters to be pasted. So, what I usually do is copy and paste to a text file. Edit what needs to be edited and save the text file. Then I go here:

http://www.caseconvert.com/

This converts all caps to lower case and then I paste to VICE.

Is there another way that you guys do it?

Later,

Moved by Carlsson due to topic drift.

Posted: Sun Feb 07, 2010 2:37 am
by Vic20-Ian
Thanks to Carlsson I have had some success with MS Office 2003 as it has an image program with scanning and OCR support.

I scan into the Document imaging program which creates a TIFF, run OCR then save the file into a word document.

I then highlight the text and select Format, Change Case, lowercase then copy paste into Vice and save to a .D64 for use on the Vic.

Posted: Sun Feb 07, 2010 11:47 am
by carlsson
May I introduce you guys to the command line program PETCAT, which is part of the VICE distribution? Since you have Basic listings as mostly text files, you can start a command prompt and use this little program to generate a tokenized PRG out of a Basic listing. No more need to paste text directly into VICE. While the paste thing is great for short clips, any longer program would preferrably be tokenized outside the emulator.

Of course you can use PETCAT, put the PRG onto a SD card and transfer to your VIC-20 so you don't even need to touch the actual VICE emualtor. :lol:

Posted: Sun Feb 07, 2010 2:54 pm
by ral-clan
Is there any documentation on how to use PETCAT? I started it up, but all there was was a black command line interface and a blinking cursor. When I typed something a semi-colon was returned with some gobbledy gook after it.

I could find no documentation within the VICE archive.

EDIT: I did find this online.
http://swoolley.org/man.cgi/1/petcat

Posted: Mon Feb 08, 2010 2:42 am
by carlsson
Typing "petcat -?" will give you the syntax. For typical unexpanded VIC-20 use, I would do as follows:

1. Prepend the text file with the following line, which defines the load address:
program.prg ==1001==

2. petcat -w2 -o program.prg -- program.txt

Since the VIC-20 relinks programs, step 1 may not be strictly required except in certain cases. There is also a command line parameter -l which can be used to set the load address.

I believe in combination with a build tool like Make, you could set up chains of cross development that involves tokenizing Basic programs, assembling machine code programs w/ Basic included as binaries. The chain of build could even include c1541 to automatically push the files onto a D64 image.

Posted: Mon Feb 08, 2010 5:07 am
by Pedro Lambrini
So, put simply, to get a BASIC program from paper to Vic all you have to do is enter it into a PC text editor, save the txt file, run Petcat with the following line: petcat -w2 -o program.prg -- program.txt, then stick the resulting prg file on a SD card and away we go?

How would one go about entering Petscii characters? :)

Posted: Mon Feb 08, 2010 9:12 am
by carlsson
Cursor controls are encoded like {5 DOWN}, {HOME} etc. PETSCII graphics are encoded like {C-A}. Shifted letters are second nature.

Actually there are a few alternative programs, like Bastok, Tok64 (?) and so on but most of those probably are no longer supported. Then again you have programs like Schlowski's BasEdit (?) that is a full screen text editor that will tokenize for you. I can't recall to what point it lets you import text files.

Posted: Tue Feb 09, 2010 4:00 am
by Schlowski
BasEdit can load ASCII text files but has no translation for {HOME} etc. It's more to edit on the PC, not to insert per cut&paste

Posted: Tue Feb 09, 2010 5:03 am
by carlsson
It should also be pointed out some magazines like COMPUTE! encoded all cursor controls and graphic characters, so to a great deal you could OCR one of those listings and tokenize it using the tool. For listings that came directly from the printer and are full of graphic characters, you are of course on your own as I don't know any "Commodore OCR" program that with precision can recognize those symbols.

Posted: Tue Feb 09, 2010 11:22 am
by TNT
carlsson wrote:The chain of build could even include c1541 to automatically push the files onto a D64 image.
The last time I tested c1541 it saved files with interleave 1, making loading extremely slow on real hardware and on VICE too if true drive emulation is enabled.