Page 1 of 1

BUG IN LOAD WHEN APPROACHING LIMIT OF BASIC RAM

Posted: Sat Oct 21, 2023 3:16 am
by ahenry3068
I've been having intermittent bugs in Hangman using Load("BVSAVE700.BIN),1,8
When the memory usage on my program was low it worked fine BVSAVE700.BIN is loaded at $0700 and implements a save screen routine.

As my Memory Usage has gotten higher (I'm at about 18k BASIC Ram after loading my program, Just under 13k after variable initialization and resetting MEMTOP to load ZSMKIT). LOAD started to go into a endless loop. I initially fixed it by moving load to the top of the code and doing it before Variable Initialization, but my code keeps growing and it happened again.

I don't need this bug fixed to finish my program. I used a hex editor and snipped the two byte load header and I'm now using BLOAD and specifying the $0700 load address. BLOAD doesn't seem to have the same problem as LOAD and the Machine Language routine has survived my surgery :), it still works :).

Re: BUG IN LOAD WHEN APPROACHING LIMIT OF BASIC RAM

Posted: Sat Oct 21, 2023 9:11 am
by ahenry3068
Putting it here because may be related. Since I got <12k FRE(0) now. It appears some variables are occasionally getting overwritten in value. So far the symptom has been my Circle Routine drawing stuff oddly. It never did that before my program got this big. Its a a fairly straight implementation of the BRESHNHAM algorithm and I haven't changed it in many weeks. So maybe BASIC has some Memory Management issues that only manifest when free BASIC Ram is on the low side.

Re: BUG IN LOAD WHEN APPROACHING LIMIT OF BASIC RAM

Posted: Sat Oct 21, 2023 1:56 pm
by ahenry3068
ahenry3068 wrote: Sat Oct 21, 2023 9:11 am Putting it here because may be related. Since I got <12k FRE(0) now. It appears some variables are occasionally getting overwritten in value. So far the symptom has been my Circle Routine drawing stuff oddly. It never did that before my program got this big. Its a a fairly straight implementation of the BRESHNHAM algorithm and I haven't changed it in many weeks. So maybe BASIC has some Memory Management issues that only manifest when free BASIC Ram is on the low side.
I would hold off digging into this one to deeply for now. I've identified a couple of the bugs, still chasing one other wierd one now, but the 2 I've foung were straight old fashioned I overwrote a value I needed for the GOSUB to work. I just never called some of these GOSUB's in the order I'm calling them now. I stand by the LOAD bug. It was in an infinite loop, screen flashing at me. On a single line. The line with LOAD. CTRL/C did break out of it.

OK I'll have to say that I made a few ERRORS going from LINE #'s to BASLOAD. All variables seem to be collision free at this time. I did get over 1k back by trimming up my code though so I'm >12k free now instead of <12k. I also eliminated two ON GOSUBS and just did a series of IF..THEN's. That took care of my variable value issues. The LOAD bug remains though.