QLUB Adapter - Initial Release...

Nagging hardware related question? Post here!
Post Reply
User avatar
Chr$
QL Wafer Drive
Posts: 1304
Joined: Mon May 27, 2019 10:03 am
Location: Sachsen, Germany
Contact:

Re: QLUB Adapter - Initial Release...

Post by Chr$ »

M68008 wrote: After a SBASIC->SuperBASIC conversion of the emulator-side file-transfer program, it also runs on a Sinclair ROM in Q-emuLator.
Any chance you could share the SuperBasic version? It would probably take me days to work out how to convert the existing one!


https://QXL.WIN
Collector of QL related computers, accessories and QL games/software.
Ask me about felt pads - I can cut them to size and they have proved excellent for mdv data recovery.
martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QLUB Adapter - Initial Release...

Post by martyn_hill »

Ciao Danielle!
M68008 wrote:Thank you Martyn, the adapter started working well after I uploaded this version of the firmware!
That's great - thanks for persevering and sharing!
M68008 wrote:There was a change in the Teensyduino library which might be the cause of the different timings, I sent you a PM with the details.
Yes, seems like v1.41 of the Teensyduino library brought in those changes to delayMicroseconds. Thanks so much for helping me catch this issue! In the next major update to the firmware, I always intended to replace all those nasty software delay loops and dependency on delayMicroseconds with proper hardware counter/timer based timing routines...
M68008 wrote:After a SBASIC->SuperBASIC conversion of the emulator-side file-transfer program, it also runs on a Sinclair ROM in Q-emuLator.
Brilliant! I had always intended the project to be as universally accessible as possible within the constraints of any given QL emulator and Q-emulator was next on my list to test against! Thanks for taking the time to adapt the current SendFileMQ wrapper. As per Chr$ - would you willing to share your adaptations? I'm happy to manage 'packaging' with the next version release bundle. In principal, we should be able to use the SuperBASIC version across all supported platforms...

Just a shame that SMSQmulator does't have SERial port support (due to limited Java support for the COM port, not down to any deficiency in Wolfgfang's work!) I'll take a look at the work needed to support SMSQmulator at a a later time - Peter G has some good ideas...


User avatar
M68008
Trump Card
Posts: 223
Joined: Sat Jan 29, 2011 1:55 am
Contact:

Re: QLUB Adapter - Initial Release...

Post by M68008 »

martyn_hill wrote:As per Chr$ - would you willing to share your adaptations?
Yes, I'll post it here. I've actually just noticed another issue: The SuperBASIC version produces files that are too long. I think it's a SBASIC/SuperBASIC difference in handling LOCAL variables.


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QLUB Adapter - Initial Release...

Post by martyn_hill »

Good morning Danielle!
M68008 wrote:Yes, I'll post it here. I've actually just noticed another issue: The SuperBASIC version produces files that are too long. I think it's a SBASIC/SuperBASIC difference in handling LOCAL variables.
Yeah - Since SBASIC came of age, I have developed a habit of passing tons of parameters as well as gratuitous use of LOCals just because I can :-)

I'll take a look myself over the next couple of evenings to identify the areas in the current version of SendFileMQ (v1.4) that would need attention to run under SuperBasic rather than SBASIC. Your own adaptation would give me a head-start if you can share it by then, but no pressure - it was on my TODO list anyway...

M.


User avatar
M68008
Trump Card
Posts: 223
Joined: Sat Jan 29, 2011 1:55 am
Contact:

Re: QLUB Adapter - Initial Release...

Post by M68008 »

martyn_hill wrote:Yeah - Since SBASIC came of age, I have developed a habit of passing tons of parameters as well as gratuitous use of LOCals just because I can :-)
I run on JS and haven't noticed LOCAL bugs, but the same code wouldn't work on some earlier ROMs like AH. Not important for emulator users, though, they can use JS or Minerva.
Almost all of the changes from SBASIC to SuperBASIC I had to do look like areas of SuperBASIC that were not finished in time for the QL's release, like not supporting integer variables for loops and SELect.

martyn_hill wrote:Your own adaptation would give me a head-start if you can share it by then, but no pressure - it was on my TODO list anyway...
Here is what I got:
QLAN.zip
(15.9 KiB) Downloaded 110 times
I renamed the basic file to net for quicker typing in my tests.
At least two more issues remain: the one with fixed-len LOCAL strings and replacing HPUT with something else, perhaps SET_HEADER in the Turbo toolkit.


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QLUB Adapter - Initial Release...

Post by martyn_hill »

Ciao Daniele!

Thank you for that.

