sQLux Sound and Joystick support

Discussion and advice about emulating the QL on other machines.
Exile
ROM Dongle
Posts: 38
Joined: Sat Jan 15, 2022 8:55 pm

sQLux Sound and Joystick support

Post by Exile »

Following the great work that XorA has done in getting sQLux to version 1, I’ve been working with them to use SDL2 to add sound (beep) and joystick support. The features will be in the next sQLux release, but in the meantime you can try them out by compiling the latest code at: https://github.com/SinclairQL/sQLux

The code has been tested on the Raspberry Pi 4, Ubuntu and Windows 10. I’d value any feedback. The assembler programs I wrote in the mid 80’s that use sound and joysticks seem to work ok :-)

The features are documented at: https://github.com/SinclairQL/sQLux/blo ... s/sqlux.md, but in brief:

Sound
Sound can be generated either through QDOS MT.IPCOM calls, or SuperBASIC BEEP commands. sQLux attempts to faithfully reproduce the sound behaviour of the original BBQL, this includes support for negative values of grd_y, including the correct behaviour for -8. Behaviour when either pitch or pitch_2 equals 255 is also correctly emulated.
All optional parameters, including Fuzzy and Random, are fully supported. The slight click that occurs in the original QL when a pitch change occurs (even for a pitch change of 0) is emulated.
Many thanks to Silvestor from the QLForum for the detailed disassembly of the QL 8049 sound code.

Joysticks
Analogue or digital USB joysticks are supported. Axis 0 and axis 1 of the joystick are mapped. Moving the joystick generates key presses. All buttons on the joystick are mapped to the fire key.
Joystick 1 (assumed connected through CTL1) maps to the cursor keys and spacebar. Joystick 2 (assumed connected through CTL2) maps to F1 through to F5.


User avatar
XorA
Site Admin
Posts: 1359
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: sQLux Sound and Joystick support

Post by XorA »

No one has complained my file changes broke anything so i guess I should tag another release with this stuff in!


Derek_Stewart
Font of All Knowledge
Posts: 3932
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: sQLux Sound and Joystick support

Post by Derek_Stewart »

Hi,

I downloaded the new updates and it compiled with no errors on my Linux: Ubuntu 21.10 with Cinnamon Desktop X64.

I tried the Qbits Sounds v3 composer programme which worked really well.


Regards,

Derek
Exile
ROM Dongle
Posts: 38
Joined: Sat Jan 15, 2022 8:55 pm

Re: sQLux Sound and Joystick support

Post by Exile »

Derek_Stewart wrote: I downloaded the new updates and it compiled with no errors on my Linux: Ubuntu 21.10 with Cinnamon Desktop X64.

I tried the Qbits Sounds v3 composer programme which worked really well.
Excellent! Thanks Derek :-)


Derek_Stewart
Font of All Knowledge
Posts: 3932
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: sQLux Sound and Joystick support

Post by Derek_Stewart »

Hi,

The Joystick CTL functions, as in a QL are hardwired to the defined CTL Port.

But an emulator could have user defined joystick functionality, is this possible?


Regards,

Derek
Exile
ROM Dongle
Posts: 38
Joined: Sat Jan 15, 2022 8:55 pm

Re: sQLux Sound and Joystick support

Post by Exile »

Derek_Stewart wrote:Hi,

The Joystick CTL functions, as in a QL are hardwired to the defined CTL Port.

But an emulator could have user defined joystick functionality, is this possible?
The joystick is effectively emulating 5 keys, so it is possible in theory, but it would require changes to the format of the ini file to allow the 5 keys to be explicitly specified. Also, to be most effective, the keys should be on the same row, so that they can be read by a single KEYROW command.

Was there a specific scenario that you were considering?


Exile
ROM Dongle
Posts: 38
Joined: Sat Jan 15, 2022 8:55 pm

Re: sQLux Sound and Joystick support

Post by Exile »

XorA wrote:No one has complained my file changes broke anything so i guess I should tag another release with this stuff in!
I think you are right, there have been no objections, so tagging a new release seems a good idea to me :)


User avatar
XorA
Site Admin
Posts: 1359
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: sQLux Sound and Joystick support

Post by XorA »

Exile wrote:
XorA wrote:No one has complained my file changes broke anything so i guess I should tag another release with this stuff in!
I think you are right, there have been no objections, so tagging a new release seems a good idea to me :)
Just need to rebuild my build system as I had a mass system upgrade to increase security last week :-D


Derek_Stewart
Font of All Knowledge
Posts: 3932
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: sQLux Sound and Joystick support

Post by Derek_Stewart »

Exile wrote:
Derek_Stewart wrote:Hi,

The Joystick CTL functions, as in a QL are hardwired to the defined CTL Port.

But an emulator could have user defined joystick functionality, is this possible?
The joystick is effectively emulating 5 keys, so it is possible in theory, but it would require changes to the format of the ini file to allow the 5 keys to be explicitly specified. Also, to be most effective, the keys should be on the same row, so that they can be read by a single KEYROW command.

Was there a specific scenario that you were considering?
Hi

I will have a look at the source code to see if I can do anything, with a view having the ability of changing the KeyRow of the Joystick definition.

Maybe a hard job for me as I am not blessed with good proggramming ability, I like to try.


Regards,

Derek
User avatar
XorA
Site Admin
Posts: 1359
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: sQLux Sound and Joystick support

Post by XorA »

Derek_Stewart wrote:
Exile wrote:
Derek_Stewart wrote:Hi,

The Joystick CTL functions, as in a QL are hardwired to the defined CTL Port.

But an emulator could have user defined joystick functionality, is this possible?
The joystick is effectively emulating 5 keys, so it is possible in theory, but it would require changes to the format of the ini file to allow the 5 keys to be explicitly specified. Also, to be most effective, the keys should be on the same row, so that they can be read by a single KEYROW command.

Was there a specific scenario that you were considering?
Hi

I will have a look at the source code to see if I can do anything, with a view having the ability of changing the KeyRow of the Joystick definition.

Maybe a hard job for me as I am not blessed with good proggramming ability, I like to try.
The exists plenty of software to map joystick buttons to keys on the host OS, this is probably a better solution than baking such a solution into sQLux.

I mean it would be a few lines of code and some new config options in sQLux so not difficult, but Im not convinced its the right place to do it!


Post Reply