Topics

BBC BASIC for SDL 2.0 v0.20a released

Richard Russell
 

I've updated BBCSDL, the free cross-platform implementation of BBC BASIC, to version 0.20a. The various editions may be downloaded as follows:

The Android edition will also run on the Amazon Fire TV Stick.

As things are currently looking this may be the last release of BBCSDL.

The main changes in this version are as follows:

BASIC interpreter:

  1. The INT() function returns a true integer variant, not a floating-point value that happens to be an integer.

  2. The PTR(string$) function returns the memory address of a string.

  3. The <<< operator performs a 64-bit shift, even in the default *hex32 mode.

  4. Fixed a bug in the raise-to-power operator ^ (Android and Raspberry Pi editions).

Libraries:

  1. Fixed a minor bug in the socklib library.

  2. Added the eventlib and timerlib libraries (compatible with their BB4W equivalents).

Example Programs:

  1. The fire graphics demo has been added.

  2. The Penrose stairs graphics (and sound) demo has been added.

IDEs:

  1. SDLIDE.bbc: You can now select an item in the List variables window and it will be automatically scrolled to keep it in view.

  2. touchide.bbc: The 'New file' and 'Rename file' commands default to an extension of .bbc if none is entered.


In addition. the Android edition has been modified (hopefully) to fix an incompatibility with recent releases of Android. It also has a (not very nice) splash screen!


I apologise that none of the major outstanding shortcomings has been addressed in this release, and probably won't ever be. These include the absence of a 'compile' (create application) capability, no add-in utilities (such as Cross Reference), no integrated Help, no support for printing etc.

Richard.

 

Working again on Oneplus 5 with latest OxygenOS 5.0.2 - much appreciated.

Paul Marshall
 

Thanks Richard
Working well on Amazon Fire TV.

To my delight and surprise it also works on a 2017 Sony Android TV.  Surprise because the Android TV is IMHO a pretty terrible OS. I've tried a few 'unapproved' apps and none worked.

Delight because a USB keyboard & mouse work on the TV so it is now potentially possible to make edits to programs relatively easily. Two problems with that - although the physical keyboard & mouse work the Android on-screen keyboard also appears and it is not possible to get rid of it - this is an Android issue I think.  Also the editor has only 40 columns with no sideways scrolling. It is possible to type on the keyboard, and to scroll up and down smoothly with the mouse wheel but there is no way to scroll right. SO more investigation needed but encouraging.
As it is a third party app it does not (unlike on the Fire) appear in my Home screen Apps list so has to be controlled via Settings/Apps. There are side-loading control apps but I haven't found one I like.
There are few apps in the Google Play Store for Android TV so if we can get this approved it will be the first Basic (or indeed any programming language)  for Android TV.

Richard Russell
 

On Sun, Feb 4, 2018 at 03:15 am, Paul Marshall wrote:
the Android on-screen keyboard also appears and it is not possible to get rid of it - this is an Android issue I think
In my experience, connecting an external keyboard (in my case via Bluetooth) suppresses the on-screen keyboard, so that is surprising.

Also the editor has only 40 columns with no sideways scrolling.
The touchide editor isn't limited to 40-columns, and scrolls horizontally if you either type past the right-hand edge of the screen, or move the text caret that far using the right-arrow key on the keyboard.  I appreciate that there's no direct keyboard control of horizontal scroll, only the automatic scroll which keeps the caret 'in view', but I'm confused by your comment otherwise.

Richard.

Richard Russell
 

On Sun, Feb 4, 2018 at 03:15 am, Paul Marshall wrote:
the Android on-screen keyboard also appears and it is not possible to get rid of it
Although this is apparently a bug in the TV's version of Android (I've confirmed that my phone suppresses the OSK when an external keyboard is connected) one workaround would be to choose a key that is otherwise unused by touchide.bbc (if there is one) and arrange for it to call the SDL_StopTextInput API.  You could then press that key to remove the on-screen keyboard as and when required.

Richard.

Paul Marshall
 

I am aware it should scroll right as one continues to type and I can position the caret with the mouse and type and it does indeed scroll when the right hand side is reached. But the cursor keys do not move the caret. They behave the same as the control pad on the remote control. Hence the cursor keys change the selected character on the on-screen keyboard. Most odd!    Other keys like tab, BS, return behave as they should for a keyboard and not as per the remote.   The cursor keys generate codes 136-139 according to about.bbc. 

Richard Russell
 

On Mon, Feb 5, 2018 at 01:53 am, Paul Marshall wrote:
Hence the cursor keys change the selected character on the on-screen keyboard.
Oh, I see.  That's presumably a side-effect of the OSK continuing to be displayed when it shouldn't be.   If you're happy to try modifying touchide.bbc itself, first make a copy (any changes you make to the distributed touchide will be wiped every time you restart BBC BASIC) and add some code that will do a SYS "SDL_StopTextInput" on receipt of a specific keycode that you can generate from the keyboard (e.g. a function key).  That should allow you to close the OSK on demand.

