[comp.sys.amiga.hardware] VPOSR/VHPOSR

thomas@diku.dk (Thomas Nikolajsen) (06/14/91)

Background:
Inspired by the timer code in Tomas Rokickis old profiler I want to use
VPOSR/VHPOSR as a timer too (for adding per task time usage to Xoper;
not only per task switch number. For this task I think it is important
not to take up a CIA timer).

Question:
Which values (intervals) does the custom registers VPOSR/VHPOSR take?
Is the resolution 280ns; as given in the hardware manual?
Are there differences for PAL/NTSC machines (in intervals/resolution)?

For short lets call VPOSR/VHPOSR (32b) for VPOSR.l.
It is only the video position I am interested in, lets call it:
vpos_h = VPOSR.l and $ff      ; horizontal
vpos_v = VPOSR.l and $1ff00   ; vertical
In my rather old hardware manual it is just stated that the resolution
is '1/160 of the screen width or 280ns'.
I have made a little program to get emperical results, it gives (PAL):
vpos_h in 0 .. $e2   ( 0 .. 226 )
vpos_v in 0 .. $138  ( 0 .. 312 )
The problem is now that these values doesn't match the 280ns given in
the hardware manual:
312*226*280 ns = 1/50.65 s
but eg.
316*226*280 ns = 1/50.01 s
Which brings me to the other questions, is the 280ns value exact,
and is the resolution different for PAL/NTSC machines (what is it?)?

Is VPOSR.l a good timer (stable ..), does it count when video DMA is off
(haven't tried yet)?
I know (from the hardware manual) that it is unusable when a light pen
is connacted.
Which is the correct way to distinguish between PAL/NTSC machines (mode)?
Is it PowerSupplyFrequency(SysBase) or isn't there a VBlankFrequency(SysBase).

thomas@diku.dk, Thomas Nikolajsen, CS. Dept, U. of Copenhagen, Denmark