So, I've since done some of my own testing, using Minerva 1.98, TK2 (v2.34) and a slightly modified SendFileMQ running in Q-emuLator v3.31.

Sending to a QL works as expected, but receiving I see that over-sized file being produced, just as you described.

Specifically, we see that every 255 bytes, an extra byte - CHR$(20) - is saved to the file.

I think I know where the problem lies - some difference in handling of 1D string arrays between SBASIC and SuperBasic - I'll get to the bottom of it soon :-)

Night, night!


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QLUB Adapter - Initial Release...

Post by martyn_hill »

Hi again Daniele!

Got it... Please MERGE the following three lines in to your current/adapted SendFileMQ SuperBasic program:

Code: Select all

2120         netBlk$=netPayload$(9 TO result%): blkLen%=LEN(netBlk$)
2170               PRINT #fCh%,netBlk$(fHdrLen%*fileHdrFlag% + 1 TO blkLen%);
2210               PRINT #fCh%,netBlk$;
I'll publish a revised, full version of SendFileMQ at the weekend that works under SuperBasic, but the above should get you receiving successfully again - let me know.

***
By way of explanation, under SBASIC, when extracting a slice from a string-array, the implicit end-index of the slice is, as you might expect, the current LEN of the 1D string-array element - which will be less-than or equal to the DIM'd length.

When slicing a string-array under SuperBasic however, the implicit end-index defaults to the DIMensioned end of the string-array.

As the netBlk$ string-array in question here is DIM'd at 255 characters AND because (both) Super and SBASIC always round-up to the next even byte length when DIMming a new array, under SBASIC only the current LENgth of the latest network block is PRINTed out as we want in to the saved file. Under SuperBasic, all 256 bytes of the array (including the space that pads-out the last character of the DIM'd array) is PRINTed out to the file for each received block.

By capturing the current LENgth of netBlk$ (as blkLen%) and then explicitly specifying this as the end-index ( .. TO blkLen% ), we workaround SuperBasic's behaviour and get back to what we intended.

I'll have to take a look at Jan Jones' authoritative handbook to check, but I suspect this is designed behaviour in SuperBasic, but 'rationalised' in SBASIC to behave more intuitively...

M.


gbejniet
ROM Dongle
Posts: 21
Joined: Sun Feb 02, 2020 10:21 pm

Re: QLUB Adapter - Initial Release...

Post by gbejniet »

martyn_hill wrote:a) Find and download the legacy Arduino IDE v1.8.0 (still available from Arduino) AND the legacy Teensyduino installer v1.35 - which I couldn't find online, but I have a copy on my harddrive... You can then just use the existing firmware source and compile/flash the Teensy board as per the instructions. OR...
It might be worth noting that, from the Teensyduino download page, https://www.pjrc.com/teensy/td_download.html , a bit of URL tweaking does give you working download links for "td_135" for most platforms - except for macOS Catalina, unfortunately, so I can't actually vouch for them being correct. So for now I will be going with option (b).


martyn_hill
Aurora
Posts: 909
Joined: Sat Oct 25, 2014 9:53 am

Re: QLUB Adapter - Initial Release...

Post by martyn_hill »

Hi - thanks for that.

I should have the revised firmware built against the latest libraries available next weekend, but yes, in the meantime, just flash the raw HEX file uploaded earlier.

Let me know how you get on.

Meanwhile, here's a revised SendFileMQ (v1.5) designed to work under SuperBasic on earlier QDOS ROMS with earlier TKv2, such as JS. through Minerva and of course, SBASIC on SMSQE.

For convenience, I also provide my own 32-bit bit-wise function extensions (long_ops_v20.bin).

Looking forward to hearing more feedback - especially from anyone trying it out on uQLx/sQLUX.

M.
Attachments
SendFileMQv15_bas.zip
(9.41 KiB) Downloaded 89 times
long_ops_v20.zip
(2.85 KiB) Downloaded 93 times


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: QLUB Adapter - Initial Release...

Post by mk79 »

Sooo, finished my board a few days ago. It's a simplified design using some FDS4465 Mosfet that is totally overkill but which I had laying around from prototyping an 8x8x8 LED cube 10 years ago ;) Results in a very simple circuit.

I had some trouble with the software, SMSQ/E kept crashing on me while QEmuLator worked fine. The culprit seems to be the DIY edline_code, it only started working after using the "Minerva" version that is also supplied in the same package. Haven't investigated this any further.

It might be of note that the PC side is hard coded to node 8, once I realized that everything started working (as a German saying says "once you do it right, it works").
QLUB_Marcel.jpg


Post Reply