breakintoprogram / agon-bbc-basic-adl

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

A method for identifying which version of BASIC the code is running on #3

Closed breakintoprogram closed 11 months ago

breakintoprogram commented 11 months ago

As a BBC BASIC for Agon developer I want to be able to determine which version of BASIC I am running on So that my code can adjust its behaviour at runtime

Background:

In issue #1 Error in Lemmings Demo it was determined the fault was caused by code designed for the Z80 version of BBC BASIC. The solution was to manually change the base address to &0. Ideally, the code should be able to do this automatically by determining whether it is running on the 16 bit or 24 bit version of BBC BASIC.

breakintoprogram commented 11 months ago

Method 1

10 IF HIMEM >= &FFFF THEN V%=24 ELSE V%=16

The system variable HIMEM gives the top of memory, for the 16-bit version this can never be greater than &FFFF (65535)