[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Applesoft and RESET
On Jun 3, 6:01 pm, vladitx <vlad...@nucleusys.com> wrote:
> I guess seasoned old timers can answer this question before their eye
> blinks:
>
> Why after pressing CTRL+RESET and then doing "CALL-151" the Applesoft
> prompt gives me "?OUT OF MEMORY ERROR" ? I think even the "CALL-151"
> is irrelevant, any other command produces same message (hmm, maybe
> even an empty line). And of course all this scenario happens randomly
> with some probability, but often enough to annoy me.
>
> Maybe it's already documented somewhere, but I couldn't find it
> quickly. And strange enough, I can't remember this bugging me that
> much when I was much much younger.
>
> Seems like unitialised pointers, but for the sake of further searches
> and before some FAQ includes this, answer to this post may get indexed
> in search engines.
>
> With a very quick search I found only this:
>
> Hex Dec
> $D683 54915 Inits Applesoft stack- scraps false "OUT OF MEMORY"
> error.
The Stack Pointer (SP) moves down in a running program when using
Gosub or For/Next routines and even the math brackets causing the
stack to get used and can potentially run out of space. When pressing
Reset, the SP never gets reset properly to allow it to use the full
stack and as you keep pressing reset then running a program the stack
eventually fills up and finally you get the random "Out of Memory
error".
Try this little program to intercept the reset key
300:A9 10 8D F2 03 A9 03 8D
308:F3 03 49 A5 8D F4 03 60
310:68 A8 68 A2 F8 9A 48 98
318:48 20 EA 03 20 00 03 4C
320:3C D4
This is a revised routine from D683 which resets the stack pointer,
reconnects DOS, resets the RESET pointers to point back to the
subroutine and then jumps into applesoft.
If this works then something is corrupting the stack pointer on a
reset. which could be anything from a card in a slot, (Remove all
cards and test again), or a corrupted DOS or program that might be
running illegal instructions that can cause unpredictable results.
Also to see the value of the stack pointer, change to this
310:BA 8A 20 DA FD 4C 3C D4
and hit reset. If you run a few different programs, then hit reset
after each one, the number that shows up on the screen should always
be $FB. If the number is creeping lower then something is interfering
with the reset routine and it is not resetting the SP properly.
This should help you isolate what is causing the reset malfunction.
Rob
*** Looking at life differently from another persons perspective
sometimes brings a reality check