How to find out if we are on PAL or NTSC?
I am trying to write a function that gets an audio frequency and then returns the nearest AUDxPER value to be used for that frequency. It works like this:
Code:
; PAL VERSION |
Check VPOSR http://www.winnicki.net/amiga/memmap/VPOSR.html
|
That tells you the vertical frequency of the currently active screen mode (and only so if this is a native screen mode), but not the system clock frequency. To check for PALN/NTSC, please read the graphics/gfxbase.h include file, there is a flag for it. One is dynamic and changes with the active monitor, but for the system clock frequency, there is a flag named something like REALLYPAL that corresponds to the installed crystal.
|
Quote:
It tells you which version of Agnus/Alice you have installed, and usually is supposed to have its associated crystal. It has nothing to do with active video mode, as with both crystals and versions of Agnus-hr/Alice you can have NTSC or PAL lines. |
Quote:
Code:
; d0 - frequency*100 |
Quote:
|
Just noticed.. you sure used values are perfect?
In literature are reported values for PAL CCK = 3546895 and for NTSC = 3579545 |
Quote:
|
Quote:
On NTSC is even more different due to alternating length lines (it only average to 64us EDIT:~63,56us). So use my posted values :) |
Quote:
|
Quote:
|
Quote:
The current idea I am working on is: 1) find a vposr/hvposr nearby that we will use to start the whole thing 2) precalculate vposr/hvposr for all the next steps knowing the delays we want to have 3) vposr/hvposr wait to: start up the dma 4) vposr/hvposr wait to: stop the dma when we started playing the 2nd sample from the first pair 5) vposr/hvposr wait to: write to channel 0 when all of the channels are on idle 6) vposr/hvposr wait to: write to channel 1 at 90 degrees 7) vposr/hvposr wait to: write to channel 3 at 180 degrees 8) vposr/hvposr wait to: write to channel 2 at 270 degrees 9) fire up the audio DMA again So the uneven scanlines are a problem, yes. |
In my library, I do it this way: https://github.com/skeetor/amiga-uti...stemTakeover.s (line 21)
|
Quote:
|
Quote:
|
Quote:
furthermore I seem to remember that in some condition there is a bug in the KS1.x in reporting this value. Quote:
Quote:
As EClockFrequency (the base clock for CIA chips) is CCK/5 then you need EClockFrequency*500.. |
Quote:
The crystal frequencies are exactly 28.37516MHz for PAL and ~28.63636363MHz (repeating) for NTSC. These are nominal values, real case frequencies will be off by a small fraction because of crystal tolerances and possibly other external factors. So nominal Paula rates are: PAL: exactly 3546895Hz NTSC: ~3579545.45Hz (repeating) |
Quote:
|
Quote:
You need two independent sources to do what you written. |
Reading VFreq from Execbase is reliable - to reveal if the motherboard (and therefore the crystal, if Paula is used) is PAL or NTSC.
If you're turning off the system (say, for audio in games or demos), native modes are often used so that this is enough. If you're running in Workbench, it's best to use system functions for audio if possible, and the user shouldn't have to change his or her Workbench screen mode to play audio correctly. There are both native and expanded high-horizontal-frequency modes. |
All times are GMT +2. The time now is 17:46. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.