QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: PMACKAY on April 15, 2019, 09:03:06 pm

Title: [confusion cleared] [not really an error] timer error in qb64 1.3
Post by: PMACKAY on April 15, 2019, 09:03:06 pm
when using _free timer i have found it disrupts my display


i find that printing to my screen works fine but then it jumps to a on timer. i print something else eg.locate 24,1:print "timer";tim:return and on return it continues printing but in the wrong spot

I wonder if the timer does not push the display co ordinates on the stack and pop them off on return to continue where left off....

eg. push x,y screen location
      jsr timer (on gosub timer)
      pop x,y
      ret (end)

      timer:
      locate x,y
      print "what ever where even"
      ret (return from timer)

this what doing
xxxxxxxxxxxxxxxxxdxxxxx
xhellxxxxxxxxxxxxxxxxxxx
xxxxxxxxxo worlxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx

this what should be
xxxxxxxxxxxxxxxxxxxxxxx
xhello worldxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxx

its like it forgets the x,y on return
Title: Re: timer error in qb64 1.3
Post by: Raven_Singularity on April 16, 2019, 09:43:38 am
Try to break it down to the least QB64 code that produces the issue, then post that.
Title: Re: timer error in qb64 1.3
Post by: FellippeHeitor on April 16, 2019, 09:59:04 am
Quote
I wonder if the timer does not push the display co ordinates on the stack and pop them off on return to continue where left off....

Your expectations towards TIMER have never been a thing.

QB64 just launches a procedure when a set timer is reached. You must account for your cursor's position if your timed procedure will also print to screen.

Save the values of CSRLIN and POS(0) in your timed routine, then, before your timed routine leaves, restore coordinates.

https://www.qb64.org/wiki/CSRLIN

https://www.qb64.org/wiki/POS

https://www.qb64.org/wiki/LOCATE
Title: Re: timer error in qb64 1.3
Post by: PMACKAY on April 16, 2019, 10:31:02 am
thank you... fixed now.. re wrote the display routine and does as expected now... cheers :)
Title: Re: timer error in qb64 1.3
Post by: FellippeHeitor on April 16, 2019, 10:34:46 am
Cool!