BBC BASIC
« BBC BASIC for SDL 2.0 v0.17a released »

Welcome Guest. Please Login or Register.
Jan 20th, 2018, 6:09pm


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: BBC BASIC for SDL 2.0 v0.17a released  (Read 607 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx BBC BASIC for SDL 2.0 v0.17a released
« Thread started on: May 1st, 2017, 10:44am »

I've updated BBCSDL, the free cross-platform edition of BBC BASIC, to version 0.17a. The various editions may be downloaded as follows:The Android edition will also run on the Amazon Fire TV Stick. The Raspberry Pi edition requires a RPi 2 or RPi 3 running Raspbian Jessie.

The main changes in this version are as follows:
  • MODE 7 has been adapted so that it will work with fonts other than the default. This has always been the case with BB4W so this is really fixing an unintentional omission.

  • A new font 'Bedstead' (which emulates a teletext/videotex character set) has been added and is selected in the 'mode7dem.bbc' program to give a more realistic MODE 7 'look'.

  • Updated the FreeSans, FreeSerif and FreeMono fonts to newer (and much larger) versions, fixing a characteristic which caused the underlined and strikeout attributes not to work.

  • Adjusted the character spacing when a bold or italic font is selected (although italic text still isn't very pretty). Note that this change could result in an incompatibility with existing programs.

  • Fixed a bug causing testing of the mouse-buttons, using INKEY(-10) to INKEY(-12), not to work correctly on the Raspberry Pi edition.

  • Fixed a cache-coherency problem when using the inline ARM assembler (Android and Raspberry Pi editions). I will post separately on this issue.

  • Fixed some minor bugs in 'SDLIDE.bbc' and 'touchide.bbc'.

  • The Android edition has improved compatibility with the Amazon Fire TV Stick, in particular the following key codes are generated by the remote control: Select = 13, Left = 136, Right = 137, Up = 139, Down = 138, Menu = 9, Rewind = 128, Play/Pause = 32 and Fast-Forward = 129.
    The navigation wheel can also be tested using the usual negative-INKEY codes for the arrow keys plus INKEY(-73) for Select.

  • The 'Turned Triples' game has been adapted to be usable on the Fire TV Stick, joining 2048.bbc, buggy.bbc, dibley.bbc and dropperz.bbc which had previously been so adapted.

  • The Android edition now supports putting a shortcut to a BBC BASIC program on the home screen (desktop), so that it behaves like a standalone application. To create such a shortcut you will need to download two utilities from the Google Play Store: 'ES File Explorer' and 'Total Commander' (both free).

    'ES File Explorer' is used, just once, to 'associate' .bbc files with BBC BASIC as follows:

    1. Navigate to any .bbc file and long-press on it until a green tick appears.

    2. Tap on 'More' (bottom right-hand corner) and select 'Open As' then 'Other'. Check 'Set as
      the default app' (bottom centre) and then select 'BBC Basic' from the list of applications.

    'Total Commander' is used to create the home screen shortcut(s) as follows:

    1. Navigate to the required .bbc file and long-press on it until a menu appears.

    2. Select 'Create link on desktop', choose the preferred icon and tap OK/APPLY.

    Programs with a shortcut on the home screen should terminate with QUIT so as not to leave BBC BASIC running in the background.
I still need volunteers to contribute to the documentation, help viewer, addin utilities and libraries.

Richard.
« Last Edit: May 1st, 2017, 10:46am by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 689
xx Re: BBC BASIC for SDL 2.0 v0.17a released
« Reply #1 on: May 2nd, 2017, 11:39am »

on May 1st, 2017, 10:44am, Richard Russell wrote:
Fixed a cache-coherency problem when using the inline ARM assembler (Android and Raspberry Pi editions). I will post separately on this issue.

BBC BASIC's integral assembler unavoidably involves writing code to 'data' memory and then executing that code. This causes a particular issue for modern processors, because typically 'data' and 'code' are cached separately.

x86 CPUs make specific provision for this situation (the so-called SMC or Self Modifying Code condition) so that when you store data in memory the associated instruction cache line is automatically flushed. This has both good and bad consequences: it means you don't need to worry about the instruction cache containing 'stale' data, but it can severely affect execution speed if you allow your assembler code to write to memory in the vicinity of the code (you will sometimes see 'guard bands' or 'gaps' declared in DIM statements to ensure sufficient separation).

The ARM CPU, in keeping with its RISC credentials, makes no specific provision for this situation. Whilst this means that writing to code memory won't have an effect on execution speed, crucially it can mean that if you try to run code immediately after having assembled it, you actually execute something completely different that happened to be in the instruction cache previously. The inevitable consequence is a catastrophic crash.

I've seen this happen on a number of occasions, so I've now modified BBCSDL v0.17a so that the ARM assembler automatically flushes the instruction cache, guaranteeing that when you run the program it really is the assembled code that gets executed. But there may still be a problem when the 'machine code' comes from somewhere other than the BBC BASIC assembler (e.g. from DATA statements or a file). I've seen programs that 'poke' code into memory using conventional indirection operators, for example:

Code:
      FOR addr% = start% TO finish% STEP 4
        READ code%
        !addr% = code%
      NEXT addr%
      CALL start% 

This may crash when executed, because the instruction cache is 'stale', and the v0.17a mod doesn't help. So I would strongly recommend that code of this sort be adapted so that it takes advantage of the modification I have made to the assembler, for example:

Code:
      FOR addr% = start% TO finish% STEP 4
        READ code%
        P% = addr% : [OPT 0 : EQUD code% : ]
      NEXT addr%
      CALL start% 

This won't be quite as fast, but that shouldn't be important (it will usually be code that is run, just once, during initialisation). It will however guarantee cache coherency.

Richard.
« Last Edit: May 2nd, 2017, 12:34pm by Richard Russell » 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