04-16-2010, 05:27 AM
I tried to replicate this with a smaller program, and couldn't. The small one works perfectly.
*growl* The thing is, I know it's on a "print" command that it's failing, and I don't know HOW that could fail as a programmer error for print a string directly.
My best suspect right now is the bigger string isn't moving up the requisite amount of memory.
To test his, I tried making it assign " ROUND" instead (start with a longer string), and that didn't help. I asked it to also print the length of the string. It was the expected 17 each time until cycle 7, then the string was listed as 64,847 characters long; which is hopelessly wrong.
The test code below works, so it doesn't show the failure It DOES use identical code as the one that fails for setting and testing, however. *grr*
Perhaps what I'm showing more than anything, is that we need better testing for out of bounds or memory overwriting. I don't know if this is my error.
*growl* The thing is, I know it's on a "print" command that it's failing, and I don't know HOW that could fail as a programmer error for print a string directly.
My best suspect right now is the bigger string isn't moving up the requisite amount of memory.
To test his, I tried making it assign " ROUND" instead (start with a longer string), and that didn't help. I asked it to also print the length of the string. It was the expected 17 each time until cycle 7, then the string was listed as 64,847 characters long; which is hopelessly wrong.
The test code below works, so it doesn't show the failure It DOES use identical code as the one that fails for setting and testing, however. *grr*
Perhaps what I'm showing more than anything, is that we need better testing for out of bounds or memory overwriting. I don't know if this is my error.
Code:
#DEFINE FACUP 1
dim currentMatchType, faCupMatchCount, division as uByte
dim faCupMatchCountString as string
currentMatchType=FACUP
let faCupMatchCount=1
let division=4
FUNCTION get () as uByte
DIM lastK AS uByte AT 23560: REM LAST_K System VAR
LET lastK=0
DO LOOP until lastK <> 0 : REM Wait FOR a keypress
RETURN lastK
END FUNCTION
cls
do
IF currentMatchType=FACUP then let faCupMatchCountString="Round "+STR$(faCupMatchCount)
IF faCupMatchCount=7 Then let faCupMatchCountString="Semi-Final"
ELSEIF faCupMatchCount=8 Then let faCupMatchCountString="Final"
END IF
end if
IF currentMatchType=FACUP then print "F.A.Cup Match - ";faCupMatchCountString
else PRINT "League Match - ";
IF division=4 then print "League 2"
elseif division=3 then print "League 1"
elseif division=2 then print "Championship"
else print "Premier League"
END IF
END IF
if faCupMatchCount=9 then stop
else faCupMatchCount=faCupMatchCount+1
end if
get()
loop