[comp.sys.apple] Converting Applesoft programs to text.

bird@ihwpt.ATT.COM (J.L.Walters) (09/14/87)

Recently there were two Applesoft programs on the net that allowed you to turn
a BASIC program into a text file. The first, by Gary B Little
(somewhat mangled by me) is shown below. As you can see, this program
begins at line zero of your Applesoft program. All you do is type RUN and
all lines EXCEPT line 0 will be saved to the text file name of your choice.

0 D$ =  CHR$ (4): INPUT "FILE NAME?";A$: PRINT D$"OPEN"A$: PRINT D$"WRITE"A$:
LIST 1 - : PRINT D$"CLOSE": END

(That is a dash/minus after the 1 on LIST 1)

Then type RUN and follow the directions.

Here we have Sean Kamath's version (again, somewhat mangled by me). This one
occupies the last possible Applesoft line. The main difference between these
two is that one is the first possible line and the other is the last. Which
one should you use? Well, I guess that it would depend on whether the program
you are trying to save has line number 0 or line number 63999. If it has
neither, take your choice. If it has both, punt.

63999 D$=CHR$(4):INPUT "FILE NAME?";A$:PRINT D$"OPEN"A$:PRINT D$"WRITE"A$:
LIST 0,62998:PRINT D$"CLOSE"A$

Then type RUN 63999 and follow the directions.

The mangleing by me consisted of putting in the INPUT statements and using a
string variable for the file name. I never could spell something the same
three times running.

If I were you I would type these programs into a text editor that allows long
lines without word wrap and save them as text files i.e. AS2TXT0 and AS2TXT9
Then, when you want to save an Applesoft file as a text file you:

        1. Load the Applesoft file into memory (LOAD FILENAME)

        2. EXEC AS2TXT0 or EXEC AS2TXT9

The EXEC will "OR" in the program at line zero or 63999, depending on which
one you choose.

keith@apple.UUCP (Keith Rollin) (09/15/87)

In article <1995@ihwpt.ATT.COM> bird@ihwpt.ATT.COM (J.L.Walters) writes:
>
>Here we have Sean Kamath's version (again, somewhat mangled by me). This one
>...(explanatory stuff)
>
>63999 D$=CHR$(4):INPUT "FILE NAME?";A$:PRINT D$"OPEN"A$:PRINT D$"WRITE"A$:
>LIST 0,62998:PRINT D$"CLOSE"A$
>
>Then type RUN 63999 and follow the directions.
>
>The mangleing by me consisted of putting in the INPUT statements and using a
>string variable for the file name. I never could spell something the same
>three times running.

You also seem to have mangled the upper line number. Shouldn't that
be '63998'?

(Sorry...petty of me, but I couldn't resist...)


-- 

Keith Rollin
Sales Technical Support
Apple Computer

Disclaimer: I read this board as a genuinely concerned Mac-Head. Any views
            expressed are my own until my boss finds out what I'm doing.
            However, that doesn't mean I can't recognize a good idea and
            do something about it...