Sega Master System / Mark III / Game Gear
The scanline counter is a VDP register that can be read from port $7E. The value tells you which line of the display is currently being rendered by the VDP. It is also known as the "V counter" or "V count".
For the active display, it consistently starts at 0 for the first displayed line and increments for the whole active display. However, how it behaves after that depends on the TV type (PAL/NTSC) and the video mode (whether extended modes are being used), not least because there are more than 256 lines per frame for both PAL and NTSC video output.
|Mode||Counter values (hex)|
|NTSC 256x192||00-DA, D5-FF|
|NTSC 256x224||00-EA, E5-FF|
|NTSC 256x240||00-FF, 00-06|
|PAL 256x192||00-F2, BA-FF|
|PAL 256x224||00-FF, 00-02, CA-FF|
|PAL 256x240||00-FF, 00-0A, D2-FF|
The NTSC 256x240 mode does not produce valid output, hence why its sequence is not 262 long. All of the PAL modes produce the 313 total lines needed for a progressive PAL display.