PICO-8 Wiki
cursor( [x,] [y,] [col] )
Sets the left-margin cursor position for print().
The x coordinate of the upper left corner of the line. The default is 0.

The y coordinate of the upper left corner of the line. The default is 0.

(Optional) The palette index to set the pen color to.

An x,y,c tuple representing the previous cursor position and color.

The draw state maintains a cursor location (and a pen color) for printing text with the print() function. PICO-8 uses this to maintain a scrolling display, especially for the command prompt.

The coordinates passed in set the starting location of the next print() call as well as setting the left margin for all subsequent calls.

See print() for a more detailed explanation of the text cursor's behavior.

Other functions that affect the cursor[]

Calling cls() effectively also calls cursor(0, 0).

Calling print(str), without explicit coordinate arguments, will adjust the cursor's Y value when required for newlines and scrolling.

Calling print(str, x, y), with explicit coordinate arguments, effectively also calls cursor(x, y) after the entire string is printed.

Technical notes[]

The current cursor position is memory-mapped and may be read or written directly:

  • 0x5f26: cursor x position
  • 0x5f27: cursor y position
  • 0x5f25: pen color (see color())


-- set the cursor position to (20, 24).
cursor(20, 24)

print("line one")
print("line two")
print("line three")

-- get the cursor position from its memory-mapped addresses
cursor_x = peek(0x5f26)
cursor_y = peek(0x5f27)

See also[]