AI asks for help !!

Here you can talk about anything related to BBC BASIC, not covered in another category
Ric
Posts: 321
Joined: Tue 17 Apr 2018, 21:03

AI asks for help !!

Post by Ric »

I have recently come across a problem that my program crashes when i insert any more lines of code, it always appears to crash at the same point when a particular assembly routine is called. I have been using AI to try and solve the problem to no avail. It has said this:

"If RUN after insert still crashes, then we need Richard Russell - this is beyond normal BASIC - your program is now big enough to hit the IDE's own move bug. Post the exact TOP, LOMEM, HIMEM, code%% values before and after the insert on the BBC BASIC forum, he will spot it instantly."

I have HIMEM set : HIMEM=(LOMEM+(1000000000)) AND -4
I have code%% DIMMED : DIM code%% NOTEND AND 2047, code%% (2048*40)-1
and ]^P% = code%%

The heap usage is showing 450000000 approx
The free heap is showing 550000000approx
string free space is showing 400 approx
total stack usage is showing 300 approx

The program doesnt crash immediately when RUN, it only crashes when the particular ASM routine is called. If i remove a line of code (even a REM line) it runs perfectly without crashing.

Can you help me Richard ??
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Richard Russell
Posts: 724
Joined: Tue 18 Jun 2024, 09:32

Re: AI asks for help !!

Post by Richard Russell »

Ric wrote: ↑Wed 07 Oct 2026, 18:12 The program doesnt crash immediately when RUN, it only crashes when the particular ASM routine is called.
We need more information about the crash. Please list the assembly language routine in which it crashes, and also post the resulting output from your debugger - hopefully this will show the precise instruction at which it is failing.
Ric
Posts: 321
Joined: Tue 17 Apr 2018, 21:03

Re: AI asks for help !!

Post by Ric »

The debugger i have been using is dbgview, i think it is only for d3d because it doesnt show anything for the crash i am experiencing. Should i be using something different or am i not looking in the right place?
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Richard Russell
Posts: 724
Joined: Tue 18 Jun 2024, 09:32

Re: AI asks for help !!

Post by Richard Russell »

Ric wrote: ↑Fri 09 Oct 2026, 21:14 Should i be using something different or am i not looking in the right place?
I would expect any programmer, and particularly somebody developing non-trivial assembly language code, to have a post-mortem debugger of some kind installed to catch crashes (I use the regular Windows debugger WinDbg). It's one of the first things I install when I set up a PC for the first time.
Ric
Posts: 321
Joined: Tue 17 Apr 2018, 21:03

Re: AI asks for help !!

Post by Ric »

OK, Ive loaded WinDbg. I have googled how to connect bbcsdl to windbg and tried to create a .exe to run. i cant create a .exe because its too big or cant locate file (they are all loaded using @dir). Please can you help with some pointers to how to do this.
In my line of business i am constantly surprised by how many people try to do diy without the correct tools, i have learned to not expect anyone to do what is correct or the right order and just deal with each case as it arrives. I know i slot in to your version of this and i apologise for this, but i am trying to to the best ican given the little knowledge i have.

I have narrowed th ecrash down to one particular line of assembly by RETurning from the routine at each line until in fails.
1790 mov rax, ^checkForRed%(0)
If i check the variables that are used by the asm routine, they all still exist, ie checkForRed%(0) returns the correct value.
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Richard Russell
Posts: 724
Joined: Tue 18 Jun 2024, 09:32

Re: AI asks for help !!

Post by Richard Russell »

Ric wrote: ↑Sat 10 Oct 2026, 19:30 I have googled how to connect bbcsdl to windbg and tried to create a .exe to run. i cant create a .exe because its too big or cant locate file (they are all loaded using @dir). Please can you help with some pointers to how to do this.
I wasn't suggesting that you "connect BBCSDL to WinDbg" - I've never done that and I don't know how - but simply to install WinDbg as your post-mortem debugger. That's a once-off operation that you never have to repeat (Windows remembers it). It may be that a post-mortem debugger doesn't provide as much detailed information as you could otherwise obtain, but it's a lot better than nothing!

But irrespective of that you should first find out why you can't create an exe. If you think you're hitting some limit in compiler.bbc (for example the maximum of 10,000 variables and 1,000 embedded files) let me know, because I can probably increase the relevant limit - as indeed could you for that matter!