TURBO'd app that hangs the QL on termination...

Anything QL Software or Programming Related.
martyn_hill
Super Gold Card
Posts: 662
Joined: Sat Oct 25, 2014 9:53 am

Re: TURBO'd app that hangs the QL on termination...

Postby martyn_hill » Thu Jan 28, 2021 12:16 am

Hi Michael!

Thank you so much for resurrecting my older thread to introduce your diagnostic tool, which sounds very promising!

As it happens, once I updated the QL-SD driver I never observed the hanging issue at termination again and shortly after that, commenced work on the QLUB Adapter project (which only now is coming to fruition!)

Funnily enough, it was the constant back-and-forth between QPC where I was developing that application and the QL where I had interfaced my son's Scalextric racing track (via some spare pins on the Hermes IPC) that prompted me to commence the QLUB Adapter project in the first place!

Once I turn my attention back to some 'proper' SBASIC/TURBO programming, I shall for sure use your tool to help diagnose any errors!

As for the Timer extension - the version I used is one I had adapted slightly from Simon's original DIYTK version just to support 8x timer instances (I needed 5 for the Scalextric project) - which I still use today.

Thanks again :-)


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

Re: TURBO'd app that hangs the QL on termination...

Postby tofro » Thu Jan 28, 2021 8:11 am

BTW:

It might be that the hang is actually caused by the timer extension: For sure this is chaining into the polling interrupt, and it might very well be it doesn't handle termination properly - Alas, it's a BASIC extension and wouldn't assume it's ever removed again (so doesn't remove itsself from the polling interrupt list), but when part of a TURBOed application, it actually is. So it could well be when you terminate the program the next polling tick goes astray if the code is removed from memory.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
mk79
Aurora
Posts: 903
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: TURBO'd app that hangs the QL on termination...

Postby mk79 » Thu Jan 28, 2021 8:18 am

Just one note, the timer extension, as-is, is not suited to be included into jobs because the system will crash if the job does not issue T_OFF before the job is exited or terminated (RJOB etc). It's relatively easy to fix this using a trick I learned from the Hotkey system. If anybody is curious, I used the same trick in my QMovie application, the sources are on my page.

Cheers, Marcel


User avatar
mk79
Aurora
Posts: 903
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: TURBO'd app that hangs the QL on termination...

Postby mk79 » Thu Jan 28, 2021 8:19 am

tofro wrote:BTW:
Heh, same thought in parallel :-)


User avatar
dilwyn
Mr QL
Posts: 1960
Joined: Wed Dec 01, 2010 10:39 pm

Re: TURBO'd app that hangs the QL on termination...

Postby dilwyn » Thu Jan 28, 2021 10:22 am

Thanks guys. I don't have the knowledge to safely modify the code, I'd probably just end up making it worse, so I've just added a strict warning to the package and the download page about its use in a compiled package.

Shame really, since timing less than one second units is one of the things I'm most often asked about. That package has one of the highest download figures on that page, amazingly.

If anyone feels confident enough to modify the code in the manner Marcel described, I'd happily replace it.

I *think* this is the code Marcel was referring to in the Movie Player:

Code: Select all

; This is a trick I learned from the Hotkey System:
; We need to clean up our poll routine even when the
; job is force-removed by RJOB. For this we pretend
; that our memory block is owned by a driver, which
; will automatically get notified when the memory
; block is freed upon job removal
   lea   job_removed(pc),a1
   move.l   a1,free_routine(a6)

   lea   free_routine+iod_iolk-iod_clos(a6),a1
   move.l   a1,chp_drlk-chp.len(a0) ; Fake driver entry

; Link in our own poll timer for the movie timing
   lea   poll(pc),a0
   move.l   a0,poll_routine(a6)
   moveq   #sms.lpol,d0
   lea   poll_link(a6),a0
   trap   #1


--
All things QL - http://www.dilwyn.me.uk
martyn_hill
Super Gold Card
Posts: 662
Joined: Sat Oct 25, 2014 9:53 am

Re: TURBO'd app that hangs the QL on termination...

Postby martyn_hill » Thu Jan 28, 2021 12:45 pm

Hi Toby!

tofro wrote:It might be that the hang is actually caused by the timer extension


In my case, all extensions are either made resident in a custom ROM or else (as in the Timer ext.) loaded in the BOOT file prior to EX'ing the Turbo task. T_OFF was included prior to termination in the task - though of course a forced RJOB would still cause problems, were the extension loaded as part of the task itself.

That not withstanding, this is a good piece of info to be recorded somewhere!

On my very long list of things to do eventually is to make a ROM'able version of the Timer extension - as well as the MEM driver - two extensions I use extensively in many of my apps but can't currently commit to ROM (NVRAM in my case, but same thing for this purpose.)

Thanks again to Michael for resurrecting this thread - his diagnostic tool looks very useful!



Who is online

Users browsing this forum: No registered users and 5 guests