NTSC interlace detail info needed

Basic and Machine Language

Moderator: Moderators

User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: NTSC interlace detail info needed

Post by Mike »

JonBrawn wrote:There's a bit about NTSC interlaced mode in my notes at HTTP://www.brawn.org/VIC-20/Video

However, there are some bits in there that don't make sense to me yet.

When in interlaced mode the odd and even frames each have about the same number of lines as a non-interlaced frame, which is not how interlaced video is supposed to work. I measured that an interlaced field has 1.5 lines more than a non-interlaced frame.

By convention, the field that starts with a full line is the odd field, its last line will be a half-line. The next field is the even field and will start with a half-line.
The NTSC VIC-I has the peculiarity though, that changes of $9004 (and the LSB of $9003) do not happen with HSync, rather they happen somewhere in the middle of a raster (please note the screen caption of the first test program here).

The PAL VIC-I shows more reasonable behaviour here, $9004/$9003 change during HSync. VICE gets both cases right.
mathop
Vic 20 Amateur
Posts: 40
Joined: Thu Aug 12, 2021 3:13 pm

Re: NTSC interlace detail info needed

Post by mathop »

Did some more digging. Hope this doesn't cause any more confusion. :)
In the 6560/6561 ROM there are two signals that can step the vertical counter.
In the PAL version the main step signal occurs at X=0, and there is a theoretical adjustment that can occur at X=35. But since PAL does not have interlace mode this never happens, so the raster counter always increases at X=0.
In the NTSC version the main step is at X=28, i.e. roughly halfway across the display (HSYNC normally starts at X=62). So there the display gets split into a left half and a right half, where the raster counter in the right half differs from the value in the left half.
There is a correction step in the vertical counter just before NTSC line 525 at X=61 when in interlace mode.
That would explain why the raster is 262 for only 33 cycles in the second field (33=61-28) and why there are only 32 cycles of raster 0 in the first field.

I believe the VIC raster counter and the NTSC line number then correspond as follows in interlace mode

Code: Select all

      VIC RASTER          NTSC LINE #
 left         right
 [...]
256          257            256
   256          257            519
257          258            257
   257          258            520
258          259            258
   258          259            521
259          260            259
   259          260            522
260          261            260
   260          261            523
261          262            261
   261          262            524
262            0            262
     0            1            525
  0                         263
(Note that in NTSC-world line 263 is a half-line.)
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: NTSC interlace detail info needed

Post by tokra »

mathop wrote: Sat Jan 29, 2022 1:13 pm Did some more digging. Hope this doesn't cause any more confusion. :)
Thanks! The more insight the better.
In the NTSC version [...] (HSYNC normally starts at X=62).
This number actually reminded me of another yet-unsolved-VIC-mystery:

viewtopic.php?f=2&t=8620&hilit=9002&start=45#p98846

It is the position at which a corruption will occur when pushing the screen to the right using $9000.

Is the HSYNC-position for PAL 68? Maybe you can have a look at that thread and the test-program to provide further insight on what the VIC is doing to cause the corruption. Lance had some good ideas, but no full explanation for some of the weirder corruptions yet. I will repost the test-program in the other thread since the original link to the "charflow.d64" is gone by now.
Post Reply