BBC BASIC
« Experimental Raspberry Pi version »

Welcome Guest. Please Login or Register.
Jun 24th, 2017, 08:51am


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Experimental Raspberry Pi version  (Read 723 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Experimental Raspberry Pi version
« Thread started 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:
  • Download the zip file and extract its contents to an empty directory (e.g. ~/BBCBASIC):
    Code:
    unzip bbc-rpi.zip 

  • Make sure your Raspberry Pi is up to date:
    Code:
    sudo apt-get update
    sudo apt-get dist-upgrade 

  • Install SDL2 and SDL2-ttf:
    Code:
    sudo apt-get install libsdl2-2.0-0
    sudo apt-get install libsdl2-ttf-2.0-0
    sudo apt-get install mesa-utils 

  • Execute BBC BASIC:
    Code:
    chmod +x bbcsdl
    ./bbcsdl 

    Or if you have a touchscreen:
    Code:
    ./bbcsdl examples/tools/touchide.bbc 
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.
« Last Edit: Feb 19th, 2017, 12:00pm by Richard Russell » User IP Logged

michael
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 52
xx Re: Experimental Raspberry Pi version
« Reply #1 on: Feb 17th, 2017, 01:24am »

I was planning to get a Raspberry pie . Have you tried controlling the pins on the device?
User IP Logged

I like reinventing the wheel, but for now I will work on tools for D3D
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: Experimental Raspberry Pi version
« Reply #2 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.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: Experimental Raspberry Pi version
« Reply #3 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.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 470
xx Re: Experimental Raspberry Pi version
« Reply #4 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.
User IP Logged

jbk
New Member
Image


member is offline

Avatar




PM


Posts: 11
xx Re: Experimental Raspberry Pi version
« Reply #5 on: Mar 5th, 2017, 10:22pm »

tank you Richard smiley
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls