BBC BASIC for SDL 2.0 version 1.32a released

for discussion of bbc basic for windows/sdl, brandy and more
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

BBC BASIC for SDL 2.0 version 1.32a released

Post by Soruk »

BBC BASIC for SDL 2.0 version 1.16a released

(Edit: While I'm copying Richard's announcements across, I will try to keep everything to one thread)

Richard has released version 1.16a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android, iOS and in-browser. This is an interim release to fix a bug and a regression, it affects the 64-bit, ARM and Browser editions only, the 32-bit x86 editions have not been updated:
  1. Fixed a bug affecting the ON ... PROC statement (it could report a Syntax Error when there was nothing wrong).
  2. Fixed a regression in the ellipse.bbc library (causing filled ellipses not to plot if the GCOL mode was OR, AND, XOR or invert).
This new version may be downloaded from the usual location. The GitHub repository has been updated.
Last edited by Soruk on Mon Sep 05, 2022 10:04 am, edited 16 times in total.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

BBC BASIC for SDL 2.0 version 1.17a released

Post by Soruk »

BBC BASIC for SDL 2.0 version 1.17a released

Richard has released version 1.17a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android, iOS and in-browser. The changes in this version are as follows:
  1. BASIC Interpreter / Run Time Engine

    Updated the in-browser (Emscripten / Web Assembly) edition to support shader graphics, 3D graphics and the Box2D physics engine.

    Fixed a subtle bug which could cause unwanted behaviour when using ON ERROR LOCAL in nested functions (ARM and 64-bit editions only).

    Fixed a one-byte buffer overrun in the *KEY command (ARM and 64-bit editions only).

  2. IDEs and Utilities

    Updated BBCEdit to version 0.37.1 (with thanks to Andy Parkes); amongst other changes this has a new light-mode option.

    Fixed a regression causing the profiler not to work on the Raspberry Pi (D'oh!).

  3. Libraries

    Added shaderlib.bbc to facilitate writing shader-based programs, and to aid compatibility with the in-browser edition.

    Added webgllib.bbc which is substantially compatible with ogllib and gleslib but uses shaders rather than the Fixed Function 3D Pipeline.

    Updated some other libraries to improve compatibility with, and performance in, the in-browser edition.

  4. Example Programs

    Modified Ceefax.bbc (again!) to track changes the BBC is making to its web pages and to improve performance in the in-browser edition.

    The shader-based programs (fluid.bbc, mandel.bbc, seascape.bbc, slitscan.bbc) have been re-written to use the shaderlib library.

    Updated some other example programs to improve compatibility with, and performance in, the in-browser edition.
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, Android, iOS, 64-bit Linux and in-browser 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.
Last edited by Soruk on Mon Dec 07, 2020 1:18 pm, edited 1 time in total.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Soruk
Posts: 1136
Joined: Mon Jul 09, 2018 11:31 am
Location: Basingstoke, Hampshire
Contact:

BBC BASIC for SDL 2.0 version 1.18a released

Post by Soruk »

BBC BASIC for SDL 2.0 version 1.18a released

Richard has released version 1.18a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android, iOS and in-browser. The changes in this version are as follows:
  1. BASIC Interpreter / Run Time Engine

    Added a new command-line switch -borderless to remove the title bar.

    Extended the PTR() pseudo-variable (again) to accept a function or procedure name as a parameter.

    Fixed an obscure bug which could cause a star-command to crash if within 256 bytes of the end of a library!

  2. IDEs and Utilities

    Updated BBCEdit to version 0.37.2, which speeds up directory listings when there are many files.

    Modified SDLIDE to make the behaviour of Backspace more consistent, for example you can backspace through the line-number field.

  3. Libraries

    Added Svein's excellent pdflib library for creating PDF files (single A4 page only).

    Fixed a bug in aagfxlib causing 'dashed' lines to be sometimes drawn slightly too long.

    Modified box2dgfx, imglib, shaderlib and webgllib to clip to the current graphics viewport, if any.

  4. Example Programs

    Added saa505x.bbc in examples/tools, to demonstrate the different MODE 7 character sets.

    Added raytrace.bbc in examples/graphics, another shader demo from Shadertoy.com.

    Updated aagfxdem.bbc in examples/graphics, to check that 'dashed' lines are the right length.
This 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, Android, iOS, 64-bit Linux and in-browser 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.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.19a released

Post by Deleted User 9295 »

I've released version 1.19a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android, iOS and in-browser. The changes in this version are as follows:
  1. BASIC Interpreter / Run Time Engine

    Extended the *DUMP command to accept optional hexadecimal start and end offsets (or length), using the same syntax as *LOAD and *SAVE.

  2. IDEs and Utilities

    Added a version check on startup (desktop editions only).

    Added the Macro recorder utility to customize the function (and tab) keys in SDLIDE, similar to the BB4W IDE.

    Fixed a couple of minor bugs in SDLIDE.bbc.

  3. Libraries

    Added menulib.bbc to support menu bars and drop-down menus (based on the SDLIDE menus).

    Added editbox.bbc which extends the dialogue-box support to include a multi-line edit control.

    Extended dlglib.bbc to include PROC_getdlgitemrect() and to distinguish between left and right mouse clicks.

    Extended filedlg.bbc to include FN_filedlgex() which supports dark mode and positioning of the file selector.

  4. Example Programs

    Added gorillas.bbc in examples/games, a conversion of one of David Williams's BB4W programs (requires SDL 2.0.6 or later).

    Added textedit.bbc in examples/general (desktop editions only) to demonstrate the use of menus and the multi-line edit control.
This 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, Android, iOS, 64-bit Linux and in-browser editions, currently).

