[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in Integer BASIC (strings longer than 250 chars crash)
"cmosher01" <cmosher01@gmail.com> wrote in message
079d7945-5dc1-4823-a916-32349020f01b@g6g2000vbr.googlegroups.com">news:079d7945-5dc1-4823-a916-32349020f01b@g6g2000vbr.googlegroups.com...
>I just stumbled across a bug in APPLE ][ Integer BASIC. See this
> sample session:
>
>>LIST
> 10 DIM A$(255)
> 20 FOR I=1 TO 251
> 25 A$(I)="A"
> 30 NEXT I
> 31 PRINT "CRASH:"
> 35 A$=A$
> 40 END
>
>>RUN
> CRASH:
>
> E67B- A=E9 X=1E Y=00 P=F0 S=F8
> *
>
> I can't find any reference to this bug... anyone else ever run
> across
> it? It seems to exist both in the original Apple ][ ROMs, and in
> the
> INTEGER BASIC that's on the DOS 3.3 system master disk (which I
> know
> has some other bug fixes). It seems that anytime you fill up a
> string
> variable with more than 250 characters, and try to access it, it
> just
> crashes.
>
> Chris Mosher
I believe you are not filling up the strings. You are running out
of memory and maybe stepping on some of your own code or data (I'm
not sure how Integer BASIC stores strings).
Anyway, you are creating 250 strings each with one character "A".
To see what I mean enter this line into your code:
26 PRINT I,A$(I)
When you run it you will see something like:
1 A
2 A
3 A
...
and so on to
...
250 A
but because of the extra memory used by line 26 you don't even get
the "CRASH:" printed before the crash into the monitor.
If you remove lines 26, 31 and 35 you gain a little memory and the
program doesn't crash at all, presumably creating 251 strings.
Charlie