Nebula-AppleSoft-Basic icon indicating copy to clipboard operation
Nebula-AppleSoft-Basic copied to clipboard

snake_expanded.a: Line 7010: LE THEN parsed as LET HEN

Open greenonline opened this issue 11 months ago • 1 comments

Was the code written and/or tested on a real physical Apple II only, or was an emulator also used?

Using LE as a variable name causes issues with the parsing and becomes LET HEN when LISTed. I have only tested this on a number of emulators and the result is the same - however, I can't test this on a physical machine (as I don't have access to one).

I assume that you didn't see this issue, because you tested it on a physical machine rather than an emulator (strange I know and they should both be the same) and on the physical machine the issue did not manifest itself?

Please see Does AppleSoft BASIC really parse "LE THEN" as "LET HEN"?.

LET HEN

Solution

As pointed out by this comment, the change was made here, #1 Change buffer to be used like a ring buffer. #5 and this Update snake.a #8 states that the calormen JS emulator was used, which seems to have a parsing bug, see LE THEN GOTO should be parsed as LET HEN GOTO #51.

The fix is to use parentheses around the LE, changing

7010 IF LS > LE THEN GOTO 7060

to

7010 IF LS > (LE) THEN GOTO 7060
Alternative fixes
7010 IF LE < LS THEN GOTO 7060

or

7010 IF LS > LE GOTO 7060

Now the code will work on a real Apple II! :-)

greenonline avatar Mar 13 '25 15:03 greenonline

Interesting! The code was run on a physical Apple ][ during the filming of the course! Thanks for sharing!

shiffman avatar Mar 16 '25 20:03 shiffman