Raspberry BASIC

Raspberry BASIC => Interpreters => BBC BASIC => Topic started by: Richard Russell on June 28, 2020, 09:11:49 pm

Title: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on June 28, 2020, 09:11:49 pm
By popular request (well, three people!) I have created Console Mode editions of BBC BASIC for MacOS, Linux (64-bit), Windows (64-bit) and Raspbian (32-bit).  These have no graphics and no sound (nor do they support a mouse, joystick etc.) but their text-mode features are reasonably complete, so far as the capabilities of the native console/terminal allow (notably, text viewports are not supported).

You can think of them as BBC BASIC for SDL 2.0 with all the SDL stuff removed, and indeed that is effectively how they were created!  Their keyboard input is taken from stdin and their output is sent to stdout so you can use them for CGI (https://en.wikipedia.org/wiki/Common_Gateway_Interface) applications or effectively as a replacement shell.  Normal shell commands can be issued by preceding them with a * in the usual BBC BASIC way.

These editions consist of compact self-contained executables with no dependencies on any third-party libraries; the BBC BASIC interpreter they contain is identical to that in BBC BASIC for SDL 2.0.  They should be considered as Beta test programs since they have not received extensive testing.  They are, of course, completely free and can be downloaded as follows:


Supplied with the executables are a small number of BBC BASIC demo programs. Here is the output from 8queens.bbc as seen in the Windows 10 console:
Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on July 03, 2020, 04:46:06 pm
I have updated the Console Mode editions of BBC BASIC to version 0.13.  The differences in this version are:


The updated version may be downloaded from the same place as before:

Title: Re: New: Console Mode editions of BBC BASIC
Post by: John Spikowski on July 15, 2020, 02:06:26 am
Hi Richard.

I'm running Ubuntu 64 bit on my RPI 4B 4GB. Do you have a distribution for ARM 64 bit?

Curious why your 8queens example seems out of sequence. The last results are in the middle rather than the last row.
Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on July 15, 2020, 08:30:14 am
I'm running Ubuntu 64 bit on my RPI 4B 4GB. Do you have a distribution for ARM 64 bit?

Sorry, no.  As you may know, 64-bit ARM compilers (e.g. GCC) are really peculiar in one respect: their 'long double' data type (which is what BBC BASIC uses as its default numeric type) doesn't correspond to any of the floating point types supported by the arm64's FPU but is a 128-bit extended-precision type implemented purely in software.  This breaks BBC BASIC in two ways: calculations are really slow, but more fundamentally I assume a 'long double' will fit in 10 bytes (as it does on an x86) rather than needing 16!

What's really annoying and (in my opinion) silly is that there's no GCC compiler switch to force 'long double' to be a synonym for 'double' as it is in all Microsoft's compilers.  That's what Apple's compiler does too, and is why a 64-bit ARM edition of BBC BASIC for iOS was possible whereas it currently isn't on other 64-bit ARM platforms.  Eventually I'll probably need to work around this issue by changing all my 'long double' type declarations to a user-defined type which can be #typedef'd to mean 'double' on ARM64, but I've not done that yet.

Quote
Curious why your 8queens example seems out of sequence. The last results are in the middle rather than the last row.

It's not 'my' example, you'd have to ask its author.  I assume he's displaying the first twelve solutions on the first page, then the next 12 on the next page (without clearing in between) and so on.  As there are 92 solutions in all, the final 8 are shown on the last page, below which the last four from the previous group of 12 can still be seen.

As the program has been used as a sort of benchmark I expect he did not want to scroll the display, or clear it between one group of 12 and the next, because that could skew the execution time depending on the speed of clearing/scrolling.
Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on August 04, 2020, 11:36:43 am
I have updated the Console Mode editions of BBC BASIC to version 0.25.  The main changes in this version are:


Version 0.25 may be downloaded from the usual place:

Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on September 12, 2020, 02:44:02 pm
I have updated the Console Mode editions of BBC BASIC to version 0.26, principally to bring them into line with the latest release of BBC BASIC for SDL 2.0.  The main changes in this version are:
A typical use for the PTR()= statement is to set the pointer of a linked-list node:

Code: [Select]
      DIM node{link, ...}
      ...
      REPEAT
        PTR(node{}) = node.link : REM traverse linked-list
      UNTIL node.link = 0

Version 0.26 may be downloaded as follows:
Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on June 11, 2021, 02:57:53 pm
I have updated the Console Mode editions of BBC BASIC to version 0.34.  The changes in this version are:


Version 0.34 may be downloaded from the usual place:

Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on July 18, 2021, 02:13:34 pm
I have updated the Console Mode editions of BBC BASIC to version 0.35.  The changes in this version are:


Version 0.35 may be downloaded from the usual place:

Title: Re: New: Console Mode editions of BBC BASIC
Post by: John Spikowski on July 20, 2021, 01:02:08 am
Hi Richard,

Would this version allow me to run BBC BASIC on my Ubuntu ARM 64 bit OS on a RPi 4B?
Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on July 20, 2021, 08:21:24 am
Would this version allow me to run BBC BASIC on my Ubuntu ARM 64 bit OS on a RPi 4B?

I only intend to build binaries for 'official' releases of Raspberry Pi OS (which is Debian, not Ubuntu) so currently that's the 32-bit 'stable' release and the 64-bit beta-test version.  My expectation would be that the Console Mode edition of BBC BASIC is unlikely to care whether it's Debian or Ubuntu, but the GUI version might be more fussy because of its dependence on graphics drivers etc.

If it turns out that the binary is not compatible with Ubuntu you could easily build a custom version (either Console or GUI) from the source, which should have a better chance of running.
Title: Re: New: Console Mode editions of BBC BASIC
Post by: John Spikowski on July 20, 2021, 09:25:39 am
Ubuntu 64 for the RPI is an option of the official RPi installer. Based on the support and updates coming from Ubuntu for the RPi 64 I foresee Ubuntu becoming RPi's default 64 bit offering.

I'm currently running GitLab-ce on my RPi 4b 8GB. (https://basic-sandbox.us)

ScriptBasic 64 bit also runs fine on Ubuntu ARM 64 bit.

Here is a CGI echo example running on the ScriptBasic Application Server running on the same RPi 4B.

http://23.90.90.91:9090/home/echo

http://23.90.90.91:9090/home/web4cast    <-- This is using the cURL extension module to get the current weather from OpenWeather for Anacortes WA.







Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on July 20, 2021, 10:30:46 am
Ubuntu 64 for the RPI is an option of the official RPi installer.

I didn't use an "installer", I just downloaded this 64-bit OS image (https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2020-05-28/2020-05-27-raspios-buster-arm64.zip) and flashed it into a memory card.  I don't see any 64-bit Ubuntu image at that site.

Quote
Based on the support and updates coming from Ubuntu for the RPi 64 I foresee Ubuntu becoming RPi's default 64 bit offering.

That isn't the impression I've gained from 'official' pronouncements.  The description of the current 64-bit version of Raspberry Pi OS (Debian) as 'beta test' makes me think that is what will become the default 64-bit offering.  For example see this (long) thread (https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=275372) at the forum.
Title: Re: New: Console Mode editions of BBC BASIC
Post by: John Spikowski on July 20, 2021, 08:09:57 pm
The only thing I use 32 bit Raspian for is my Zero Windows USB dongle OS.

I'm not going down that rabbit hole with 64 bit on the RPi 4B and anything else they offer going forward.

You would think the Raspberry Pi Foundation would have learned their lesson trying to offer your own OS. Microsoft is struggling trying to keep Windows relevant.
Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on July 20, 2021, 09:19:08 pm
You would think the Raspberry Pi Foundation would have learned their lesson trying to offer your own OS.

I will concentrate on supporting whichever OS is more popular with users.  It's obvious that many more Raspberry Pis will be running the official 64-bit Debian than the unofficial 64-bit Ubuntu.
Title: Re: New: Console Mode editions of BBC BASIC
Post by: John Spikowski on July 20, 2021, 09:33:23 pm
I use Ubuntu 64 on all my Linux based systems. I never thought I would go back to a 32 bit OS again but the RPI was cheap enough so I lived through it.

My RPi 4B 8GB has been running 24/7 for over three months running Ubuntu 64. It seems I have to do a Gitlab-ce update at lest once a week. I'm running Ubuntu in full graphic UI mode (not as a server) and still have 4 GB of memory in reserve.
Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on August 26, 2021, 02:26:06 pm
I have updated the Console Mode editions of BBC BASIC to version 0.36.  The changes in this version are:


Version 0.36 may be downloaded from the usual place:

Title: Re: New: Console Mode editions of BBC BASIC
Post by: Richard Russell on October 21, 2021, 11:33:35 am
I have updated the Console Mode editions of BBC BASIC to version 0.38.  The changes in this version are:


Version 0.38 may be downloaded from the usual place:


The Raspberry Pi Pico download consists of a UF2 file containing a flash image, including an initialised filesystem.  To program the Pico, connect it via USB whilst the button is pressed; it will appear as an external drive (typically D:\ in Windows or /dev/ttyACM0 on a Pi).  Then copy the UF2 file to that drive.