breakintoprogram / agon-bbc-basic-adl

Official AGON QUARK Firmware: BASIC Interpreter (ADL version)
zlib License
16 stars 0 forks source link

Error in Lemmings Demo #1

Closed breakintoprogram closed 11 months ago

breakintoprogram commented 11 months ago

Lemmings demo

  1. Does not draw the background
  2. Stops with a "Subscript at Line 640" error
breakintoprogram commented 11 months ago

Fix for both issues:

This is not a bug in BASIC. On line 1580 there is the following command:

1580 OSCLI("LOAD " + f$ + " " + STR$(C%+p%))

There are similar commands on line 950 to load the collision data and line 1420 to load the sprite images.

The value C% (defined on line 160 is &40000, the base address of the Z80 version of BBC BASIC's 64K segment. We need to add that on to p% for the *LOAD command to make sure that the data is loaded into the correct area of memory. This is not required for the ADL version; if you get the address of the variable, you get the full 24-bit address, not a 16-bit address.

The short-term fix for this code is to change line 160 as follows:

160 C%=0

A longer term fix will be to come up with a method to identify which version of BBC BASIC the code is running on so that code can adjust accordingly. See #3 for details.

breakintoprogram commented 11 months ago

Marking this card as 'Won't Do' as it is not a bug in BBC BASIC for ADL.