BBC Micro Utilities for Windows

Here you can talk about anything related to BBC BASIC, not covered in another category
Hated Moron

Re: BBC Micro Utilities for Windows

Post by Hated Moron »

DDRM wrote: Sun 02 Apr 2023, 21:48 Actually, I do! If I just want a quick computational solution to (or visualisation of) something, I nearly always go for BB4W.
Oh, I see, sorry. I'd gained the impression that you had been pretty much converted to Python by the necessity to use it for work. When I asked recently about trebuchet.bbc you commented that it was written a "while ago (looking at the files, almost exactly 10 years!)" and I guessed you hadn't done much 'challenging' BBC BASIC programming since.

But the fact remains that I don't know of anybody else who uses BBC BASIC the way I do, as the language of choice (indeed pretty much the only language I know) for all programming tasks, large or small. Apart from BBC BASIC itself, which is coded in C (translated from x86 assembler code) I've not written code in any other language for decades.

So it does mean that the great majority of the example programs supplied with BB4W and BBCSDL, the principal purpose of which is to illustrate the range of applications of which BBC BASIC is capable, don't have direct relevance to most users. How many people reading this can honestly say they have studied any of those programs to see how they work?

It's why I recently proposed an Adopt-an-Example-Program scheme, whereby some users would hopefully volunteer to take an interest in an example program, learn how it works and become a source of information and expertise for coding that kind of application. But like all my ideas for giving BBC BASIC a future after I've gone, it massively flopped.
User avatar
hellomike
Posts: 184
Joined: Sat 09 Jun 2018, 09:47
Location: Amsterdam

Re: BBC Micro Utilities for Windows

Post by hellomike »

For what it is worth, I certainly use BBC BASIC for all programming tasks, no exception. Although there aren't any large projects.

The most exposed project is maintaining and building my own website, dedicated to my score collection. The project consists of two main programs. One to grab all the data from a database and sort and move it around to generate all the static HTML pages and calculate the most recent 25 items. And the second program to publish (FTP_TRANSFER) all the updated pages, after the local version looks fine.
A third program I run individually to generate a background picture with random covers.

OK, it consists of one hand coded Javascript source to make the buttons and menu's work.

Texts are in Dutch, sorry.

Feel free to take a peek at www<dot>hellomike<dot>nl

Regards,

Mike
Ric
Posts: 200
Joined: Tue 17 Apr 2018, 21:03

Re: BBC Micro Utilities for Windows

Post by Ric »

I too only use BBC basic. I learned C and Fortran at university 30+ years ago, but never used them, generally couldn't be doing with the declarations and syntax!

Kind regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Re: BBC Micro Utilities for Windows

Post by KenDown »

I also use nothing but BB4W. At present my Display program is 11,216 lines of code and every time I use it I say a silent thanks to you.
User avatar
KaraTheValkyrie
Posts: 12
Joined: Sat 14 Jan 2023, 19:29

Re: BBC Micro Utilities for Windows

Post by KaraTheValkyrie »

Updated so that indentation is applied to FOR, REPEAT, WHILE, and CASE, and it respects EXIT REPEAT etc. It tries to change the indentation style automatically based on whether it is an Acorn format BASIC file, or BBC BASIC for Windows/SDL, as illustrated in this "not a real program" example:
> BBCBasicToText LOOPSSDL.BBC *.bbcode

BBCBasicToText found 1 file matching LOOPSSDL.BBC
Escape non-printable charaters: True

BBCBasicToText: processing 1/1, C:\Users\...\LOOPSSDL.BBC
BBCBasicToText Success: 1/1, C:\Users\...\LOOPSSDL.BBC, dialect WindowsOrSDL
Output: C:\Users\...\LOOPSSDL.BBC.bbcode

BBCBasicToText: processing 1/1, C:\Users\karal\OneDrive\Documents\BBCMicro\LOOPSSDL.BBC
   10 REM Test
   20 REPEAT
   30   FOR I%=1 TO 10
   40     PRINT ~TOP
   50   NEXT
   60   Pi = 3.14159
   70   I% = I%+1
   80   PRINT "Hello"
   90   IF I% > 20 GOTO   110
  100   GOTO   60
  110   END
  120   DATA 123
  130   CASE I% OF
  140     WHEN 0 : coin$ = "tails"
  150     WHEN 1 : coin$ = "heads"
  160     OTHERWISE coin$ = "cheat"
  170   ENDCASE
  180   SUM
  190   bool% = TRUE
  200   WHILEI% < 20
  210     PRINT "WHILE loop"
  220     IF bool% = TRUE THEN EXIT WHILE ELSE PRINT "No"
  230   ENDWHILE
  240 UNTIL FALSE
  250 IF TRUE
  260 PRINT "it is True"
  270 ENDIF
BBCBasicToText Success: 1/1, C:\Users\...\LOOPSSDL.BBC, dialect WindowsOrSDL
Output: C:\Users\karal\OneDrive\Documents\BBCMicro\LOOPSSDL.BBC.bbcode

The 1.0.30 version is at

https://img1.wsimg.com/blobby/go/8ec357 ... 0637148018

and the detached PGP signature is

-----BEGIN PGP SIGNATURE-----

