[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Applesoft -> ASCII?
The one liner to transfer Applesoft program lines into a text file has been
posted a couple of times here, I think I'd better post a combination
warning/bug fix for the technique.
When you LIST an Applesoft program, Applesoft pads the listing with spaces to
format the screen. This can cause innumerable headaches when EXECing the text
back into the 'real world' later, particularly if PRINT statements fall in
unusual places. If you are using the old Microsoft BASIC programming tactic of
keeping your program lines shorter than 72 characters, you're okay, so long as
the 80-column card is active in your machine when you create the text file.
Otherwise, if your programs look like mine (with some lines pushing the
240-character limit), you may need to take advantage of an undocumented feature
of Applesoft:
0 PRINT CHR$(21):PRINT CHR$(4);"PR#0":INPUT "Filename: ";F$ :HOME:PRINT
"Working...":POKE 33,33:PRINT CHR$(4);"OPEN "F$:PRINT CHR$(4);"WRITE "F$:LIST
1,63999:PRINT CHR$(4);"CLOSE":TEXT:END
If you type the above one-liner into a word processor that saves plain text
files (such as Apple Writer ][e), then you can load it into any BASIC program
by typing
]EXEC CONVERT TO ASCII (in DOS 3.3...or...)
]- CNVRT2ASCII (in ProDOS)
Also, if you are working in DOS 3.3, you may wish to change the 'PRINT
"Working..."' statement to 'PRINT CHR$(4);"MONCO"' so you can watch the fun.
EXPLANATION: The "Print ^U" statement makes sure that the 80-column card is
OFF on an unenhanced ][e. The "Print ^DPR#0" does the same thing on an
enhanced machine or GS. The POKE 33,33 sets the width of the text window to 33
characters, which ALSO causes Applesoft to suppress extra spaces while listing
programs.
NOTE: It is possible that the LIST command manager in the Enhanced ROM or in
BASIC.SYSTEM solves this old-as-the-hills problem, but I can't be sure.
--Dave Althoff, Jr.
(been programming Applesoft for as long as I can remember)