How to start a SBASIC from other languages (e. g. C, ASM)

A place to discuss general QL issues.
stevepoole
Super Gold Card
Posts: 712
Joined: Mon Nov 24, 2014 2:03 pm

Re: How to start a SBASIC from other languages (e. g. C, ASM)

Post by stevepoole »

Hi Norm,
I have simplified the KEYHOLE method : Now I just RESPR(buffer) in my BOOT program, and open a keyhole file to print the base address to.

Then any job can open the RAM keyhole file and input the buffer base address, which it can then use as required... So NoTHING required !

The deQuirked 'waves' now run fine on QPC2 and Qemulator, both as _bas and _task or _job files. They all also work on SGC with SMSQ/E, and SGC QDOS, albeit very slowly with the latter, because of the heavy graphics calculations involved. (Either EXEC or EX are used there).

I could test for inkey$ in the inner loop, which would make keyboard input much faster, and had to write my own PEEK_$ and POKE_$ for QDOS. The advantage with RESPR(), is that you can LRUN anything, without losing the buffer.

The KEYHOLE method is easy to code, as long as you don't overflow the buffer ! (Easy to monitor the string_$ length...). The learning curve is not steep !

Regards,
Steve.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: How to start a SBASIC from other languages (e. g. C, ASM)

Post by NormanDunbar »

Even simpler than before Steve, nice work.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
stevepoole
Super Gold Card
Posts: 712
Joined: Mon Nov 24, 2014 2:03 pm

Re: How to start a SBASIC from other languages (e. g. C, ASM)

Post by stevepoole »

Hi again,

The latest 'waves' program has inkey$ testing within the inner loops, as fast as we can get.

But the Qlib compiled jobs are much too slow under QDOS, because of heavy wave calculations.

What's more, the QDOS task_switching is so slow you have to wait seconds for jobs to switch, before they pass the poked keys !

So no instantaneous keying between QDOS jobs, but OK under SMSQ/E with _bas files.... how very strange.

Maybe someone has the explanation for this ?

Steve.


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: How to start a SBASIC from other languages (e. g. C, ASM)

Post by tofro »

QLiberated jobs on SMSQ/E run at about the same speed as "native" interpreted SBASIC programs - SBASIC is thus way faster than original SuperBASIC (or, put the other way round, compiling an SBASC program on SMSQ/E doesn't make it any (at least not much) faster).
On the QL with SuperBASIC, however, QLiberated jobs run much faster than the equivalent SuperBASIC program - SUperBASIC is slow. So, when you compare something running in interpreted SBASIC on SMSQ/E on, say, QPC2 to the same program QLiberated on a QL, you're basically comparing the same program running on two machines fith like 100-fold (or more) speed difference. No wonder it looks slow on a QL.....

The reason for the relatively slow job re-schedule is that when QDOS comes under heavy load, it will first slow down timeslicing in the scheduler (it wants to avoid the additional load caused by a task switch if not absolutely necessary). Because you're not using a system call that enters the scheduler for your communication (but rather write to shared memory), the rescheduling is delayed even more.

You can compile your program using the Turbo compiler - should give you considerable speed-up over Liberated programs on the QL.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
stevepoole
Super Gold Card
Posts: 712
Joined: Mon Nov 24, 2014 2:03 pm

Re: How to start a SBASIC from other languages (e. g. C, ASM)

Post by stevepoole »

Hi Tofro,

Thanks. Yes, These wave sub-programs compile OK under Turbo, but there are issues :

With EX, EXEC, EXECUTE or EXECUTE...TO..., the KEYHOLE method does transfer keypresses as usual instantly.

But, only the last task executed dsiplays its screen output... which is not true when the sub-programs_bas are EXed....

The KEYHOLE method will kill executed tasks in any order, but only the last remaining ones show on screen !

This means that the waves program has full backward compatibility, but not in terms of simultaneous screen outputs.

I am beginning to doubt if there is any workaround for this...

Regards, Steve.


Post Reply