Set cursor location
Function AddressDescription
PLOT FFF0Set cursor location

This routine either reads or sets the text cursor's location.

Reading cursor location

A call to this routine with the accumulator carry flag set loads the current position of the cursor on the screen (in X,Y coordinates) into the Y and X registers. Y is the column number of the cursor location (0-39), and X is the row number of the location of the cursor (0-24).

getCurPosGet current cursor position
SECSet Carry to read the text position
STXFREKZPStore the Row (0..24)
STYFREKZP+1Store the Column (0..39)

Note: FREKZP (0x00FB) in this example is a 4 byte block of zeropage memory unused by Basic or Kernal and is available for user code.

Setting cursor location

A call with the carry bit clear moves the cursor to X,Y as determined by the Y and X registers.


setCurPosSet the cursor position to Row 10 Column 5
CLCClear Carry to set the text position
LDX#10We want Row 10
LDY#5Column 5