Important! iOS users: the certificate for your current version of BBC BASIC for SDL 2.0 expires soon. You should install version 1.19a in order to ensure continued operation. The new certificate will expire on 19th January 2022.
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.19a released

Post by Deleted User 9295 »

Richard Russell wrote: Fri Jan 22, 2021 2:15 pm I've released version 1.19a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android, iOS and in-browser.
For anybody who may be interested, I can confirm that the regular (x86-64) MacOS edition of BBC BASIC for SDL 2.0 appears to run reasonably well on an M1-based ('Apple silicon') Mac using Rosetta (the x86 emulation layer). No doubt a native AArch64 edition would run faster, but at least this means you can run BBC BASIC until such an edition is available.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC BASIC for SDL 2.0 version 1.19a released

Post by BigEd »

Good to know!
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.19a released

Post by Deleted User 9295 »

BigEd wrote: Sat Jan 30, 2021 9:03 amGood to know!
And it looks as though it will be the only way to get BBC BASIC for SDL 2.0 running properly on the M1. The reason being that "Apple Silicon does not allow for RWX memory pages", that is, it will not let you allocate a block of memory which has Read, Write and Execute access - which is exactly what BBC BASIC needs for its heap if it is to support the assembler!

This is what Apple calls 'the Hardened Runtime' and whilst it's something that an Intel x86 app can opt into, it's enforced for all native Apple Silicon apps. Here we have yet another case of Apple imposing 'security' features on the end-user rather than letting him use his own judgement and deciding what degree of risk is acceptable.

The only workaround, and it's not something that BBC BASIC can realistically take advantage of, is to declare your app as using Just In Time (JIT) compilation. Even then you can only toggle memory pages between RW and RX, in just one thread, using an Apple-specific API.

So that kills the prospect of a native Apple M1 version of BBC BASIC having an assembler, which in turn kills the debugging and profiling capabilities of BBCSDL which rely on assembled code. If this is the way all OSes are going to go, BBC BASIC as we know it is doomed. :(
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.19a released

Post by lurkio »

Richard Russell wrote: Fri Jan 22, 2021 2:15 pm I've released version 1.19a of BBC BASIC for SDL 2.0
Good news! Thank you.

Btw, I notice that the colours displayed in the running-program window in BBCSDL are rather muted in comparison with the equivalent colours in BeebEm. See the example screenshots below.

Am I seeing the colours you intended me to see or am I doing something wrong?

Was the colour scheme a deliberate choice? If so, can I reconfigure it?

This isn't a complaint or an urgent request. I just noticed that some of the BASIC graphics demos I've been posting in another thread looked less vibrant in BBCSDL than in BeebEm, and I thought it might be nice if I could adjust the BBCSDL colour scheme somehow..?

:?:

Screenshot 2021-01-30 at 18.05.05.png
Screenshot 2021-01-30 at 18.03.30.png
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.19a released

Post by Deleted User 9295 »

lurkio wrote: Sat Jan 30, 2021 6:14 pmAm I seeing the colours you intended me to see or am I doing something wrong?
It's very likely that what you're seeing is a side-effect of the absence of flashing colours in BBC BASIC for Windows and BBC BASIC for SDL 2.0 (without a hardware-paletted display, i.e. a Colour Look-Up Table such as the one in the BBC Micro's ULA, flashing colours are virtually impossible).

I wanted colour numbers 8-15 to do something useful, so in my BASICs they are intensified colours, with colours 1-7 being slightly reduced in intensity (so for example COLOUR 2 has RGB values of 00 C8 00 not 00 FF 00). I find the resulting colours quite bright enough, but they will seem slighted muted compared to those from BBC Micro emulators.

If you don't mind the code overhead, the simple solution is to redefine the palette:

Code: Select all

COLOUR 1,&FF,&00,&00
COLOUR 2,&00,&FF,&00
COLOUR 3,&FF,&FF,&00
COLOUR 4,&00,&00,&FF
COLOUR 5,&FF,&00,&FF
COLOUR 6,&00,&FF,&FF
COLOUR 7,&FF,&FF,&FF
or in a single VDU statement:

Code: Select all

VDU 19,1,16,&FF,&00,&00,19,2,16,&00,&FF,&00,19,3,16,&FF,&FF,&00,19,4,16,&00,&00,&FF,19,5,16,&FF,&00,&FF,19,6,16,&00,&FF,&FF,19,7,16,&FF,&FF,&FF
Deleted User 9295

BBC BASIC for SDL 2.0 version 1.20a released

Post by Deleted User 9295 »

I've released version 1.20a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android, iOS and in-browser. The changes in this version are as follows:
  1. BASIC Interpreter / Run Time Engine

    Fixed FOR...NEXT loops misbehaving with negative non-integer STEP on ARM editions (Raspberry Pi, Android, iOS).

    Fixed *KEY not correctly handling strings such as |!|H (ARM and 64-bit editions only).

  2. IDEs and Utilities

    Fixed compiler.bbc incorrectly crunching structure members in rare circumstances.

    Fixed SDLIDE.bbc crashing in MacOS if the Tab key was pressed.

  3. Libraries

    Modified webgllib.bbc to be 64-bit compatible (it can be used on platforms other than in-browser).

    Modified filedlg.bbc so that you can type a full (absolute) path into the File name box.

    Modified menulib.bbc so that drop-down menus can be hidden from the menu bar (by setting their title to an empty string).

    Fixed editbox.bbc not reliably setting the 'changed' flag, and mispositioning the caret on blank lines.

  4. Example Programs

    Modified Ceefax.bbc to add function key shortcuts (f1-f4) for the coloured buttons; also fixed a crash if a page number with a leading zero was entered.

    Modified sudoku.bbc so the timeout only applies to the 'Count' option, not to 'Solve', so it can solve any puzzle even on slow machines.
This 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, Android, iOS, 64-bit Linux and in-browser editions, currently).
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.20a released

Post by Deleted User 9295 »

Richard Russell wrote: Thu Mar 04, 2021 9:31 amModified webgllib.bbc to be 64-bit compatible (it can be used on platforms other than in-browser).
That is perhaps worth emphasising. webgllib.bbc was written to support 3D graphics in the in-browser edition of BBCSDL, because WebGL doesn't have the Fixed Function Pipeline (in OpenGL and OpenGL ES) that the other editions rely on. To make it work it was necessary to use shaders instead (and I was pleased to be able to achieve that, despite a very limited experience of shader programming).

It was only after I'd got it going that I realised that it actually worked better than the other libraries (ogllib.bbc and gleslib.bbc) in that lighting calculations are performed per pixel rather than per vertex. This can dramatically improve the realism of the end result, especially in cases when spotlights are used, and/or there are specular reflections.

Fortunately not only does it work better in those respects, it runs on all the other platforms (Windows, MacOS, Linux, Raspbian, Android, iOS) too! So if you want to take advantage of the improved rendering quality simply INSTALL webgllib instead of ogllib. It's not quite 100% compatible but it comes close (you'll notice a particularly dramatic effect if you perform the substitution in skaters.bbc!).
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.20a released

Post by Deleted User 9295 »

Richard Russell wrote: Thu Mar 04, 2021 10:53 pmFortunately not only does it work better in those respects, it runs on all the other platforms (Windows, MacOS, Linux, Raspbian, Android, iOS) too!
Note that the webgllib library's use of shaders seems to interfere with the normal operation of SDL 2.0, so that if you CHAIN another program or return to immediate mode you can end up with a black screen (it is still responding to input, but invisibly). This isn't normally important on a desktop platform, when it is usual to close the window in which the program was running anyway. But on Android and iOS it can mean that after running a program which uses webgllib you may need to fully-close and re-open the BBC BASIC app.
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

