CURPOS$

From CometWiki

Jump to: navigation, search

CURPOS$

System variable:  CURPOS$  
Length:  2  
Description:  The system variable named CURPOS$ contains the position of the cursor at the last data transmission from the video device.
The value is a two-byte hex string containing the cursor position in the form "@YYXX@" where "YY" represents the row and "XX" represents the column plus 1. 
(The minimum column value is 1 and the maximum is 64, 80, or 132, depending on the screen setting. 
To arrive at the actual cursor position, you must subtract 1 from the column value.) 
The CURPOS$ string must be converted as follows to achieve the cursor position in decimal: 

LENGTH 2 & LOCAL A$      ! Receiving variable for CURPOS$
LENGTH 2.0 & LOCAL X,Y   ! Numeric variables for row, column
.
.
.
A$ = CURPOS$                  ! Contents of A$ will be @YYXX@
Y = HEXDEC(SUB(A$,1,1))       ! Row value (decimal)
X = HEXDEC(SUB(A$,2,1)) - 1   ! Column value (decimal)
Personal tools