BBC BASIC
General >> Announcements >> Experimental Raspberry Pi version
http://bbcbasic.conforums.com/index.cgi?board=announcements&action=display&num=1486854451

Experimental Raspberry Pi version
Post by Richard Russell on Feb 11th, 2017, 10:07pm

I've built an experimental Raspberry Pi version of BBC BASIC based on the Android (ARM) build. You can download it from here:

http://www.rtr.myzen.co.uk/bbc-rpi.zip

It has been tested only on a Raspberry Pi 3. It may also work on an RPi 2, but probably only if running Raspbian Jessie (if you find it does, or doesn't, please report back).

Installation instructions are as follows:This build depends on OpenGL, which is only experimentally supported on the RPi, hence the experimental nature of BBC BASIC. For best results it is necessary to enable the GL Driver in raspi-config (so long as it is compatible with your monitor). If you don't, BBC BASIC will run slowly and use more CPU time than is desirable.

If your experience is anything like mine, the example programs which use OpenGL for 3D will fail (opengl, pyramid, lighting, teapot, world). The other example programs should run, and quite quickly if the GL Driver is enabled.

Richard.

Re: Experimental Raspberry Pi version
Post by michael on Feb 17th, 2017, 01:24am

I was planning to get a Raspberry pie . Have you tried controlling the pins on the device?
Re: Experimental Raspberry Pi version
Post by Richard Russell on Feb 17th, 2017, 09:26am

on Feb 17th, 2017, 01:24am, michael wrote:
Have you tried controlling the pins on the device?

No (my RPi is in a case and the pins aren't accessible anyway). But assuming they are controllable via some documented API I can see no obvious reason why it shouldn't be callable from BBC BASIC using SYS.

Richard.

Re: Experimental Raspberry Pi version
Post by Richard Russell on Feb 18th, 2017, 12:02pm

Having today fully updated my Raspberry Pi 3 (rpi-update / apt-get update / apt-get dist-upgrade) I am pleased to report that the 'experimental' GL Driver (enabled in raspi-config) now works successfully with my TV, and the performance of BBC BASIC is much improved as a result. Graphics programs like 'bounce.bbc', 'chain.bbc' and 'prompter.bbc' now run at a much more acceptable speed. smiley

However true 3D programs, which rely on OpenGL, are still not working (they no longer crash, but don't display correctly). I will report back if I discover a fix.

Richard.
Re: Experimental Raspberry Pi version
Post by Richard Russell on Mar 4th, 2017, 4:04pm

on Feb 17th, 2017, 01:24am, michael wrote:
I was planning to get a Raspberry pie . Have you tried controlling the pins on the device?

The latest release of BBC BASIC for the Raspberry Pi comes with a new 'gpiolib' library which allows you to access the GPIO pins very easily. Here's a simple demo/test program:

Code:
      REM Simple GPIO test program for the Raspberry Pi 2, RPi 3 or RPi Zero

      INSTALL @lib$ + "gpiolib"
      INSTALL @lib$ + "stringlib"

      REM Initialise GPIO:
      gpio% = FN_gpio_setup

      REM Set GPIO pins 7 to 11 inclusive to output mode:
      FOR pin% = 7 TO 11
        PROC_gpio_inp(gpio%,pin%) : REM Must use PROC_gpio_inp() before PROC_gpio_out()
        PROC_gpio_out(gpio%,pin%)
      NEXT pin%

      REM Set GPIO pins 24 and 25 to input mode:
      FOR pin% = 24 TO 25
        PROC_gpio_inp(gpio%,pin%)
      NEXT pin%

      REM Enable pull-ups on GPIO pins 24 and 25:
      PROC_gpio_pull(gpio%,2) : REM Select pull-up
      WAIT 0
      PROC_gpio_pullclk0(gpio%,&3000000)
      WAIT 0
      PROC_gpio_pull(gpio%,0)
      PROC_gpio_pullclk0(gpio%,0)

      REM Output a cycling pattern to GPIO pins 7 to 11:
      previous% = %111110000000
      FOR pattern% = %000000000000 TO %111110000000 STEP %10000000
        PROC_gpio_clr(gpio%, (pattern% EOR previous%) AND NOT pattern%)
        PROC_gpio_set(gpio%, (pattern% EOR previous%) AND pattern%)
        previous% = pattern%
        WAIT 20
        PRINT FN_tobase(gpio%!&34 >> 7 AND %11111, 2, 5)
      NEXT pattern%

      END 

Richard.

Re: Experimental Raspberry Pi version
Post by jbk on Mar 5th, 2017, 10:22pm

tank you Richard smiley