Debugging Out of Memorry errors ?

Everything related to BASIC version 1.x (Oric 1 and Atmos) or HYPERBASIC (Telestrat).
Don't hesitate to give your small program samples, technical insights, or questions...
Post Reply
User avatar
Hialmar
Flight Lieutenant
Posts: 318
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Debugging Out of Memorry errors ?

Post by Hialmar » Sat Jun 20, 2015 8:13 am

I post here as it is more related to Basic anyway.

Is there a process to diagnose Out of Memory problems in Basic ?

My goal would be to put a breakpoint with Oricutron in the ROM where it detects the problem and then check the different memory zones to find out if it's a stack problem, an array problem or a string problem (or something else I forget).

Would there be something like this in a document somewhere ?
Hialmar
CEO and Silicium member.

User avatar
iss
Flight Lieutenant
Posts: 495
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Debugging Out of Memorry errors ?

Post by iss » Sat Jun 20, 2015 9:43 am

IMO this can be stack issue or modifications in zero page which lead to BASIC error.
Can you post short piece of code to reproduce the problem?

User avatar
Hialmar
Flight Lieutenant
Posts: 318
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: Debugging Out of Memorry errors ?

Post by Hialmar » Sat Jun 20, 2015 10:50 am

I had something like that before but I'm not sure if it is the same problem.

I'll try this if I can't find a solution.

Maybe copying the page 0 and the stack somewhere before switching programs and then restoring them could be enough ?

Geoff Phillips says in his book that in order to switch from one Basic program to another ideally I would need to save the first 1500 bytes and restore them. The problem is that I'm not sure I would have enough RAM after that for my programs.
Hialmar
CEO and Silicium member.

User avatar
iss
Flight Lieutenant
Posts: 495
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Debugging Out of Memorry errors ?

Post by iss » Sat Jun 20, 2015 11:01 am

In common copying 1500 bytes is OK as size, but this includes the IO space $03xx where reading and writing can lead to unexpected problems. I think more correctly is to store and restore pages 0,1,2 and maybe page 4 (to preserve DOS if needed).
Don't forget to set the stack pointer and CPU flags too ;).

User avatar
Hialmar
Flight Lieutenant
Posts: 318
Joined: Tue Mar 04, 2014 11:25 am
Location: Toulouse, France
Contact:

Re: Debugging Out of Memorry errors ?

Post by Hialmar » Sat Jun 20, 2015 12:01 pm

I will look at the book again to find out which 1500 bytes to save.
As you say they can't be continuous in memory.

Here is what he says in the part about multitasking 2 Basic programs:
The major problem with switching between two BASIC programs is that they
need their own versions of page 0, stack, and page 2 memory. Since copying
1500 bytes of data is a time-consuming task, even for machine code, we can
only afford to interchange the running of the two programs about every twelfth of
a second. Any less than that and we would be spending too little time on the
actual programs; any more and the interchange would become more noticeable.
Got it, he says 1500 as there are two programs each with its 3 pages of 256 bytes.
Hialmar
CEO and Silicium member.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests