[comp.sys.apple] Applesoft problem

lm03_cif@uhura.cc.rochester.edu (Larry Moss) (02/10/89)

Help. I'm getting some really weird results with an Applesoft program
that calls some assembly routines.

The program ran fine when it was entirely in BASIC. Assembly was used to
speed things up.  The assembly routines appear to be working fine on
their own.  The two parts just refuse to work together.

This is going to be a little difficult to explain, but I'm going to give
it a shot.

I have an integer array that seems to get half filled with zeros
everytime I call the assembly routine.  The routine is supposed to read
the array but not write to it.  The results are written to another array
before control is returned to BASIC.

In an attempt to find the bug, I put a STOP in a line just before the
CALL statement.  I checked the contents of the array and everything
seemed fine.  When I put the STOP immediately after my routine was
called, the array was wiped out.

The logical assumption would be that the bug was in this routine. So I
tried to test it.  I put BRKs in the code in various places to see what
was in the array at different times.  It looks as though everything is
fine until Applesoft actually gets its hands on it again.  As soon as the
computer does the RTS the array is overwritten.

Another thing I tried was to run the program with the STOP before the
routine is called.  Then I called the routine at the Applesoft prompt and
checked things.  Everything seemed normal.

Now, if anyone has any ideas of what happened, let me know. This is
really confusing me.


-Larry
 lm03_cif@uhura.cc.rochester.edu