Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
I wrote a function to transform Speccy frames to a timer:
Code: function Clock(tim as uinteger) as String
dim secs as Uinteger
dim mins,sec as ubyte
dim s$ as String
s$=""
secs=int(tim/50)
mins=int(secs/60)
sec=secs mod 60
s$=str(sec)
if len(s$)=1 then
s$="0"+s$
end if
return str(mins)+":"+s$
end function
dim a as uinteger
for a=0 to 1000
print at 0,0;Clock(a)
next a
After calling it often (it shows effect around timecode 0:08), there was a screen memory corruption. In my full program the timer was still working, but the keys did not work anymore, and after that, even the minute display was corrupted. Maybe a overflow?
Reducing the Heap size from default to 100 caused no corrupted screen memory, but a complete crash.
Oh, and I'm using the latest devel version.
Edit:
It looks like there is a leak in the STR function, as without STR my program does not crash after a while.
Posts: 805
Threads: 135
Joined: Apr 2009
Reputation:
5
I have a program that uses strings as input and output to functions (without being able to make data types, strings are easiest).
This program breaks badly, and I haven't been able to track where - the spectrum just resets; even with the debugging code in. I'm wondering if I'm hitting a similar problem. Hmm.
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
This could be a nasty hard memory-corruption bug. I will check it deeply :? and tell you the results.
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
LCD, I have discovered that, removing line
makes the program to run ok. :?: So this could be an easy bug to fix.
Meanwhile, can you check your program removing this line?
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
boriel Wrote:LCD, I have discovered that, removing line
makes the program to run ok. :?: So this could be an easy bug to fix.
Meanwhile, can you check your program removing this line?
I added this line only for testing. It still happen, but after a longer time, even longer if I remove DIM s$ as String.
This is the actual version of Clock Function:
Code: function Clock(tim as uinteger) as String
dim mins,sec as ubyte
dim secs as uinteger
secs=int(tim/50)
mins=int(secs/60)
sec=secs mod 60
m$=str(mins)
if len(m$)=1 then
m$="0"+m$
end if
s$=str(sec)
if len(s$)=1 then
s$="0"+s$
end if
return m$+":"+s$
return str(int(tim/50))+" "
end function
Still causing a crash. After Meeting in Wittenberg this weekend, I can mail you the complete source code. After one minute (or less) of playing, the game locks up.
Sorry it it is not that easy.
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
Ok, back into this UltraNasty bug. It seems to be related to the STR$() function (which is already buggy in the Spectrum ROM, by the way).
I've investigated a bit further, and this code also crashes the same way, and it's much simpler:
Code: DIM i as Uinteger
DIM j as Uinteger = 0
Dim s as String
Function str0 as String
s = ""
s = str(j)
return s
End Function
for i = 0 to 1000
print str0()
next
Removing s = "" makes the program to take longer to crash. I guess this is related to the str( ) function. But need more work :?
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
But at least, you know where it sits, the nasty bug. This means, there is a chance o fix it.
OK, it is buggy in Spectrum ROM, but it does not crash like that. Is there a special prize for finding nasty bugs, except beating until the guy who reported this bug forgets about this bug?
Okay, I could shorten my bugtest source code a little bit, but I took it directly from a game which I write, and reduced it quickly a little bit to show what happens, just to be the first who reports it
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
It seems already fixed.
Can you download the new fresh version 1.2.6-r1605 and try it? It is working to me now.
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
boriel Wrote:It seems already fixed.
Can you download the new fresh version 1.2.6-r1605 and try it? It is working to me now. That was *Fast*. Thank you!
Today it is too late, but I will check it as soon as possible, probably tomorrow (Probably, because tomorrow I'm in the court in case of my broken leg).
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
In court???? hock: I knew you broke your leg, but why going to court?
Anyway: It was the STR$ function. Note that VAL() also had this bug and has been fixed.
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
boriel Wrote:In court???? hock: I knew you broke your leg, but why going to court? Because of months of pain (I still have pains when the weather changes). And the guy who is responsible for this even started to tell the witness lies about me. This will not be forgiven. It was a accident, so I wanted him to pay medicament costs, but now the situation changed apruptly after this.
boriel Wrote:Anyway: It was the STR$ function. Note that VAL() also had this bug and has been fixed. Oh, good, so one bugreport and two fixes. Maybe you know it already: You are great!
Edit: Tested, this bug is exterminated. It works now as expected. Big thanx to Boriel and good night.
The thread can be closed now.
|