Puffergas
Posts: 83
Joined: Thu Dec 19, 2019 12:16 am

Re: Introduction to BBC BASIC

Sat Apr 11, 2020 11:52 pm

Rust does look interesting and it will install on the Pi. Isn't it still lacking in the UI/GUI area?

https://www.rust-lang.org/

https://www.makeuseof.com/tag/getting-s ... pberry-pi/

Heater
Posts: 15845
Joined: Tue Jul 17, 2012 3:02 pm

Re: Introduction to BBC BASIC

Sun Apr 12, 2020 5:52 am

Puffergas wrote:
Sat Apr 11, 2020 11:52 pm
Rust does look interesting and it will install on the Pi. Isn't it still lacking in the UI/GUI area?
I think that is a discussion for a whole other thread, or even other forum. This is a BBC BASIC thread.
Memory in C++ is a leaky abstraction .

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Sun Apr 12, 2020 11:24 am

Heater wrote:
Sun Apr 12, 2020 5:52 am
I think that is a discussion for a whole other thread, or even other forum. This is a BBC BASIC thread.
You saved me the trouble, thanks, although it's legitimate to discuss other languages in a 'comparative' fashion (e.g. how does it differ from BBC BASIC and which is better?). Several of the extensions to BBC BASIC over the decades have been motivated by recognising shortcomings compared with other languages.

But I still think the strengths of BBC BASIC lie more in its cross-platform support for 2D and 3D graphics, network access, sound and music etc. than in the language itself. Relatively few other languages, even today, allow you to incorporate those kinds of features in a way that is fully compatible with all the common desktop and mobile platforms. Cross-platform support for the Box2D physics engine has recently been added.

Heater
Posts: 15845
Joined: Tue Jul 17, 2012 3:02 pm

Re: Introduction to BBC BASIC

Sun Apr 12, 2020 4:03 pm

I'm all for programming language comparisons. As you may have noticed...

But comparing BBC BASIC to something like Rust is like comparing a language to an operating system. They are very different things. BBC BASIC is not just the language, it's the whole environment, framework, whatever one may call it.

That could of course be done with pretty much any language. For one reason or another it is not.

The whole kit and kaboodle of things like BBC BASIC, are great for many purposes.

A bare language, like C or Rust is great for others.
Memory in C++ is a leaky abstraction .

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Sun Apr 12, 2020 5:32 pm

Heater wrote:
Sun Apr 12, 2020 4:03 pm
BBC BASIC is not just the language, it's the whole environment, framework, whatever one may call it.
If you look across the spectrum of BBC BASIC versions, over the last 38 years, (and there have been a lot of them!) there has been no attempt at standardisation of the "environment" or "framework", it's only the language which has remained more-or-less constant over that period. So from that perspective BBC BASIC is "just" the language.

It's true that latterly, and I only mean in the last five years or so, I have attempted to provide a more uniform IDE experience across the range of supported platforms, which is probably why you made that comment. But it's still very different from, say, Matrix Brandy BASIC (another 'modern' and actively supported version of BBC BASIC) which has a more traditional 'command line' style interface.

So, yes, the consistency of the environment/framework is important for 'my' versions of BBC BASIC but it's not inherent in the language. You can always separate out the 'interpreter' or 'run-time engine' and use it independently of the IDE.

Puffergas
Posts: 83
Joined: Thu Dec 19, 2019 12:16 am

Re: Introduction to BBC BASIC

Sun Apr 12, 2020 8:48 pm

It sounds and looks like, making a simple GUI with BBC BASIC would be easier than with RUST? (Rephrased my question, sorry.)

For a computer, I only own Pi's and have a few Android devices. Will the BBC BASIC, for the Pi, compile a BBC BASIC script like the BBC BASIC for Windows will compile for the Windows OP? I do understand the difference from a C compiler and an interpreter style compiler scheme.

Will the Pi version generate an app for the Android devices?

Thanks !

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Sun Apr 12, 2020 9:20 pm