Hopefully once the OSK is no longer displayed the cursor keys will resume their normal function.   If that works I will incorporate the mod in the distributed version.

Richard.

Paul Marshall
 

thanks i will try that.  Is there a mod i can do to make the display 80 columns? I've looked at touchide.bbc but not managed to figure it out.

Richard Russell
 

On Mon, Feb 5, 2018 at 08:41 am, Paul Marshall wrote:
Is there a mod i can do to make the display 80 columns?
It's not set to any specific initial number of columns; it will depend on the display resolution.  If yours is working out at 40 columns it's a fluke, not by design.  On a touch screen you can use the standard 'pinch' zoom gesture to change the font size (it is 'touchide' after all).  There's no keyboard control - indeed there isn't in BB4W either - but no doubt that could be added if a suitable combination of keys can be found.

Richard.

Paul Marshall
 

I'm looking at the possibility of zooming with f1 and f2 in place of pinching or  to add a zoom % option to the long-press menu. 

I could not get  SDL_StopTextInput to work at removing the onscreen keyboard. I have found though that by switching from 'leanback' to 'Multilingual'  onscreen keyboard it works as it should. 

Richard Russell
 

On Tue, Feb 6, 2018 at 03:50 am, Paul Marshall wrote:
I'm looking at the possibility of zooming with f1 and f2 in place of pinching or  to add a zoom % option to the long-press menu. 
I would prefer the former; adding an item to the 'touch' menu which isn't needed when using touch control isn't desirable.

The function key approach is easier to implement too.  To use f2 and f3 (f1 is currently reserved as 'return to menu' if you get stuck in immediate mode) is as simple as adding this code to both of the key-code CASE statements:

          WHEN 146: Zoom% -= 1001
          WHEN 147: Zoom% += 1001

I'll modify my master version accordingly.

Richard.

Richard Russell
 

