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.

ModeCounter values (hex)
NTSC 256x19200-DA, D5-FF
NTSC 256x22400-EA, E5-FF
NTSC 256x24000-FF, 00-06
PAL 256x19200-F2, BA-FF
PAL 256x22400-FF, 00-02, CA-FF
PAL 256x24000-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.




Return to top
0.041s