!lm10
!rm76
Finding Applesoft Line Numbers........................Bob Potts

Sometimes I have needed to know where in memory a certain Applesoft line is located.  Maybe I want to patch in a code which cannot be typed from the keyboard.  Or maybe the program has been "compressed and optimized", so that the lines are too long to edit.  Or maybe I am just curious.

It is simple enough, because the line number is stored in binary at the beginning of each line.  I would looke at locations $67,68 to get the address of the first line.  Then look at that location to get the address of the next line, and so on.  Each line is stored in memory with the first two bytes telling where to find the next line. and the third and fourth bytes giving the line number.  Of course, the line number is in binary, and the bytes are backward, and the whole screen is full of hex numbers making it very hard to keep everything straight....

There has to be an easier way!  Working with Bob Sander-Cederlof last week, I came up with this simple little program which will print the address of any line in hex.  It uses the ampersand (&) statement of Applesoft.  You simply BRUN this program, which I call AMPERFIND, and then type an ampersand and the line number.  BRUNning sets up the ampersand vector at $3F5-3F7 and returns.

Here is the program.  Note that it takes more code to set up the ampersand vector than it takes to do the line number search!  Lines 1210-1260 could be put anywhere in memory, just so $3F6 and $3F7 are made to point to that place.

[Bob Potts is an Assistant Vice President at the Bank of Louisville in Kentucky.  this bank has 115 Apple IIs in use doing a variety of banking functions.]
