Cursor Position (Invisible)

Anything QL Software or Programming Related.
Post Reply
User avatar
Mr_Navigator
QL Fanatic
Posts: 782
Joined: Mon Dec 13, 2010 11:17 pm
Location: UK, Essex
Contact:

Cursor Position (Invisible)

Post by Mr_Navigator »

Is there a way to determine the invisible cursor position on the BBQL after a random number of AT calls or PRINT statements ?

I don't want the graphic x,y such as somewhere between 0 - 512 and 0 - 256

I am after finding the character position 0-80 odd and y axis 0-22 roughly.

so something like

a = peek_something (mem_loc): b = peek_something (mem_loc+2)

a = x value
b = y value


===================================================================

Also is there a way to look at vertical screen pixels simultaneously or does it have to be a pixel at a time?

>>>>>x
000001
010101
011101
010011

So i would like to read some like

a = PEEK_D (mem), x
print a

would display "1111"


Many thanks
Lee


-----------------------------------------------------------------------------------
QLick here for the Back 2 the QL Blog http://backtotheql.blogspot.co.uk/
User avatar
tofro
Font of All Knowledge
Posts: 2724
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Cursor Position (Invisible)

Post by tofro »

Lee,

not without an S*BASIC extension.

Recommend you check DIYTK from Dilwyn's toolkits page. This has got an extension named CH_BASE that returns the base address of any channel definition block. For screen channels, this area of memory holds (amongst other interesting information) the cursor x and y position in character coordinates in the window.

Not sure I get your second question - Are you asking to peek screen pixels? In this case you need another variable from the channel definition block that holds the base address of the screen, then peek from there. Although it's not quite as simple as you may want it - color and flash bits are inter-mixed and extracting the exact color of a pixel is a bit more complicated than you might think.

If I remember right, DIY toolkit also had some functions to read screen pixels, to make your life a bit simpler.
Regards,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
pjw
QL Wafer Drive
Posts: 1322
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Cursor Position (Invisible)

Post by pjw »

I am after finding the character position 0-80 odd and y axis 0-22 roughly.
As already mentioned, you need an external toolkit. I use one with the keywords CHAN_W% and CHAN_L, probably similar in function to Tobias'es CHAN_BASE. I think youll find this one or similar in a DIY Toolkit. However, older versions may not cater for the new GD2 drivers used by Wman and SMSQ/E, which use an extended channel definition block. It shouldnt matter in this case, as these data are in the standard locations. Heres how you could use CHAN_W%:

Code: Select all

deffn SD_XPOS(ch) : ret CHAN_W%(#ch; 82): enddef: rem cursor X position
deffn SD_YPOS(ch) : ret CHAN_W%(#ch; 84): enddef: rem cursor Y position
(In SMSQ/E it might be possible to use the extended peek commands, ie no need for external toolkit, but I havent tried (or even thought this through ;) )

Per


Per
dont be happy. worry
- ?
Post Reply