Date   

Re: Cruncher thoughts

Norman Vingoe
 

This kind of conversation does interest me; as a suggestion could the cruncher automatically assign fast variable names to the most frequently used variables first ie.accessed within loops, or build a table of variable names that is sorted by access frequency (as far as that can be determined before runtime)? 

Re: Cruncher thoughts

Richard Russell
 
Edited

On Mon, Sep 24, 2018 at 10:03 PM, J.G.Harston wrote:
I'll put the kettle on and have a think.
You need a faster kettle!  A few more points to inform the discussion:

  1. Structure members cannot be 'fast variables' - neither BB4W nor BBCSDL supports that - and the current BB4W cruncher doesn't distinguish between structure members and ordinary variables.  So you have to be careful not to specify in REM!Fast a variable that happens also to be the name of a structure member.  A cruncher which defaulted to using fast variables would have to avoid that situation automatically, but I don't think that's too difficult.
  2. The maximum number of 'fast variables' is limited to a few tens of thousands (the exact number depends on the mix of variable types) which could be exceeded in a large program.  The cruncher could, in principle, switch to using conventional short names if the limit was reached.
  3. Fast variables always 'exist': for example on a CLEAR the value of the variable will be zeroed but attempting to access it won't result in a 'No such variable' error.  This could introduce an incompatibility if a program has been written in such a way that it relies on that error (unlikely, but not impossible).  The programmer could specify any variables of that sort in a REM!Keep directive.
If this isn't the sort of thing you find interesting and would rather I didn't post about it, please let me know.  Normally I would prefer to raise such highly technical matters at the forum, because there you can individually 'subscribe' to a topic rather than having it forced on you by appearing in your inbox.  But that isn't an option for me at the moment, unless and until there's a change of heart there.

Re: Cruncher thoughts

J.G.Harston
 

On 24-09-2018 17:08, Richard Russell wrote:
The question is: is this sensible?
Hmm. Interesting question. I'll put the kettle on and have a think.


--
J.G.Harston - jgh@... - mdfs.net/jgh

Cruncher thoughts

Richard Russell
 

The BB4W cruncher, which is fully enabled by default when you 'compile' a program, aggressively shortens variable (and array, structure, PROC/FN) names - because shorter names are looked up more quickly - and distributes them evenly across the alphabet - to maximise the benefit of the variable linked-lists being indexed by initial letter.  But what it doesn't do is take advantage of the 'fast variable' capability unless you specifically ask it to, and you can only do that on an individual variable (etc.) basis by listing them in one or more REM!Fast directives.

This is arguably inconsistent, because fast variables typically provide an even greater speed benefit than can be achieved by shortening the names.  The reason is largely pragmatic: fast variables were introduced relatively recently (just over seven years ago!) and such a major change to the working of the cruncher would risk the introduction of multiple bugs, especially given the deterioration in my mental faculties.  Over the years a large number of obscure special cases have been discovered that caused the cruncher to fail, and it has taken a long time and multiple releases to squash them (assuming there are none left)!

But currently BBC BASIC for SDL 2.0 has no cruncher; the only circumstance in which a BBCSDL program gets crunched is if you use the BBC2APK Android Application Generator, which utilises the BB4W cruncher (and thus needs REM!Fast directives if you want to take advantage of fast variables).  It would be useful to have a cruncher written in BASIC (hence portable across the range of supported platforms) and this would provide an opportunity to re-think the methodology by, for example, using fast variables by default rather than only when requested by the programmer.

The question is: is this sensible?  Would the potential benefits of using fast variables outweigh the risks of such a radical change to the way crunching is done?  Once upon a time I would have trusted my own judgement about such technical decisions, but I know that now it cannot be trusted (as evidenced by the stupid mistakes I find myself making all the time).  So I open up the discussion to members of this group, whom I am confident are, collectively, better able to assess the pros and cons than I am.

Re: BBC BASIC for Windows version 6.12a released

Dagfinn
 

Congratulations on the new version, Richard!

 

I installed the Upgrade, and tried the new sound programmes – worked great! Nice soldiers 😊

 

