Typing in & tokenizing Basic (was: Space Rescue)

You need an actual VIC.

Moderator: Moderators

User avatar
GreyGhost
Vic 20 Nerd
Posts: 515
Joined: Wed Oct 05, 2005 11:10 pm

Typing in & tokenizing Basic (was: Space Rescue)

Postby GreyGhost » Sat Feb 06, 2010 7:52 pm

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.
Rob

Vic20-Ian
Vic 20 Nerd
Posts: 884
Joined: Sun Aug 24, 2008 1:58 pm

Postby Vic20-Ian » Sun Feb 07, 2010 2:37 am

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.
Vic20-Ian

The best things in life are Vic-20

Upgrade all new gadgets and mobiles to 3583 Bytes Free today! Ready

User avatar
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Postby carlsson » Sun Feb 07, 2010 11:47 am

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:
Anders Carlsson

Image Image Image Image Image

User avatar
ral-clan
plays wooden flutes
Posts: 3528
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Postby ral-clan » Sun Feb 07, 2010 2:54 pm

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

User avatar
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Postby carlsson » Mon Feb 08, 2010 2:42 am

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.
Anders Carlsson



Image Image Image Image Image

User avatar
Pedro Lambrini
Vic 20 Scientist
Posts: 1132
Joined: Mon Dec 01, 2008 11:36 am

Postby Pedro Lambrini » Mon Feb 08, 2010 5:07 am

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? :)
"...That of the Eastern tribe being like a multitude of colours as if a rainbow had settled upon its brow..." Daniels 1:3

User avatar
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Postby carlsson » Mon Feb 08, 2010 9:12 am

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.
Anders Carlsson



Image Image Image Image Image

User avatar
Schlowski
NoMess!
Posts: 856
Joined: Tue Jun 08, 2004 12:20 pm

Postby Schlowski » Tue Feb 09, 2010 4:00 am

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

User avatar
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Postby carlsson » Tue Feb 09, 2010 5:03 am

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.
Anders Carlsson



Image Image Image Image Image

TNT
Vic 20 Hobbyist
Posts: 120
Joined: Wed Apr 29, 2009 5:46 am

Postby TNT » Tue Feb 09, 2010 11:22 am

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.


Return to “Emulation and Cross Development”

Who is online

Users browsing this forum: No registered users and 1 guest