Puffergas wrote:
Sun Apr 12, 2020 8:48 pm
Will the BBC BASIC, for the Pi, compile a BBC BASIC script like the BBC BASIC for Windows will compile for the Windows OP?
Generic Linux doesn't have the concept of 'standalone app' in quite the way that Windows, MacOS and Android do, so when you bundle a BBC BASIC program for Linux what actually gets built is a Zip file. Accordingly it's a little more 'labour intensive' to install such an app than it would be on the other platforms, but Linux users are quite used to needing to do more work (it's not unusual for an app to need to be compiled)!
Will the Pi version generate an app for the Android devices?[
The tool for generating an Android app from a BBC BASIC program (BBC2APK) currently only runs on Windows. You could certainly develop and test the BASIC program on the Pi, but the final step of generating an APK file would need a PC, sorry. It's not out of the question that the tool could be ported to Linux (it is itself a BBC BASIC program) but it's not something on my 'to do' list at the moment.

Puffergas
Posts: 83
Joined: Thu Dec 19, 2019 12:16 am

Re: Introduction to BBC BASIC

Sun Apr 12, 2020 11:09 pm

That is all good !

BBC BASIC it is...

I am amazed that one person could achieve a project of this size. Even working on it for 20 years. Amazing ! ! !

Heater
Posts: 15845
Joined: Tue Jul 17, 2012 3:02 pm

Re: Introduction to BBC BASIC

Mon Apr 13, 2020 5:43 am

RichardRussell wrote:
Sun Apr 12, 2020 5:32 pm
So, yes, the consistency of the environment/framework is important for 'my' versions of BBC BASIC but it's not inherent in the language.
I would expect nothing more. Consistency is a not a strong point across the world of languages with "BASIC" in their name.
Memory in C++ is a leaky abstraction .

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Mon Apr 13, 2020 8:44 am

Puffergas wrote:
Sun Apr 12, 2020 11:09 pm
I am amazed that one person could achieve a project of this size. Even working on it for 20 years. Amazing ! ! !
To be fair, it's more like 38 years since I wrote the Z80 version of BBC BASIC (helped by knowledge I gained of the original 6502 version, partly from its author Sophie Wilson). It would not be difficult to identify code in my current BBC BASICs (even in the latest C version) which has a direct descent from that Z80 version.

As far as writing GUI programs is concerned, unfortunately that aspect of BBC BASIC for SDL 2.0 is poorly documented. It's quite similar to the GUI features of BBC BASIC for Windows but not sufficiently so that one can follow the same documentation (BB4W's GUI features leverage Windows' native libraries, whereas BBCSDL uses plain BBC BASIC graphics for portability).

The supplied example program dlgdemo.bbc (in the examples/general/ directory) shows the basics of how to create a dialog(ue) box, and a few of the other examples have GUI features (notably SkyBaby.bbc in the same directory) so their code can be examined for ideas. Of course the 'ultimate' example of a GUI written in BBC BASIC is the (my) IDE itself: SDLIDE.bbc in examples/tools/; but that's more than 4,000 lines of BASIC code and probably not something that a beginner will want to delve into!

So if you do need guidance don't hesitate to ask here or at the BBC BASIC forum.

Puffergas
Posts: 83
Joined: Thu Dec 19, 2019 12:16 am

Re: Introduction to BBC BASIC

Wed Apr 15, 2020 4:43 pm

It will be some time before I need help, because of other projects and time learning BBC BASIC. Thanks !

I will try to use it to make flight instruments that work with a flight simulator. Your clock program is encouraging, because that is how many flight gauges/instruments are modeled. The main computer would transfer flight data, over WiFi, to the instrument and user events would be transferred from the instrument to the main computer.

Thanks.

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Wed Apr 15, 2020 5:25 pm

Puffergas wrote:
Wed Apr 15, 2020 4:43 pm
Your clock program is encouraging, because that is how many flight gauges/instruments are modeled.
Bear in mind that if performance is important then you'll probably be wanting to use something more efficient than the pixel-at-a-time processing that program uses. Leveraging SDL2's hardware-accelerated graphics (e.g. via the imglib.bbc library) could probably achieve a 100-fold speed improvement!

Some award winning video games have been written in BBC BASIC but they don't draw their graphics one pixel at a time. :D

Puffergas
Posts: 83
Joined: Thu Dec 19, 2019 12:16 am

Re: Introduction to BBC BASIC

Wed Apr 15, 2020 9:17 pm

RichardRussell wrote:
Wed Apr 15, 2020 5:25 pm
Puffergas wrote:
Wed Apr 15, 2020 4:43 pm
Your clock program is encouraging, because that is how many flight gauges/instruments are modeled.
Bear in mind that if performance is important then you'll probably be wanting to use something more efficient than the pixel-at-a-time processing that program uses. Leveraging SDL2's hardware-accelerated graphics (e.g. via the imglib.bbc library) could probably achieve a 100-fold speed improvement!

Some award winning video games have been written in BBC BASIC but they don't draw their graphics one pixel at a time. :D
OK.

I saw the artwork of the face of the clock and that is normal idea for say an altitude gauge. Then there would be art work for the needles and they would rotate at one end. Now that you mentioned the above; that explains why there was no art work for the needles. I did see in the manual that there were sprites. Maybe they could be used for modeling knobs and other objects. Not sure if a program would know if a sprite was clicked on. Anyhow, sounds like a blast of excitement. Just lacking the time right now.

Thanks !

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Wed Apr 15, 2020 9:56 pm

Puffergas wrote:
Wed Apr 15, 2020 9:17 pm
Now that you mentioned the above; that explains why there was no art work for the needles.
There's hour.bmp and minute.bmp, both in the examples/graphics/ folder; don't they count as "artwork"?
I did see in the manual that there were sprites.
Possibly that was the BBC BASIC for Windows manual. BBC BASIC for SDL 2.0 doesn't have sprites in quite the same way, but it does support SDL2's textures which are comparable to sprites in many ways.
Maybe they could be used for modeling knobs and other objects.
Certainly I would recommend modelling any movable indicators like knobs and pointers as textures (typically stored as PNG files with a linear alpha channel for best quality). This is abstracted away in the imglib.bbc library (available for both BB4W and BBCSDL).
Not sure if a program would know if a sprite was clicked on.
Really you only have a choice of testing it 'geometrically' (i.e. by calculation, perhaps approximating the sprite outline to a polygon or ellipse) or by giving the sprite a distinct RGB value which you can test. The latter isn't altogether satisfactory if the sprite is photo-realistic and/or antialiased.

Puffergas
Posts: 83
Joined: Thu Dec 19, 2019 12:16 am

Re: Introduction to BBC BASIC

Thu Apr 16, 2020 11:32 pm

RichardRussell wrote:
Wed Apr 15, 2020 9:56 pm

There's hour.bmp and minute.bmp, both in the examples/graphics/ folder; don't they count as "artwork"?
I missed that.
Not sure if a program would know if a sprite was clicked on.
RichardRussell wrote:
Wed Apr 15, 2020 9:56 pm
Really you only have a choice of testing it 'geometrically' (i.e. by calculation, perhaps approximating the sprite outline to a polygon or ellipse) or by giving the sprite a distinct RGB value which you can test. The latter isn't altogether satisfactory if the sprite is photo-realistic and/or antialiased.
I could just use two dialog window buttons, one for clockwise rotation and one for counter clockwise rotation.
Possibly that was the BBC BASIC for Windows manual. BBC BASIC for SDL 2.0 doesn't have sprites in quite the same way, but it does support SDL2's textures which are comparable to sprites in many ways.
Yes, that was the download manual that I found. Is this the best manual to use for the Raspberry Pi BBC BASIC for SDL 2.0 (below:) ?
http://www.bbcbasic.co.uk/wiki/doku.php?id=manual

Thanks !

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Fri Apr 17, 2020 1:06 am

Puffergas wrote:
Thu Apr 16, 2020 11:32 pm
Is this the best manual to use for the Raspberry Pi BBC BASIC for SDL 2.0?
The 'official' URL (which is where the Help menu in BBC BASIC itself takes you) is here, but that is currently virtually identical to the BBC BASIC for Windows manual and barely mentions the differences in BBC BASIC for SDL 2.0. Hopefully this will improve over time. The separate differences document does say (in section 6a) that the SPRITELIB library is not available in BBCSDL.

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Fri May 08, 2020 5:16 pm

I've released version 1.12a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android and iOS. The changes in this version are as follows:

  1. BASIC Interpreter / Run Time Engine

    Updated the MacOS edition (only) to SDL 2.0.12 to fix some graphical glitches.

    Enabled render batching in the iOS edition (deferred from 1.11a because of a compatibility issue).

    Improved the Windows edition's compatibility with the username containing non-ASCII characters.

  2. IDEs and Utilities

    In the SDLIDE file selector, starting to type the wanted filename scrolls the listbox.

    Updated BBCEdit to version 0.34.2 (thanks to Andy Parkes).

    Updated touchide to support copying-and-pasting entire directories.

    Fixed a memory leak in SDLIDE's Compile utility.

    When SDLIDE is used with BBC BASIC for Windows the Compile utility now works (it calls the BB4W compiler).

  3. Libraries

    Added the imglib library for rotating, scaling and flipping 2D images efficiently (a highly compatible library is also available for BBC BASIC for Windows).

    Modified the filedlg library so that starting to type the wanted filename scrolls the listbox.

    Added FN_utf8_to_ansi() and FN_ansi_to_utf8() functions to the utf8lib library.

    Fixed a bug in the box2dgfx library affecting non-zero y-origin values when PROC_gfxMatrix is used.

  4. Example Programs

    Added bbclock.bbc (in examples/physics), a graphical Box2D simulation of a 'Ball Bearing Clock'. This program is compatible with BBC BASIC for Windows if the Box2D libraries are installed.

    Added dunebuggy.bbc (in examples/physics), a Box2D demo of a vehicle with sprung suspension. This program is compatible with BBC BASIC for Windows if the Box2D libraries are installed.

    Added kerning.bbc (in examples/general/) to demonstrate the effect of kerning. This program is compatible with BB4W.

    Modified aliens.bbc to use the new imglib library; this also makes it compatible with BB4W, but without hardware acceleration it runs only slowly.

    Fixed a bug in SkyBaby.bbc affecting some editions (e.g. Android but not Windows), caused by a surprising anomaly in the 'asctime' and 'mktime' C runtime library routines.
This new version may be downloaded, for all the supported platforms, from the usual location. The GitHub repository has been updated (used to build the MacOS, Raspbian, iOS and 64-bit Linux editions, currently).
Last edited by RichardRussell on Sat May 09, 2020 12:48 pm, edited 1 time in total.

ejolson
Posts: 5215
Joined: Tue Mar 18, 2014 11:47 am

Re: Introduction to BBC BASIC

Fri May 08, 2020 6:20 pm

RichardRussell wrote:
Fri May 08, 2020 5:16 pm
This new version may be downloaded, for all the supported platforms, from the usual location. The GitHub repository has been updated (used to build the MacOS, Raspbian, iOS and 64-bit Linux editions, currently).
Thanks for making this open source and continuing to improve it. Stay well.

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Fri Jun 19, 2020 4:38 pm

I've released version 1.13a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android and iOS. The changes in this version are as follows:

  1. BASIC Interpreter / Run Time Engine

    Implemented VDU 23,18,3,n| to enable or disable alpha/graphics black and secondary character set in MODE 7. It also 'fixes' the SAA5050 Hold Graphics bug.

    Implemented OSWORDs 139 & 140 (again!) to read and redefine the 'teletext' font (documented here).

    Reduced SOUND latency (which risks buffer underrruns on slow systems, but I hope is a better compromise).

    Setting bit 6 of *TEMPO changes the way the pitch envelope repeats to be more compatible with the BBC Micro (it's also now the default).

    Fixed a bug affecting 'scrolling' of one-row-high text viewports (64-bit and ARM editions only).

  2. IDEs and Utilities

    SDLIDE: When loading an Acorn-format tokenised program, 2-byte tokens are automatically converted to their 1-byte equivalent (if any).

    SDLIDE: The file selector now uses smooth scrolling.

  3. Libraries

    Added classlib for Object Oriented Programming, compatible with the BB4W library.

    Added mode7lib to support multiple character sets in MODE 7 (the primary and secondary character sets may be selected from English, German, Swedish, Belgian, Italian, Hebrew, Russian, Greek or US ASCII).

    Modified dlglib and filedlg to support smooth scrolling of listboxes.

  4. Example Programs

    Added sortdemo.bbc (in examples/general) which is a graphical demonstration of six different sorting algorithms, adapted from a QuickBasic program.

    Added a page to mode7dem.bbc to demonstrate alpha/graphics black and the secondary character set.

    Tweaked bbclock.bbc to improve its reliability (previously it could misbehave after running for a few hours).

    Fixed telstar.bbc which was partially broken by the change of the MODE 7 font in v1.11a.
This new version may be downloaded, for all the supported platforms, from the usual location. The GitHub repository has been updated (used to build the MacOS, Raspbian, iOS and 64-bit Linux editions, currently).

Please remember that if you use the BBC2APK Android Application Generator you should download a new APK template to ensure that any updates to the run-time engine are incorporated in your own apps.

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Sun Jun 28, 2020 9:08 pm

New: Console Mode editions of BBC BASIC

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 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.

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Mon Jun 29, 2020 1:34 pm

RichardRussell wrote:
Sun Jun 28, 2020 9:08 pm
Supplied with the executables are a small number of BBC BASIC demo programs.
Here's one of those programs, 8queens.bbc, running in the Windows 10 console (there's a minor issue if you try this in Raspbian because the standard terminal seems not to support the console_resize command; you may need to manually enlarge it ):
queens_console_win64.png
queens_console_win64.png (64.19 KiB) Viewed 423 times

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Tue Jun 30, 2020 7:46 pm

I have updated the Console Mode editions of BBC BASIC to version 0.11. The differences in this version are:

  • Fixed a bug which made it fussy about the directory from which it was run.
  • DELETE with no explicit line-number range is no longer accepted.
  • LIST IF is implemented (as it always should have been).
The updated version may be downloaded from the same place as before:


User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Wed Jul 01, 2020 9:24 pm

Now updated to v0.12. The differences are:

  • On exit, a 'reset' escape sequence is sent only if stdout appears to be a terminal.
  • VDU 30,8 (home, left) now causes a scroll-down as it should.

User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Fri Jul 03, 2020 4:38 pm

I have updated the Console Mode editions of BBC BASIC to version 0.13. The differences in this version are:

  • LISTIF is accepted (i.e. without a space, as other versions do).
  • RENUMBER now works even if only some lines are numbered.
  • New demo program 'chess.bbc' added (adapted from QBasic).
  • Demo program 'speed.bbc' modified to be more honest!
The updated version may be downloaded from the same place as before:


User avatar
RichardRussell
Posts: 646
Joined: Thu Jun 21, 2012 10:48 am

Re: Introduction to BBC BASIC

Sun Jul 05, 2020 8:48 pm

I have updated the Console Mode editions of BBC BASIC to version 0.15.

The main difference in this version is that the keyboard input routine has had a major revision. The effect in Linux and MacOS is that the function keys etc. now return the expected codes (and can be redefined using *KEY). The effect in Windows (in which the function keys always worked) is that the input really is taken from STDIN rather than directly from the keyboard, so it may be fed from a file or pipe etc.

Also, in the Linux and MacOS editions (only) UTF-8 mode is automatically set, because the keyboard returns (and the terminal expects) UTF-8 encoded text on those platforms. Please note however that if you use the VDU 23,22... custom mode command it will override that setting.

Version 0.15 may be downloaded from the usual place:


Return to “Other programming languages”