Mark Wickens

back to Command Reference

LOCATE

[All Models]

Purpose

Moves the cursor to a specified position on the virtual screen.

Format

LOCATE    X-coordinate     ,   Y-coordinate
          └────┬─────┘         └────┬─────┘
        Numeric expression   Numeric expression

Parameters

  1. X-coordinate: Numeric expression truncated to an integer in the range of 0 <= X-coordinate <= 32
  2. Y-coordinate: Numeric expression truncated to an integer in the range of 0 <= Y-coordinate <= 8

Explanation

  1. Locates the cursor at a specified position on the virtual screen.
  2. The origin of the coordinates is the upper left corner of the screen (0, 0). The X coordinate value is incremented for each character position to the right. The Y coordinate value is incremented for each line down.
          ┌────────────────────────────────┐
 (0, 0) > |                               | < (31, 0)
          |                                |
          |                                |
          |                                |
          |                                |
          |                                |
          |                                |
 (0, 7) > |                               | < (31, 7)
          └────────────────────────────────┘

See

Sample Program

10 CLS
20 LOCATE 0,0
30 PRINT "SCREEN UPPER LEFT";
40 GOTO 20

Displays messages from upper left of display.