Page 1 of 1

Cursor Position (Invisible)

Posted: Wed Apr 08, 2015 2:11 pm
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

Re: Cursor Position (Invisible)

Posted: Wed Apr 08, 2015 2:59 pm
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

Re: Cursor Position (Invisible)

Posted: Wed Apr 08, 2015 3:31 pm
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