Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ysub!psuvm!dxb132 From: DXB132@psuvm.psu.edu Newsgroups: comp.sys.amiga.programmer Subject: Re: VPOSR/VHPOSR custom register values (which do they take) Message-ID: <91170.042954DXB132@psuvm.psu.edu> Date: 19 Jun 91 08:29:54 GMT References: <1991Jun18.120731.13523@odin.diku.dk> Organization: Penn State University Lines: 78 In article <1991Jun18.120731.13523@odin.diku.dk>, thomas@diku.dk (Thomas Nikolajsen) says: >Hello, I tried this question in comp.sys.amiga.hardware, to no avail, >so here we go (it isn't too hardware related anyway). >Please dig out the info, or if there is no answer then say it (Dave). >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). >As I want the timer to be as accurate as possible and work on all amigas, >(PAL/NTSC, AmigaOS version x.y) I need some info. >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)? Yes it's 280ns...well actually 28.63636Mhz divided by 4. The PAL base clock frequency is slightly slower, but very close. Note that PAL has 227 color clocks per horizontal line, whereas NTSC uses 227.5 (actually alternated 227..228...227 etc.) >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: >313*227*280 ns = 1/50.27 s >Vertical blank frequency if 50 Hz for PAL. >In the 'Introduction to the Amiga 500' which I got when I brought the Amiga, >Appendix F: 'Amiga 500 Schematics', page F-9 contains: Master Clock: X1 >Oscillator 28.63836 MHz. Which makes me believe that the resolution is: >1/(28.63836*1000000/8) s = 279.35 ns >which gives: >313*227*275.35 ns = 1/50.38 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?)? Your calculation is right, no it's not exactly 280. >Is VPOSR.l a good timer (stable ..), does it count when video DMA is off >(haven't tried yet)? It is perfect across horizontal blanking intervals. It is not quite perfect across vertical blanking intervals -- there are a few cycles where the horizontal and virtical parts don't agree. >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 VBlankFrequency(SysBase) or ..? For testing whether to use 227 or 227.5, use VBlankFreq. For determining the base frequency, test PowerSupplyFreq. (At least I think this will work best...it's really just a guess!) >I don't know much about hardware, I just try to use it (for programming). >When I have gotten this info, I will send off the diffs for xoper to >Werner Gu:nther, so he can include it in his next official version. >thomas@diku.dk, Thomas Nikolajsen, CS. Dept, U. of Copenhagen, Denmark Hope this helps a little... -- Dan Babcock