Gets the VI's current half-line number
#include <ultra64.h> /* os.h */ u32 osViGetCurrentLine(void);
This function returns the half-line number currently being sampled. The least significant bit (LSB) of the line number is fixed at 0 during the non-interlace mode, but the field number (0 or 1) is inserted there in the interlace mode. Which of either the even number (0) or odd number (1) is being scanned can be determined from the field number that is returned (in interlace mode, one screen is displayed in two scans).
The VI is internally controlled in half-line (0.5 line) units by N64. Since there are 525 scan lines in the case of NTSC, the value of the 0.5 line units is used so that 262.5 lines are rendered in one frame. The current line number is obtained by dividing the half-line number obtained with this function by two.
Non-interlace : 0,2,4,6,...,524, 0,2,4,6,...,524
Interlace : 0,2,4,6,...,524, 1,3,5,7,...,523, 0,2,...
02/01/99 Completely rewritten.