I've released version 1.21a of BBC BASIC for SDL 2.0 - the cross-platform programming language for Windows, MacOS, Linux, Raspbian, Android, iOS and in-browser. The changes in this version are as follows:
  1. BASIC Interpreter / Run Time Engine

    Mapped keyboard shortcuts Cmd+A, Cmd+C, Cmd+F, Cmd+V, Cmd+X and Cmd+Z to their Ctrl equivalents for improved compatibility with Apple Macs.

    Fixed a couple of minor differences between the 32-bit x86 editions and the ARM/64-bit editions.

  2. IDEs and Utilities

    Added compiler directives to SDLIDE.bbc to simplify building a standalone version in BB4W.

    Modified memusage.bbc, profiler.bbc, searchin.bbc and sdldebug.bbc to be compatible with BB4W as well as BBCSDL.

  3. Libraries

    Added box2ddbg.bbc to support Box2D Debug Graphics, largely compatible with the equivalent BB4W library.

    Fixed a bug in box2dlib.bbc affecting Gear Joints on 64-bit platforms.

    Fixed a bug in dlglib.bbc causing the trackbar control not to scale to the specified range.

    Fixed a bug in treeview.bbc causing mouse clicks not to be reliably detected.

  4. Example Programs

    Added pinball.bbc (in examples/physics) which demonstrates combining Box2D and 3D rendering.

    Added voronoi.bbc (in examples/graphics/) which is another shader demo.

    Modified recorder.bbc to increase the range of level adjustment (100% is now 'mid-range').

    Modified the other demos in examples/physics to take advantage of the box2ddbg library (press D to display the Debug Graphics).
This 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, Android, iOS, 64-bit Linux and in-browser editions, currently).
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

Richard Russell wrote: Fri Apr 16, 2021 2:37 pm Mapped keyboard shortcuts Cmd+A, Cmd+C, Cmd+F, Cmd+V, Cmd+X and Cmd+Z to their Ctrl equivalents for improved compatibility with Apple Macs.
Much appreciated, thank you!

