Coordinates are handled similarly to how they would in a Cartesian plane, with the exception that the Y coordinate is reversed. X goes from 0 to 399, starting from the left side of the screen (left to right). Y goes from 0 to 239, starting from the top of the screen (top to bottom).