[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in Integer BASIC (strings longer than 250 chars crash)



In article 
<079d7945-5dc1-4823-a916-32349020f01b@g6g2000vbr.googlegroups.com>,
 cmosher01 <cmosher01@gmail.com> wrote:

> 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.

No, but I can see it remaining obscure. The Red Book says string arrays 
can have length 1-255, but printing past index 250 crashes. I can see 
the "X" after all the "A"s in low memory at $8FF.

>LIST
   10 DIM A$(255)
   20 FOR I=1 TO 250
   30 A$(I)="A"
   40 NEXT I
   50 PRINT A$
   60 A$(251)="X"
   99 END

>RUN
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAA

>PRINT A$

E67C-    A=F9 X=1E Y=00 P=F0 S=F7
*`

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>