[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AppleSoft Basic Question
As typed by Eric D. Shepherd ...
>
> Okay... to place the Applesoft source into a text file, add this line to
> the beginning of the program, then run it:
>
> 1 PRINT CHR$(4)"OPEN FILENAME":PRINT CHR$(4)"WRITE FILENAME":LIST 2-:PRINT
> CHR$(4)"CLOSE":END
>
> Don't forget to delete line 1 after you've done this!
> To convert the text file back to an Applesoft program, just type:
> EXEC FILENAME
> That's it!
> - Eric S.
> --
> Eric D. Shepherd | Apple II Alliance Charter Member
> InterNet: uerics@mcl.mcl.ucsb.edu | ACM Member
> FidoNet: 1:206/2713 Eric Shepherd | Programming Law #1: "When in
> AOL: Sheppy | doubt, rewrite from scratch."
>
That's almost it. Before running line 1, either type
POKE 33,33
or add this POKE to the beginning of line 1. Someone had this in an earlier
message, and I remember someone else asking why. Here's why: Without this
POKE, Applesoft nicely word-wraps lines by inserting carriage returns at about
the 34th column of the screen (40-column mode). Which means that your text
file will look exactly like the listing, BUT, if you EXEC this text file, you
will not get the entire program as it appeared originally unless you had really
short lines. The problem is, once Applesoft sees that carriage return, it
accepts the line as is, and awaits another command. The next line it receives
is the continuation of the previous line, which does not have a line number, so
Applesoft assumes it is a command. Therefore, it does NOT get entered as part
of your program, and might give you a syntax error.
The POKE 33,33 sets the width of the screen to 33 columns, so Applesoft does
not get a chance to insert the word-wrapping carriage returns, and the only
carriage returns that show up are at the end of each line, which is exactly
where we want them.
Whew! I guess that was a bit long-winded, but here's the quick summary:
* If you want to make a text file of an Applesoft program, AND you want to be
able to turn it back into an Applesoft program, type POKE 33,33 before you run
line 1 given above.
--
William R. Hall | wrh@physics.physics.wm.edu | College of William and Mary
| hall@wmheg.physics.wm.edu | Department of Physics
| Williamsburg, VA 23187-8795