An extension for 20ms would be easy enough!NL_QL_Usr wrote: Thu Jul 25, 2024 9:43 am I have tried the examples....
But I think it is still a pity that there seems not a precise sync timer in .01 or .001 seconds independent of the platform.
Timer in SuperBasic?
- XorA
- Site Admin
- Posts: 1609
- Joined: Thu Jun 02, 2011 11:31 am
- Location: Shotts, North Lanarkshire, Scotland, UK
Re: Timer in SuperBasic?
-
- Font of All Knowledge
- Posts: 4655
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: Timer in SuperBasic?
Hi,
Why look at QL World 1989 May page 14, DIY Toolkit Stopwatches.
Where Simon Goodwin develops QDOS Timer routines in assembley language routines,
See QL Homepage for magazine and code files.
Why look at QL World 1989 May page 14, DIY Toolkit Stopwatches.
Where Simon Goodwin develops QDOS Timer routines in assembley language routines,
See QL Homepage for magazine and code files.
Regards,
Derek
Derek
Re: Timer in SuperBasic?
That's more or less the exact same thing I posted in my first answer. Dilwyn has taken Simon's code and slightly improved it.Derek_Stewart wrote: Thu Jul 25, 2024 6:49 pm Hi,
Why look at QL World 1989 May page 14, DIY Toolkit Stopwatches.
Where Simon Goodwin develops QDOS Timer routines in assembley language routines,
See QL Homepage for magazine and code files.
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: Timer in SuperBasic?
Youre right!!tofro wrote: Thu Jul 25, 2024 8:43 pm
That's more or less the exact same thing I posted in my first answer. Dilwyn has taken Simon's code and slightly improved it.
I didn't tried it on the right way at first...
But it is very usable!!!
Thanks all!

100 REMark test timer
110 :
120 REMark lrespr WIN2_ext_timing_cde
130 :
140 t1=10 :c1=0
150 x=0
160 tst
170 :
180 DEFine PROCedure tst
190 T_START 1
200 T_ON 1
210 REPeat l
220 t=T_COUNT(1)
230 IF t=t1
240 c1=c1+1
250 AT 0,0:PRINT FDEC$(c1,6,0)
260 T_START 1
270 SCROLL #2,1
280 END IF
290 x=x+1:AT 0,20:PRINT FDEC$(x,6,0)
300 END REPeat l
310 END DEFine
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Timer in SuperBasic?
Hi NL_QL_Usr,
Quote << But I think it is still a pity that there seems not a precise sync timer in .01 or .001 seconds independent of the platform. >>
Does Simon Goodwin's code fit the bill completely ? I have just cobbled together some Basic Code which does....
You can time from units of 1 sec down to 1E-6 sec units, tried and tested under QPC2 & SGC under QDOS or SMSQ/E.
It ajusts itself instantly to take account of any system & overheads, which can vary a lot with multitasking and multicores.
Being adapted to make music 'silent beeps' dead accurate, at any tempo.
Not yet fully ready for release, as I need to adapt it a liitle for user friendliness, but it is still simple to use as it stands. Steve.
______________________________
Quote << But I think it is still a pity that there seems not a precise sync timer in .01 or .001 seconds independent of the platform. >>
Does Simon Goodwin's code fit the bill completely ? I have just cobbled together some Basic Code which does....
You can time from units of 1 sec down to 1E-6 sec units, tried and tested under QPC2 & SGC under QDOS or SMSQ/E.
It ajusts itself instantly to take account of any system & overheads, which can vary a lot with multitasking and multicores.
Being adapted to make music 'silent beeps' dead accurate, at any tempo.
Not yet fully ready for release, as I need to adapt it a liitle for user friendliness, but it is still simple to use as it stands. Steve.
______________________________
Re: Timer in SuperBasic?
Great work sounds very promising!stevepoole wrote: Sat Jul 27, 2024 5:56 pm
It ajusts itself instantly to take account of any system & overheads, which can vary a lot with multitasking and multicores.
Being adapted to make music 'silent beeps' dead accurate, at any tempo.
Not yet fully ready for release, as I need to adapt it a liitle for user friendliness, but it is still simple to use as it stands. Steve.
______________________________
your auto adjusting is a very good idea I am looking forward to see it!!

-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Timer in SuperBasic?
Hi NL_QL_Usr,
Here is the Beta version of my Superbasic TIMER_bas, (2ko). UNZIP & LRUN the demo, (which here times filled circles with random inks).
Timings shown are selectable (on line 250) : 1/1, 1/10, 1/100, 1/1000, 1/0000 or 1/100000 of a second units.
Put your own code to time between lines 671 and 699. ( but do not delete any lines with a 'warning remark', these are vital ! ).
Extra routines : BIP (corrects QL's 'BEEPING' weakness), BEP (can produce accurate rest notes), and WAIT (can pause any, say, secs/n...)
Tested ok under QPC2, SGC with QDOS or SMSQ/E. Should adapt correctly to any configuration or overheads whilst running. Regards, Steve.
Here is the Beta version of my Superbasic TIMER_bas, (2ko). UNZIP & LRUN the demo, (which here times filled circles with random inks).
Timings shown are selectable (on line 250) : 1/1, 1/10, 1/100, 1/1000, 1/0000 or 1/100000 of a second units.
Put your own code to time between lines 671 and 699. ( but do not delete any lines with a 'warning remark', these are vital ! ).
Extra routines : BIP (corrects QL's 'BEEPING' weakness), BEP (can produce accurate rest notes), and WAIT (can pause any, say, secs/n...)
Tested ok under QPC2, SGC with QDOS or SMSQ/E. Should adapt correctly to any configuration or overheads whilst running. Regards, Steve.
-
- Aurora
- Posts: 888
- Joined: Mon Nov 24, 2014 2:03 pm
Re: Timer in SuperBasic?
Hi Folks,
If you notice any (insignificant) slight variations on your results, it is because your computer is multitasking during 1 sec timing !
If you REmark out lines 680 & 690, you can see the very slight (constant) overhead of the timing loop... Regards, Steve.
_________________________
If you notice any (insignificant) slight variations on your results, it is because your computer is multitasking during 1 sec timing !
If you REmark out lines 680 & 690, you can see the very slight (constant) overhead of the timing loop... Regards, Steve.
_________________________