User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

ARM BASIC

Mon Jul 22, 2019 4:43 am

As I have gotten interested in a rather odd ball BASIC implimentation called ScriptBasic, and I see threads about verious other BASIC implementations that are available for Linux ARMHF, RISC OS, ARM BSD, etc, I figured it is worth a look at the first BASIC to be widely used on the ARM CPU, one that is still developed and maintained today.

Sophie Wilson is responcible for bringing us ARM BASIC, also known as BBC BASIC V. This BASIC is very optimal for many things (there are a few areas where it is closer to others than others), having been implimented by the person that simulated the ARM ISA in an earlier version of BBC BASIC.

While missing some feaures that many of us would like to have, it has support for a decent set of features, beyond many other BASIC's.

ARM BASIC has among its native features (this list incomplete):
  • Pointers.
  • Parameterized subroutines (PROC's and FN's).
  • IF/THEN/ELSE/ENDIF block statements.
  • Multiple types of loop.
  • Execute on value statements (CASE/WHEN, like C's switch/case).
  • += and -= operators.
  • Decent set of graphics commands.
  • A very good builtin ARM Assembler, that is still kept up to date with the latest 32-bit ARM ISA.
  • A good set of sound releated commands and statements.
  • Support for libraries.
  • Support for directly making system calls.
in addition to the features you would expect from a BASIC first introduced in the mid-1980's.

Features we do not have:
While it is missing structured data types, it is still possible to deal with structured data fairly easily using pointers.

Strings are limited to 255 bytes, as in many other languages. Though again using blocks of memory and pointers you can get around this, or by using multiple strings.

Other notes:
There are multiple extensions available to extend the function of ARM BASIC, providing some features it is missing (like structured data types), as well as some features that no one wants (like toolbox).

Depending on what test you run, ARM BASIC may be significantly faster than others. In most cases it outperforms all other BASIC interpreters that I am aware of on the same HW, there are very few exceptions to that rule that I have seen.

Lets keep this thread straight. I know that ARM BASIC has its limits. I also know that there are many BASIC interpreters that are clones of ARM BASIC. I also know that for some poor implementations of algorithms the margine of speed is less.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

Soruk
Posts: 22
Joined: Thu Jun 20, 2019 11:25 am

Re: ARM BASIC

Wed Jul 31, 2019 9:38 pm

There are actually two variants of ARM BBC BASIC, one is BASIC V that is part of the ROM of every RISC OS (and Arthur!) release, and this is the one described above. The other is BASIC VI, aka BASIC64, which was introduced with RISC OS 3 and a soft-load. This is identical in almost all respects except that integer arithmetic does not exhibit the wrap-around issue that is seen in all previous versions, and floating-point arithmetic uses 64-bit floats instead of 40-bit, and can take advantage of hardware floating point acceleration.

Return to “Other programming languages”