[comp.sys.cbm] Convertion from runnable-BASIC to text-BASIC

scott@max.u.washington.edu (10/13/90)

In article <14423.27130fa4@max.u.washington.edu>, scott@max.u.washington.edu writes:
> Does anyone know or have written a routine that converts
> from a BASIC program in text-format to a runnable-format?
> If so, could you explain to me how to go about in achieving
> this and/or send me the routine that already does this.
 
Thanks to everyone who responded to the above problem.
I didn't know it would be that simple (relatively speaking) to
solve it. I posted this problem because I thought it was the
harder of the two. The other problem that I am refering to
is, of course, going the other way, from runnable-BASIC to           
text-BASIC. Are there also such nifty solutions/routines to 
solve this problem?
 
Again, thanks for your inputs.
 
Sincerely,
Scott K. Stephen

CTuna@cup.portal.com (Image - BBS) (10/14/90)

This one is easy to handle.  Simply load your basic program, then type the
following:

open2,8,2,"name of file,s,w":cmd2:list
close2

This will dump the entire listing of your basic program in sequential file
form to the disk.  :D

randy@athena.mit.edu (Randall W Winchester) (10/15/90)

Scott,

If you're doing your work on the C128, I suggest you boot up CS-DOS
for your BASIC programming sessions.  I've had CS-DOS for some time
now, but only just started to use it while programming in BASIC.

In addition to some excellent features, such as forward and backward
scrolling of program listings, and commands to find and change strings
in a program, the CS-DOS shell handles the text-BASIC <->
runnable-BASIC problem with minimal fuss.

To send a program listing to a disk file, simply load the program,
then type:

list > file.lst

To tokenize a program listing back into a runnable BASIC program, just
type:

exec file.lst

Exec will read the file line by line and try to execute it, but since
the lines have line numbers it enters them as program lines.  If you
do a list, you'll see the program in memory ready to run.

*******************************************************************************
*  Randy Winchester  *  randy@mit.edu  *  PO Box 1074, Cambridge, MA  02142   *
*******************************************************************************

unhd (Jonathan W Miner) (10/22/90)

In article <14443.27162735@max.u.washington.edu> scott@max.u.washington.edu writes:
> [... Deleted stuff ...]
>harder of the two. The other problem that I am refering to
>is, of course, going the other way, from runnable-BASIC to           
>text-BASIC. Are there also such nifty solutions/routines to 
>solve this problem?
> [... More stuff ...]

I have not touched my C=64 for over a year, but you should be able to
redirect standard output (I'm a UNIX fan) to the disk and create a text
file with LIST.  Try the following by typing the lines in immediate mode.

open 8,8,8,"0:LISTING,S,W":CMD 8:LIST
print#8
close 8

This should do it.  Another solution is to read the file from the disk.
If I remember, the first two bytes is the load address, then each lines
begins with two bytes (the line number), followed by the tokens.  Each
line is null terminated (0).  The tokens can be found in various ML books.

-- 
-----------------------------------------------------------------
Jonathan Miner        | I don't speak for UNH, and UNH does not 
jwm775@unhd.unh.edu   | speak for me! 
(603)868-3416         | Rather be downhill skiing... or hacking...