iQFNBAABCAA3FiEEbRotVTbNBS5QuWqPWV58wKNDrqoFAmQrvUcZHGthcmFvdHRl
d2VsbEBvdXRsb29rLmNvbQAKCRBZXnzAo0OuqkSvB/9nuhW/mGczT2JCvSRsua4j
riuZq6J0CD/d/3vhouU0KfPc+/KjgM4f49iTC/kZeHILvcEpRC0KNAyzPDg5fUoW
1y87wDbLtm/ylp7bWBRjeoLo6UK3sEX7WSvrLlN0lu/R6wBGc2i7Bq6cj2b6KiB+
HVk2dNkKCHLcUUQJFsaPYTq3UmPjOG4mA2x8xST82riBEWIw005EPVGdzREAyhfm
7VxCE2MboVzD/UdMrrxBqK/37aP+r0xXAKRWogw1wyX1jNDZpEQFgSnL3yWm4m4B
vQ4JOcCbfMDG+iMOwbGsa1OobUcEN+jcRKCkoaSFOELUosjCos3nqzBoEoMlkGB5
=6j8V
-----END PGP SIGNATURE-----

Cheers

Kara
Hated Moron

Re: BBC Micro Utilities for Windows

Post by Hated Moron »

KaraTheValkyrie wrote: Tue 04 Apr 2023, 20:58 It tries to change the indentation style automatically based on whether it is an Acorn format BASIC file, or BBC BASIC for Windows/SDL
What do you mean by "indentation style" here? You won't see EXIT in an Acorn-format tokenised file (no 2-byte token has been allocated for it, as far as I know), so there should be no need to indent differently depending on the format. In any case, BBC BASIC programs in plain-text (ASCII) format are common on both platforms, and then there's no way of telling from which they originated.

The only things I would be expecting you to do differently depending on the file format are the way the tokens themselves are handled. There are obvious things like two-byte tokens versus single-byte tokens, but there are more subtle ones like the handling of the statement which Acorn calls POINT x,y but my BASICs call PLOT x,y (I considered the use of POINT confusing given its existing use as a function).

There is also the complication that the keyword BY has a conventional (single-byte) token in my BASICs but in Acorn's BASICs is represented by the 'two-byte token' &42 &59 which of course happens to be the characters B and Y - in other words it (strangely) isn't tokenised!

So whilst there are certainly differences in the tokenised formats that you need to recognise, none affects indentation. As we have established, Acorn's (Sophie's) BASICs and my BASICs (plus Brandy and other versions of BBC BASIC) all indent in exactly the same way, apart from the outliers of BASIC 1 (© 1981) and BASIC 2 (© 1982) which were considered 'wrong' even at the time.
User avatar
KaraTheValkyrie
Posts: 12
Joined: Sat 14 Jan 2023, 19:29

Re: BBC Micro Utilities for Windows

Post by KaraTheValkyrie »

I mean the format used by BASIC exported from a physical BBC micro, versus that from BB4W. They differ in the last four bytes of the file like this:
 0D 00 FF FF - Russell BBC BASIC Windows/SDL format(Z80, 80×86)
 xx xx 0D FF - "Original" Acorn format (6502, 32000, ARM, PDP11)
I can quickly check the last four bytes and avoid having to parse the file twice to check for multi-byte tokens. If you always want to force your preferred format just add the -w switch, and as I say I'll be adding a config file so you will be able to set whatever preferences you like. If you use files you have exported from BB4W then you'll get the indentation style you want by default.
I've just added support for both versions of BY. The way I have it mapped makes it easy to add up to 3 byte tokenized keywords (like, iirc, EDITO).
Hated Moron

Re: BBC Micro Utilities for Windows

Post by Hated Moron »

KaraTheValkyrie wrote: Wed 05 Apr 2023, 18:33 If you use files you have exported from BB4W then you'll get the indentation style you want by default.
I still think there's a misunderstanding here. There isn't an "indentation style I want" there is a standard indentation style used by all versions of BBC BASIC since 1984 (so that's Sophie's 6502 BASIC 4, 32016 BASIC and ARM BASIC V & VI, all my BASICs, Brandy BASIC, Owl BASIC and others).

Surely that should be the default indentation style used by your utility, whether the program originated in one of Sophie's BASICs or mine? If you want to support the indentation style used by BASIC 1 and BASIC 2 by all means do so by means of an option, but I don't think it's necessary.

What does your utility do with a BBC BASIC program in plain-text format, such as one saved from Brandy BASIC?
User avatar
KaraTheValkyrie
Posts: 12
Joined: Sat 14 Jan 2023, 19:29

Re: BBC Micro Utilities for Windows

Post by KaraTheValkyrie »

It recognizes plain text and just dumps the plain text. It does not attempt to tokenize, if that's what you are asking. It also spots "PRINT#" data files and prints the data in human-readable form. The BBCDataFileToText also has --hex and --ascii switches which makes it a handy hex dumper, since that command has gone from standard Windows now.

Plain text file example:
2_$.Scroll.INF

BBCBasicToText: processing 1/1, C:\Users\...\2_$.Scroll.INF
Input file 2_$.Scroll.INF is not tokenized BBC BASIC. It appears to be a plain text file
$.Scroll  FF5EAC FF7B00 001D23

BBCBasicToText: processed 1/1, C:\Users\...\2_$.Scroll.INF
Output: C:\Users\...\2_$.Scroll.INF.bbcode
Hated Moron

Re: BBC Micro Utilities for Windows

Post by Hated Moron »

KaraTheValkyrie wrote: Wed 05 Apr 2023, 20:46 It recognizes plain text and just dumps the plain text. It does not attempt to tokenize, if that's what you are asking.
As we were discussing indentation, I wondered which indentation style it would use for a plain-text program. Although the most likely source of such a file would be Brandy, as it saves programs that way by default, all versions of BBC BASIC can export in plain text as an option (either using an IDE menu option or *spool).