Is it too much to request that Alt+right_arrow be mapped to its Ctrl equivalent too? (To move the cursor forward by one "word".) And the same for Alt+left_arrow? (The Alt key is known as the Option key on Macs, but I think it's the same key.) I don't know if that would cause problems because you'd also probably want to retain the functionality of an unmodified Alt keypress, which currently toggles the highlight-selection of the File menu, as per most/all Windows apps.

Then there's Cmd+left_arrow, which should move the cursor to the beginning of the current line. And Cmd+right_arrow to move to the end thereof.

Don't bother if these mappings are too problematic or too fiddly to implement.

:?:
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

lurkio wrote: Mon Apr 19, 2021 3:28 pm Is it too much to request that Alt+right_arrow be mapped to its Ctrl equivalent too? (To move the cursor forward by one "word".) And the same for Alt+left_arrow?
I was able to implement the Cmd+ shortcuts without impacting on compatibility, because previously those key combinations were ignored by BBC BASIC. The same isn't true of Alt+ shortcuts: they do currently generate keycodes so any re-mapping could potentially break existing programs, and that's something I am keen to avoid.
I don't know if that would cause problems because you'd also probably want to retain the functionality of an unmodified Alt keypress, which currently toggles the highlight-selection of the File menu, as per most/all Windows apps.
Indeed. An Alt+ shortcut would inevitably look like a menu selection to SDLIDE.bbc.
Then there's Cmd+left_arrow, which should move the cursor to the beginning of the current line. And Cmd+right_arrow to move to the end thereof.
I suppose they could be mapped to Home and End without impacting compatibility.
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

Richard Russell wrote: Mon Apr 19, 2021 4:53 pm I was able to implement the Cmd+ shortcuts without impacting on compatibility, because previously those key combinations were ignored by BBC BASIC. The same isn't true of Alt+ shortcuts: they do currently generate keycodes so any re-mapping could potentially break existing programs, and that's something I am keen to avoid.
Is there any way I could hack the feature (Alt+Left/Right=back/forward a word) into my own personal copy of the editor app (the IDE)?

:?:
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

lurkio wrote: Thu Apr 29, 2021 12:24 pmIs there any way I could hack the feature (Alt+Left/Right=back/forward a word) into my own personal copy of the editor app (the IDE)?
I'm generally confused about the Mac's Alt-keycodes. I thought that Alt+3 was supposed to generate a hash (#), but here (using a Mac Mini with a standard UK keyboard) Alt+3 is generating a pound sign (£) just like Shift+3, even in a Terminal. In principle, if Alt+3 can generate hash then Alt+Left and Alt+Right should be able to do what you want too.

So if you're using a 'real' Mac keyboard I'd be interested to know what code you are getting from Alt+3. If it's a hash then, yes, I reckon it should be possible to make the necessary changes in SDLIDE (in all versions, not just your personal copy). But testing that here could be tricky if my keyboard is not behaving like a real Mac.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by BigEd »

On my macbook's keyboard alt-3 is hash whereas shift-3 is pound.
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

BigEd wrote: Thu Apr 29, 2021 6:08 pm On my macbook's keyboard alt-3 is hash whereas shift-3 is pound.
Same here:

Code: Select all

Key Down
	Characters:	#
	Unicode:	35 / 0x23
	Keys:		⌥3
	Key Code:	20 / 0x14
	Modifiers:	524576 / 0x80120 

Key Down
	Characters:	£
	Unicode:	163 / 0xa3
	Keys:		⇧3
	Key Code:	20 / 0x14
	Modifiers:	131330 / 0x20102
EDIT: And here are Alt+Left and Alt+Right:

Code: Select all

Key Down
	Characters:	
	Unicode:	63234 / 0xf702
	Keys:		⌥←
	Key Code:	123 / 0x7b
	Modifiers:	11010336 / 0xa80120 

Key Down
	Characters:	
	Unicode:	63235 / 0xf703
	Keys:		⌥→
	Key Code:	124 / 0x7c
	Modifiers:	11010336 / 0xa80120 
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

BigEd wrote: Thu Apr 29, 2021 6:08 pm On my macbook's keyboard alt-3 is hash whereas shift-3 is pound.
OK. I can only assume that since I've configured my Mac Mini for a standard UK (PC) keyboard - which I share using a KVM switch - it's changed what Alt+3 does. It does mean that I can't test keyboard operations reliably, but there's no way I'm investing in a 'real' Mac just to solve that!

A related issue is that my keyboard has Home and End keys which I believe a genuine Mac keyboard doesn't, although they work fine with my Mac Mini. So in SDLIDE I can go to the beginning or end of a line, or to the beginning and end of the program (with Ctrl+Home and Ctrl+End) but you may not be able to.

I can easily map Cmd+left to Home and Cmd+right to End, but (with my keyboard at least) I can't do Ctrl+Cmd+left or Ctrl+Cmd+right for jumping to the beginning or end of the program.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by BigEd »

Yes, I think the Mac accepts that a USB keyboard has the usual markings and encodings, whereas its own keyboard has (a few) Apple-specific markings and encodings.
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

BigEd wrote: Thu Apr 29, 2021 8:14 pm I think the Mac accepts that a USB keyboard has the usual markings and encodings, whereas its own keyboard has (a few) Apple-specific markings and encodings.
It's not just "markings and encodings". There are keys that a standard PC keyboard has that a Mac keyboard doesn't (like Home and End) and keys that a Mac keyboard has that a PC keyboard doesn't (like Option and Fn, apart from some laptops).

I've noticed that my Mac Mini (plus UK PC keyboard) is behaving in a slightly strange way. If I type Ctrl+Cmd+left or Ctrl+Cmd+right it sounds a 'bong' as if to warn 'that isn't a valid key combination' yet BBC BASIC still receives a keycode! So I can in fact make those key combinations do something useful (jump to start or end of program) so long as the user isn't confused by the warning sound.

Does the same thing happen with a real Mac keyboard, or does the 'bong' (if you get it) really mean no keycode is generated from those combinations?
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by BigEd »

ctrl-cmd-left and -right appear to be 'previous word' and 'next word' as operations (no bong, as tested in Chrome's address box and emacs in Terminal). I'm not sure how to find out how an application might see them as events.

Edit: that's using the left cmd key. If I use the right cmd key, same effect but with added bong.

Edit: running xxd in Terminal I see these sequences, using either of the cmd keys:

Code: Select all

1b 5b 31 3b 35 44 
1b 5b 31 3b 35 43
whereas alt-left and alt-right, which also acting as previous and next word, show up as

Code: Select all

1b 62
1b 66
again using either alt key.

I've downloaded BBC Basic for SDL v1.13a and am happy to type in some one-liners to investigate.
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

BigEd wrote: Fri Apr 30, 2021 10:53 amI've downloaded BBC Basic for SDL v1.13a and am happy to type in some one-liners to investigate.
I hope you don't really mean v1.13a in a thread entitled 'BBC BASIC for SDL 2.0 version 1.21a released'. :lol:
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by BigEd »

Edit: apologies for any offence; the message below was intended only as observation, not as criticism, and it's poorly worded from that perspective. As it turns out, I had messed up my management of downloaded files: downloaded the right file but then run the wrong one.

I'm afraid I do, because that's the version linked at https://www.bbcbasic.co.uk/bbcsdl/ - I'm happy to download a more recent build, but I'd prefer not to build my own. I could perhaps be persuaded. I'm running a relatively old macOS: 10.13.6, High Sierra. 64bit.

(BTW, according to my observation, without dumping events, Fn left and right are Home and End, whereas Fn up and down are Prev and Next Page. I use these often.)
Last edited by BigEd on Sun May 02, 2021 7:45 pm, edited 1 time in total.
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

BigEd wrote: Fri Apr 30, 2021 11:03 am I'm afraid I do, because that's the version linked at https://www.bbcbasic.co.uk/bbcsdl/
No it's not (I'm not quite that careless!). I've checked, and it's definitely v1.21a; here are the file statistics:

BBCBasic.dmg 22,376,253 bytes Apr 15 20:40

If that's not the file you are getting then you have a stale cache somewhere. Clear your cache and repeat the download.

ftp.png
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

BigEd wrote: Fri Apr 30, 2021 11:03 am BTW, according to my observation, without dumping events, Fn left and right are Home and End, whereas Fn up and down are Prev and Next Page. I use these often.
The Fn key is not recognised by SDL 2.0 so its existence is entirely hidden from me and I can't take any action on a key combination which uses it. I can try asking at the SDL forum whether there's a workaround, but otherwise it's out of my hands.
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

Richard Russell wrote: Fri Apr 30, 2021 12:26 pm
BigEd wrote: Fri Apr 30, 2021 11:03 am that's the version linked at https://www.bbcbasic.co.uk/bbcsdl/
... I've checked, and it's definitely v1.21a
Confirmed!

Btw, if I try Ctrl+Cmd+Left or Ctrl+Cmd+Right on macOS Mojave on my mid-2014 MacBook Pro, I just get the "invalid key bong", and the cursor doesn't move at all (no matter whether I use the Left Command key or the Right Command key).

:!:
Deleted User 9295

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by Deleted User 9295 »

lurkio wrote: Fri Apr 30, 2021 12:41 pmI just get the "invalid key bong", and the cursor doesn't move at all (no matter whether I use the Left Command key or the Right Command key).
The cursor not moving isn't of itself a good indication. Open a BBC BASIC Immediate Mode window and type:

Code: Select all

REPEAT PRINT GET : UNTIL FALSE
or if you're in a hurry:

Code: Select all

REP.P.GET:U..
That will print any codes received when keys are pressed. Does the Ctrl+Cmd+left (or right) combination print anything?
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: BBC BASIC for SDL 2.0 version 1.21a released

Post by lurkio »

Richard Russell wrote: Fri Apr 30, 2021 12:50 pm
lurkio wrote: Fri Apr 30, 2021 12:41 pmI just get the "invalid key bong", and the cursor doesn't move at all (no matter whether I use the Left Command key or the Right Command key).
The cursor not moving isn't of itself a good indication.
Actually, I've just noticed that the cursor "bongs" but does move forward/back a word in the BBCSDL IDE app! But not in TextEdit! (TextEdit just bongs but doesn't move the cursor.)

Richard Russell wrote: Fri Apr 30, 2021 12:50 pm

Code: Select all

REP.P.GET:U..
That will print any codes received when keys are pressed. Does the Ctrl+Cmd+left (or right) combination print anything?
Yes. Ctrl+Cmd+Left bongs and prints 128, and Ctrl+Cmd+Right bongs and prints 129 (no matter which of the two Cmd keys I use).

N.B. Those numbers are different from what I get in the Key Codes app that I downloaded from the Mac App Store yesterday, which gives 123 and 124 respectively (regardless of which Cmd key I use -- although it does register a unique "modifier" code for each of the two Cmd keys).

:idea:
Post Reply

Return to “modern implementations of classic programming languages”