Skip to content

Applesoft BASIC programs fail to decode if they run up to the edge of buffer #126

@a2geek

Description

@a2geek

Sample can be found on phan2d1.dsk:

$ acx --debug get -d phan2d1.dsk CEMETARY2
java.lang.ArrayIndexOutOfBoundsException: Index 1480 out of bounds for length 1480
	at com.webcodepro.applecommander.util.AppleUtil.getWordValue(AppleUtil.java:66)
	at com.webcodepro.applecommander.util.ApplesoftTokenizer.getNextToken(ApplesoftTokenizer.java:101)

Looking at the file contents:

$ acx get --hex -d phan2d1.dsk CEMETARY2
Offset   Hex Data                                          Characters
=======  ================================================  =================
$000000  0D 51 50 00 97 3A 8C 36  32 34 35 30 00 19 51 5A  .QP..:.6 2450..QZ
... snip ...
$0005B0  00 C5 56 18 06 91 3A AF  AC 22 4F 55 54 44 4F 4F  .EV...:/ ,"OUTDOO
         |  |     |     |  |  ^^  ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ & RUN "OUTDOO ...
         |  |     |     |  3A = colon (:)
         |  |     |     91 = HGR token
         |  |     18 06 = line number (1560)
         |  C5 56 = next addr ($56C5)
         00 = EOL
$0005C0  52 53 32 22 00 FF 00 01  .. .. .. .. .. .. .. ..  RS2"....         
         |           |  ^^ ^^ ^^ Garbage!  00FF = next addr, ??01 = line number; 
         |           |           should end 0000 as next addr
         |           ^^ 00 = EOL
         ^^ ... RS2" (continued from line above)
** END **

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions