Author Topic: [confusion cleared] [not really an error] timer error in qb64 1.3  (Read 2870 times)

0 Members and 1 Guest are viewing this topic.

Offline PMACKAY

  • Forum Regular
  • Posts: 188
  • LIFE is Temporary
    • View Profile
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
« Last Edit: April 16, 2019, 10:36:31 am by odin »
MackyWhite

Offline Raven_Singularity

  • Forum Regular
  • Posts: 158
    • View Profile
Re: timer error in qb64 1.3
« Reply #1 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.

FellippeHeitor

  • Guest
Re: timer error in qb64 1.3
« Reply #2 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
« Last Edit: April 16, 2019, 10:02:11 am by FellippeHeitor »

Offline PMACKAY

  • Forum Regular
  • Posts: 188
  • LIFE is Temporary
    • View Profile
Re: timer error in qb64 1.3
« Reply #3 on: April 16, 2019, 10:31:02 am »
thank you... fixed now.. re wrote the display routine and does as expected now... cheers :)
MackyWhite

FellippeHeitor

  • Guest
Re: timer error in qb64 1.3
« Reply #4 on: April 16, 2019, 10:34:46 am »
Cool!