On Tue, Feb 6, 2018 at 04:15 am, Richard Russell wrote:
To use f2 and f3 (f1 is currently reserved as 'return to menu'
Or would you rather use f2 and f4 to keep f3 available for potential future use as 'Find Next'?

Richard.

Paul Marshall
 

On Tue, Feb 6, 2018 at 04:35 am, Richard Russell wrote:
keep f3 available for potential future use as 'Find Next'?
Definitely!  f2 and f4 dont sit well so maybe f4 & f5. 

Ideally I would like to be able to set a default font size. My quick workaround is :
        IF (@platform% AND &FF) = 3 THEN
          GUIFont$ = FNgetINIstring(CFGfile$, "guifont", "FreeSans,48")
          EditFont$ = FNgetINIstring(CFGfile$, "editfont", "FreeMono,48")
to change 48 to 24 then the font size is a comfortable 80 (a guess)  columns.

I had failed so far because i was changing Zoom% by 1 or -1. Will try again.
 

Richard Russell
 

On Tue, Feb 6, 2018 at 05:59 am, Paul Marshall wrote:
Definitely!  f2 and f4 dont sit well so maybe f4 & f5. 
The trouble with that idea is that if you want to reserve f3 for 'Find Next' why wouldn't you want to reserve f5 for 'Step Line' and f6 for 'Run to Cursor' and the rest?  The only 'spare' function keys - i.e. not already allocated to functions in BB4W and the desktop versions of BBCSDL - are f2, f4, f11 and f12 (and f11, f12 are mirrored by Shift+Tab and Ctrl+Home).

Perhaps you might want to consider f2 for zoom out and Shift+f2 for zoom in, or some similar combination that only 'uses up' one function key.

Ideally I would like to be able to set a default font size.
Why, given that the size is remembered?  Once you've set it to your preferred zoom it will, of course, start the same way every time.

Richard.

 

On Tue, 6 Feb 2018, at 14:09, Richard Russell wrote:
On Tue, Feb 6, 2018 at 05:59 am, Paul Marshall wrote:


Definitely!  f2 and f4 dont sit well so maybe f4 & f5. 
The trouble with that idea is that if you want to reserve f3 for 'Find
Next' why wouldn't you want to reserve f5 for 'Step Line' and f6 for
'Run to Cursor' and the rest?  The only 'spare' function keys - i.e. not
already allocated to functions in BB4W and the desktop versions of
BBCSDL - are f2, f4, f11 and f12 (and f11, f12 are mirrored by Shift+Tab
and Ctrl+Home).

Perhaps you might want to consider f2 for zoom out and Shift+f2 for zoom
in, or some similar combination that only 'uses up' one function key.
I've used systems in the past where one F-key acted as a sort of toggle, and
each time you pressed it the definitions on a range of other F-keys were
changed from, say, set 2, to set 3. Shift- might decrement the set number.

I tended then to organise sets of key definitions around types of activity.

--
Jeremy Nicoll - my opinions are my own.

Richard Russell
 

On Tue, Feb 6, 2018 at 07:02 am, Jeremy Nicoll wrote:
I've used systems in the past where one F-key acted as a sort of toggle, and
each time you pressed it the definitions on a range of other F-keys were
changed from, say, set 2, to set 3.
That only makes sense if the function keys are labelled, so that you can see what their current functions are.  That doesn't apply in this case.  May I ask if you have actually installed and run BBC Basic on an Android device?   It's not a suggestion I would have expected if you have.

Richard.

Paul Marshall
 

On Tue, Feb 6, 2018 at 06:09 am, Richard Russell wrote:
 why wouldn't you want to reserve f5 for 'Step Line' and f6 for 'Run to Cursor' and the rest? 
I didnt think about, i dont use those keys whereas f3 is widely used in many programs for Find Next and I use it all the time.
Perhaps you might want to consider f2 for zoom out and Shift+f2 for zoom in, or some similar combination that only 'uses up' one function key.
One nice possibility would be CTRL - Mousewheel which zooms several programs I use regularly. The trouble with f keys is knowing that the functions are there.
Ideally I would like to be able to set a default font size.
Why, given that the size is remembered? 
I didnt know that until today when I saw CFGfile$ !

Anyway           WHEN 146: Zoom% +=1001
            WHEN 148: Zoom% -=1001
works, thank you.

Richard Russell
 

On Tue, Feb 6, 2018 at 09:14 am, Paul Marshall wrote:
One nice possibility would be CTRL - Mousewheel which zooms several programs I use regularly.
I thought we were discussing keyboard control.  Mouse control is an entirely different kettle of rodents, and I don't even know whether you can detect mousewheel events in Android.  Simple mouse actions, such as clicks and drags, work because they map to touchscreen gestures, but that's not necessarily the case with the wheel.  Since I don't own a Bluetooth mouse myself I can't do the test.

If you do find that you can detect the mousewheel then of course mapping it in the way you suggest is fine, but that doesn't resolve the problem of how to change the zoom from the keyboard.   I'm sure a lot of people have Bluetooth keyboards, like I have, that can be used with an Android device, and being able to control the zoom is just as valuable for them.  I hardly need say that any modifications I may make to touchide in the next release are not for you, they are for everybody!

I didnt know that until today when I saw CFGfile$ !
In the instructions for touchide it says: "A pinch changes the size of the font. The new size will be remembered in subsequent sessions".  I make no apologies for assuming that if you're making modifications to the program you will have read the help documentation first!

Richard.

Richard Russell
 

So that I can 'put it to bed' I've made f2 'zoom out', Shift+f2 'zoom in' and implemented Ctrl+mousewheel when running in Windows, Linux or Mac OS (not that you would normally run touchide on a desktop machine, but you can).  I have no idea whether the Ctrl+mousewheel will work in Android.

Richard.

Mark Hannah <mark-hannah@...>
 


Hi I purchased BBC4W when it first became available as I was interested in web data scraping and thought I could extract data from web elements using BBC code. I have since discovered  Python and Ruby do this. I would like to web scrape using BBC as I don't want o learn a new programming language at this time. Can you tell me if data scraping web pages is possible using BBC4W and if so can you provide a link to tutorials.

Thanx

I have been using Autohotkey com objects to achieve this thus far:-

eg..

Var:= pwb.document.getElementsByClassName("tv-symbol-header-quote__value tv-symbol-header-quote__value--large js-symbol-last")[0].innerText

all help to do this via BBC4W would be much appreciated

Mark.



From: bb4w@groups.io <bb4w@groups.io> on behalf of Paul Marshall <paulmarshall2020@...>
Sent: 06 February 2018 17:03
To: bb4w@groups.io
Subject: Re: [bb4w] BBC BASIC for SDL 2.0 v0.20a released
 
On Tue, Feb 6, 2018 at 06:09 am, Richard Russell wrote:
 why wouldn't you want to reserve f5 for 'Step Line' and f6 for 'Run to Cursor' and the rest? 
I didnt think about, i dont use those keys whereas f3 is widely used in many programs for Find Next and I use it all the time.
Perhaps you might want to consider f2 for zoom out and Shift+f2 for zoom in, or some similar combination that only 'uses up' one function key.
One nice possibility would be CTRL - Mousewheel which zooms several programs I use regularly. The trouble with f keys is knowing that the functions are there.
Ideally I would like to be able to set a default font size.
Why, given that the size is remembered? 
I didnt know that until today when I saw CFGfile$ !

Anyway           WHEN 146: Zoom% +=1001
            WHEN 148: Zoom% -=1001
works, thank you.