[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Applesoft to Text Convert
Mark Trullinger (markt@teleport.com) wrote:
: I need to find a way to convert a number of Applesoft Basic files into
: ascii text files, to be read by a conversion program. I havn't the
: foggiest notion of how to do this.
: Is there a utility available somewhere that does this, or is there a
: simple routine that can be entered to write a "list" to a text file
: rather than the screen?
Easy! Add the following line to the start of the program:
0 PRINT CHR$(21):TEXT:HOME:PRINT CHR$(4);"OPEN BASIC.TXT":PRINT CHR$(4);"WRITE
BASIC.TXT":POKE 33,33:LIST 1,63999:PRINT CHR$(4);"CLOSE":TEXT:END
Then RUN the program. Voila! Your Applesoft code will appear in a text
file called BASIC.TXT. Someone else suggested a similar solution, but
forgot the POKE 33,33. Let me step through this line of code and explain it:
0 PRINT CHR$(21) 'Shuts off the 80-column display if it is active
: TEXT 'Sets the text screen to 40x24
: HOME 'Optional: Cleans up any screen garbage.
: PRINT CHR$(4);"OPEN BASIC.TXT" 'Creates the file BASIC.TXT
: PRINT CHR$(4);"WRITE BASIC.TXT" 'Sends all normal output to the file
: POKE 33,33 'Sets the text window to 33x24. Also suppresses an
annoying habit of Applesoft of leaving extra
spaces and RETURNs in a listing that can foul you up
later.
: LIST 1,63999 '63999 is the highest legal Applesoft line number.
'In Integer BASIC, use "LIST 1,32767".
: PRINT CHR$(4);"CLOSE" 'Stop writing the text file and flush out the buffer
: TEXT 'Un-do the POKE 33,33; equivalent to POKE 33,40.
: END 'Stop the program here instead of RUNning the code we
just converted.
To recap, after that lengthy explanation, you want to add this line to the
start of your program:
0 PRINT CHR$(21):TEXT:HOME:PRINT CHR$(4);"OPEN BASIC.TXT":PRINT
CHR$(4);"WRITE BASIC.TXT":POKE 33,33:LIST 1,63999:PRINT
CHR$(4);"CLOSE":TEXT:END
--Dave Althoff, Jr. (long-time Applesoft Ace)
Cedar Point re-opens in 77 days!
--
/-\ _ _ __*** Closed for the season ***
/XXX\ /X\ /X\_ _ /XX\_ _ _ _____
/XXXXX\ /XXX\ _/XXXX\_ /X\ /XXXXX\ /X\ /X\ /XXXXX
_/XXXXXXX\__/XXXXX\/XXXXXXXX\_/XXX\_/XXXXXXX\__/XXX\_/XXX\_/\_/XXXXXX