Best regards,

Dagfinn

 

Sendt fra E-post for Windows 10

 

 

Fra: Richard Russell
Sendt: lørdag 22. september 2018 kl. 22:25
Til: bb4w@groups.io
Emne: [bb4w] BBC BASIC for Windows version 6.12a released

 

It is with some trepidation that I announce the release of BBC BASIC for Windows version 6.12a.  This is a maintenance release, the primary purpose of which is to update BB4W to a similar specification to BBCSDL v0.24a, to facilitate portability of programs and libraries.  You can update your copy by downloading and installing upgrade.exe (for the full version) or bbcwdemo.exe (trial version).  The new and changed features in v6.12a are as follows:

Interpreter:

  1. PTR(string$) supplies the memory address of a string; it returns the same value as !^string$ but is compatible with 64-bit versions of BBC BASIC.
  2. The SYS statement can return a floating-point ('double') value by specifying a 64-bit float variable (var#) after the TO.
  3. The <<< operator performs a full 64-bit left shift irrespective of the *HEX mode currently in effect.
  4. INT(number) now returns an 'integer variant' rather than an 'integer float' (when possible).

Libraries:

  1. ODBCLIB (for accessing databases) and UTF8LIB (for UTF-8 strings) are added.
  2. SOCKLIB has been enhanced to support UDP (User Datagram Protocol) sockets.

Example programs:

  1. CLIENT.BBC, SERVER.BBC and LANCHAT.BBC have been added in the GENERAL folder.
  2. ENTERTAINER.BBC and SOLDIERS.BBC have been added in the SOUNDS folder.

IDE and program editor:

  1. Edit... GoTo (shortcut Ctrl+G) allows you to jump directly to a specified program line.
  2. Context help is now displayed slightly lower, so it doesn't obscure the keyword it is referring to (requested by a user).

Compiler:

  1. A new directive REM!NoPrinter suppresses the default printer check, which can sometimes be very slow.
  2. REM!Fast now allocates enough space for 64-bit array and structure descriptors, in case the crunched program is run in iOS.

The changes to the interpreter are not entirely free of compatibility implications.  If a 'double' variable (# suffix) has previously been used to receive the integer result from a SYS call (very unlikely, but not impossible) then the program will require modification.  If the <<< operator has been used (perhaps by mistake) as a synonym for <<, the result could change depending on the initial values.  I would be surprised if anybody is affected by these issues, but it is as well to be aware of them.

 

BBC BASIC for Windows version 6.12a released

Richard Russell
 
Edited

It is with some trepidation that I announce the release of BBC BASIC for Windows version 6.12a.  This is a maintenance release, the primary purpose of which is to update BB4W to a similar specification to BBCSDL v0.24a, to facilitate portability of programs and libraries.  You can update your copy by downloading and installing upgrade.exe (for the full version) or bbcwdemo.exe (trial version).  The new and changed features in v6.12a are as follows:

Interpreter:
  1. PTR(string$) supplies the memory address of a string; it returns the same value as !^string$ but is compatible with 64-bit versions of BBC BASIC.
  2. The SYS statement can return a floating-point ('double') value by specifying a 64-bit float variable (var#) after the TO.
  3. The <<< operator performs a full 64-bit left shift irrespective of the *HEX mode currently in effect.
  4. INT(number) now returns an 'integer variant' rather than an 'integer float' (when possible).
Libraries:
  1. ODBCLIB (for accessing databases) and UTF8LIB (for UTF-8 strings) are added.
  2. SOCKLIB has been enhanced to support UDP (User Datagram Protocol) sockets.
Example programs:
  1. CLIENT.BBC, SERVER.BBC and LANCHAT.BBC have been added in the GENERAL folder.
  2. ENTERTAINER.BBC and SOLDIERS.BBC have been added in the SOUNDS folder.
  3. PYRAMID.BBC has been modified to create and save its own FVF files.
IDE and program editor:
  1. Edit... GoTo (shortcut Ctrl+G) allows you to jump directly to a specified program line.
  2. Context help is now displayed slightly lower, so it doesn't obscure the keyword it is referring to (requested by a user).
  3. The Help menu links to the Forum and Wiki have been updated following the demise of Conforums and Wikispaces.
Compiler:
  1. A new directive REM!NoPrinter suppresses the default printer check, which can sometimes be very slow.
  2. REM!Fast now allocates enough space for 64-bit array and structure descriptors, in case the crunched program is run in iOS.
The changes to the interpreter are not entirely free of compatibility implications.  If a 'double' variable (# suffix) has previously been used to receive the integer result from a SYS call (very unlikely, but not impossible) then the program will require modification.  If the <<< operator has been used (perhaps by mistake) as a synonym for <<, the result could change depending on the initial values.  I would be surprised if anybody is affected by these issues, but it is as well to be aware of them.

Re: Network server examples written in BBC BASIC (with exercises)

Richard Russell
 

On Fri, Sep 21, 2018 at 11:08 PM, Basil Morris wrote:
Found the programs and in the process of figuring it all out !!
The SOCKLIB library is documented here.

Re: Network server examples written in BBC BASIC (with exercises)

Basil Morris
 

Thanks Richard – I have it running on my Mac – Found the programs and in the process of figuring it all out !!

Thanks again for your help.

 

Basil

 

From: bb4w@groups.io [mailto:bb4w@groups.io] On Behalf Of Richard Russell
Sent: Friday, September 21, 2018 6:02 PM
To: bb4w@groups.io
Subject: Re: [bb4w] Network server examples written in BBC BASIC (with exercises)

 

On Fri, Sep 21, 2018 at 09:15 PM, Basil Morris wrote:

I will also take a crack at installing BBCSDL on my Mac.

It shouldn't be difficult, but you will need to override the 'cannot identify publisher' warning (right-click and select Open, I think).  This is Apple being silly again, because the MacOS edition of BBCSDL is signed, only with my personal Code Signing Certificate rather than one issued by Apple.  As such it's actually more secure, but try telling Apple that!

 

Virus-free. www.avg.com

 

Re: Network server examples written in BBC BASIC (with exercises)

Richard Russell
 

On Fri, Sep 21, 2018 at 09:15 PM, Basil Morris wrote:
I will also take a crack at installing BBCSDL on my Mac.
It shouldn't be difficult, but you will need to override the 'cannot identify publisher' warning (right-click and select Open, I think).  This is Apple being silly again, because the MacOS edition of BBCSDL is signed, only with my personal Code Signing Certificate rather than one issued by Apple.  As such it's actually more secure, but try telling Apple that!

Re: Network server examples written in BBC BASIC (with exercises)

Basil Morris
 

Thank you – I can wait until the next release of BB4W.  I will also take a crack at installing BBCSDL on my Mac.

 

Regards

Basil

 

From: bb4w@groups.io [mailto:bb4w@groups.io] On Behalf Of Richard Russell
Sent: Friday, September 21, 2018 4:04 PM
To: bb4w@groups.io
Subject: Re: [bb4w] Network server examples written in BBC BASIC (with exercises)

 

I am attempting to learn how this all works !

If you can hang on a little while, it is my intention to include the 'chat' Client and Server examples (based on those in the BBCSDL distribution) with the next release of BB4W.  Of course if you're running BBCSDL anyway (or are happy to) then those examples come with it as standard.  It rather depends on what kind of 'server' you are wanting to make.

 

Virus-free. www.avg.com

 

Re: Network server examples written in BBC BASIC (with exercises)

Richard Russell
 

I am attempting to learn how this all works !
If you can hang on a little while, it is my intention to include the 'chat' Client and Server examples (based on those in the BBCSDL distribution) with the next release of BB4W.  Of course if you're running BBCSDL anyway (or are happy to) then those examples come with it as standard.  It rather depends on what kind of 'server' you are wanting to make.

Re: Network server examples written in BBC BASIC (with exercises)

Basil Morris
 

Thank you for looking. Anything would be of use to me at this point. I am attempting to learn how this all works !

 

Regards

Basil

 

From: bb4w@groups.io [mailto:bb4w@groups.io] On Behalf Of Richard Russell
Sent: Friday, September 21, 2018 3:25 PM
To: bb4w@groups.io
Subject: Re: [bb4w] Network server examples written in BBC BASIC (with exercises)

 

On Fri, Sep 21, 2018 at 08:12 PM, Basil Morris wrote:

Would anyone happen to have these examples ? Were on Yahoo !

I've looked in the Yahoo! Files area but cannot find anything that exactly fits your description.  There's 'WebServer.zip', 'SimpleWebServer.bbc', 'DataServer.bbc' and 'EchoServer.bbc' but none of them seem to have any associated "exercises".  Would any of those be suitable?

 

Virus-free. www.avg.com

 

Re: Network server examples written in BBC BASIC (with exercises)

Richard Russell
 

On Fri, Sep 21, 2018 at 08:12 PM, Basil Morris wrote:
Would anyone happen to have these examples ? Were on Yahoo !
I've looked in the Yahoo! Files area but cannot find anything that exactly fits your description.  There's 'WebServer.zip', 'SimpleWebServer.bbc', 'DataServer.bbc' and 'EchoServer.bbc' but none of them seem to have any associated "exercises".  Would any of those be suitable?

Network server examples written in BBC BASIC (with exercises)

Basil Morris
 

Would anyone happen to have these examples ? Were on Yahoo !
Thanks in advance
Basil

Re: Isolating jigsaw puzzle pieces

 

Hi Richard,

All my software is specifically science-based. The TLCI stuff takes in spectral data files in many formats (around 20 so far), and does the analysis before showing the results (I can let you have all the code if you're interested, although only the exe version is available to normal users). There's no element of game-play about it, so many of the clever tricks used in games are simply of no interest to me. One person once asked if there was a version for the MAC, and he went away happy when I told him it would work on a MAC running Windows.

Many manufacturers of hand-held light meters have now implemented the algorithm for their top-end spectroradiometric meters. I have no idea what language they use, but they have all checked their results against mine and they agree to within the limitations of the less-than-ideal spectroradiometers they use.

So, that job is done. I've got a world-wide standard adopted, and manufacturers using it. I'm happy with that. The results are there for all to see (e.g. tech.ebu.ch/tlci-2012).

I take your point about SDL being wider than just games, and so it should be. But my TLCI software makes extensive used of Windows calls (5,367 SYS calls in the whole program of 50,051 lines in 24 files, 2.4M in total), particularly for dialog setup - the whole thing is controlled by menu and dialogs. The prospect of trying to rewrite all that in SDL is somewhat daunting). So any version of BB which doesn't do that is of little interest to me specifically.

BB4W rules, for me, at the present. But please keep on with the SDL, I agree that it's the future.

Alan Roberts

--
Alan Roberts - Mugswell, Surrey
+44 (0)1737832586
+44 (0)7749387934

Re: Isolating jigsaw puzzle pieces

Richard Russell
 

On Thu, Sep 20, 2018 at 10:14 AM, alan836975 wrote:
Agreed, but I can't see me ever getting interested in games, there's too much other stuff to do.
It's misleading to think of BBCSDL as being specifically or even primarily for games.  It is true that SDL, when it was first developed, was targeted at games development but since then (and especially in SDL 2.0) it's become much more of a 'platform independent operating system' with many general purpose features such as support for threads, files, timers and so on.  Even the graphics capabilities of SDL have a much wider application than games, for example CAD or VR.

And I have no smart phone or other portable computing kit, so SDL is a bit of a non-starter for me
BBCSDL runs very nicely in Windows, and some things are more easily achieved than they are in BB4W (an example being sprite rotation, which in BB4W means using the GFXLIB library - excellent but not for the faint-hearted!).  It's also the solution if you want your programs to run on other desktop OSes; I know you've developed some professional image processing and analysis tools in BBC BASIC; has nobody ever asked for a Mac version?

Re: Isolating jigsaw puzzle pieces

 

Richard wrote 'Which is fine, as far as it goes, but one day you may want to do something different.'

Agreed, but I can't see me ever getting interested in games, there's too much other stuff to do. And I have no smart phone or other portable computing kit, so SDL is a bit of a non-starter for me. I'm 73 now, and don't really want to start on another language, so if/when I need features that I haven't used, I'll investigate what BB4W can do and just get on with it, and be grateful that it's still there :-)

Alan Roberts

--
Alan Roberts - Mugswell, Surrey
+44 (0)1737832586
+44 (0)7749387934

Re: Isolating jigsaw puzzle pieces

Richard Russell
 

On Wed, Sep 19, 2018 at 09:52 AM, alan836975 wrote:
It's not that the techniques aren't interesting, it's just that I have no need for them in anything I do (I don't do games).
Which is fine, as far as it goes, but one day you may want to do something different.  If your familiarity with BBC BASIC 'as a whole' is poor you may end up either using an inefficient method or deciding it can't be done.  I would hope a BBC BASIC 'enthusiast' (and I like to think that's what most people here are) would take an interest in every aspect of the language, not just those that they happen to need in their own programs, and every supported platform, not just the one they mostly use (and, yes, I'm pointing my finger at those who have not yet bothered to install it on their phone or other mobile devices!).

Re: Isolating jigsaw puzzle pieces

 

I think you've hit the nail on the head there. Many of us use BB4W to do what we want, but don't fully explore the language.

For example, I don't use sound at all for anything I do, nor the techniques you're describing. It's not that the techniques aren't interesting, it's just that I have no need for them in anything I do (I don't do games). But BB4W has been my lifeblood for many years, having started on BBC BASIC in 1981 - and now the official EBU* software for calculating TLCI** from spectral data for luminaires (tech.ebu.ch/tlci-2012) is entirely written in BB4W. Without BB4W, I wouldn't have been able to develop the algorithm or get it adopted worldwide - for that I (and the world-wide television industry) have to thank Richard.

Alan Roberts

* EBU - European Broadcasting Union, think of Eurovision and so on.

** TLCI - Television Lighting Consistency Index, from an idea by W.N.Sproson of BBC R&D. The algorithm is now in common use around the world, and is being adopted by the SMPTE***.

*** SPMTE - Society of Motion Picture and Television Engineers - holds the world standards for all things radio/tv/film.

--
Alan Roberts - Mugswell, Surrey
+44 (0)1737832586
+44 (0)7749387934

Isolating jigsaw puzzle pieces

Richard Russell
 

Having explained to a couple of people how my jigsaw puzzle program (I hope everybody has tried it) isolates the individual pieces, the reaction makes me wonder whether the technique is as obvious to others as it was to me.   This, in a nutshell, is how it works:

  1. The picture is OR-ed with a small (and hopefully invisible) amount of blue using the appropriate background plotting mode:
          COLOUR 1,0,0,17
          GCOL 1,128+1
          CLG
  2. Having by that means ensured that the picture contains no 'black', anywhere, I draw the 'cut lines' in black.
  3. I can now isolate each individual piece by flood-filling all 8 adjacent pieces (assuming it isn't on the edge) using the 'fill to foreground' option.
  4. With the piece now surrounded by a uniform colour I can simply save it as a rectangular tile.
That's basically it, but there is a complication.  I want the piece to be surrounded by black, but obviously if I am flood-filling 'to black' I cannot at the same time fill 'with black'!  Instead I flood fill with a different colour (it doesn't matter what) and then I do another flood fill, this time using the 'fill to non-background' mode, to replace the other colour with black:

      GCOL 0 : REM Set the foreground colour to black
      GCOL 128+1 : REM Set the background colour to anything other than black
      PLOT 143,x%,y% : REM Flood fill to foreground with the background colour

      FILL x%,y% : REM flood fill to non-background with the foreground colour

The result is that the cut lines are (still) black, and the adjacent pieces have been flood-filled with black, so the piece that I want to isolate is now entirely surrounded by black!

I would hope that this approach is obvious, because the logical-plotting modes (AND, OR, XOR) and the flood-fill options are so key to BBC BASIC's graphics.  But the reaction I have received makes me wonder (and worry) that some people are not as familiar with these aspects of the language as they should be.