BASIC Text Cursor Statements and Functions - fvdhoef/aquarius-plus GitHub Wiki

LOCATE

TYPE: Extended BASIC screen statement

FORMAT: LOCATE column , row

Action: Moves the cursor to the specified spot on the screen.

  • column specifies the horizontal position of the new cursor location.
    • Illegal quantity error results if column is less than 1 or greater than 39 (40-column screen) or 79 (80-coumn screen).
  • row specifies the relative vertical position of the new cursor location.
    • Relative rows start at the second physical line of the text screen (the first line is reserved).
    • Illegal quantity error results if row is less than 0 or greater than 23.
Examples
 LOCATE 1,1:print"Hello" `

Prints Hello at top left of screen.

CLS:LOCATE 19,11:PRINT"&"

Clears the screen and prints & in the middle of the screen.

CURSOROFFSET

TYPE: plusBASIC v0.26 screen function

FORMAT: CURSOROFFSET

Action: Returns the offset in Screen RAM corresponding to the position of the cursor in the active text screen.

  • Returns a number in the range 41 through 999 for a 40-column screen, and 41 through 1999 for the 80-column screen.
  • This is the same number used in a corresponding POKE SCREEN and POKE COLOR statement or PEEK SCREEN and PEEK COLOR function.
Advanced `CURSOROFFSET` returns the value in the system variable `CURRAM` minus the starting address of Screen RAM.
Examples
LOCATE 7,9:PRINT CURSOR OFFSET

Prints 407 at relative line 9 and column 7 of the text screen.


CURSORX

TYPE: _plusBASIC screen function

FORMAT: CURSORX

Action: Returns the column number of the cursor in the active text screen.

  • Returns a number in the range 1 through 39 for a 40-column screen, and 1 through 79 for the 80-column screen.
Advanced The returned column number is calculated from value in the system variable `CURRAM`.
Examples
LOCATE 9,11:PRINT CURSORX

Prints 9 at relative line 11 and column 9 of the text screen.


CURSORY

TYPE: plusBASIC v0.26 screen function

FORMAT: CURSORY

Action: Returns the absolute line number of the cursor in the active text screen.

  • Returns a number in the range 0 through 24.
  • The number returned is equal to the a corresponding LOCATE statement row operand plus 1.
Advanced The returned column number is calculated from value in the system variable `CURRAM`.
Examples
LOCATE 5,13:PRINT CURSORY

Prints 14 at relative line 13 and column 5 of the text screen.


POS

TYPE: BASIC function

FORMAT: POS(arg)

Action: Returns the horizontal position of the cursor in the current line.

  • arg is dummy value.

Note: arg should always be 0. Other values are reserved for updated features.

Advanced `POS` returns the value in the system variable `TTYPOS`
Examples
PRINT "abc";POS(0)

Prints abc 3 at the beginning of a line.


CLEAR CURSOR

TYPE: plusBASIC screen function


FORMAT: CLEAR CURSOR

Action: Temporarily removes the cursor from the current text screen.

  • The cursor is replaced by the character underneath it in the text screen.
  • The cursor is restored when a PRINT or INPUT statement is executed or upon return to direct mode.
  • POKE SCREEN and POKE COLOR do not restore the cursor.
Examples
CLEAR CURSOR:POKE SCREEN 41,"Foo":PAUSE

Hides the cursor and displays the text Foo at column 1 and absolute row 1.

SET CURSOR

TYPE: plusBASIC screen function


FORMAT: SET CURSOR state

Action: Enables or disables display of the cursor.

  • state is either OFF to disable or ON to enable the cursor display.
    • Syntax error results if state is not one of the above values.
  • The cursor is reenabled when an INPUT statement is executed or upon return to direct mode.
  • PRINT, POKE SCREEN, and POKE COLOR do not restore the cursor.
⚠️ **GitHub.com Fallback** ⚠️