[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: killing time in 6502 assembly
In comp.sys.cbm Patrick/RPG <cr@interlog.com> wrote:
> Now, in your code have something like:
> LDA RASTER
> - CMP RASTER
> BEQ -
> Loops until the value of RASTER changes, which is every 1/60th of a
> second. Now, multiply this by however long you want it to occur. IE:
> For one second, you would do that 60 times.
> Drawback is obvious: the smallest time slice you could get is 1/60th of
> a second. Of course, you could probably software-hack a method of
> getting down to multiples of 1/60th of a second, ie: 1/30th of a second,
> 1/120th of a second, etc.
Well, you will almost never get a multiple of 1/60th of a second exactly,
because the time you have to wait for the first raster varies.
Thus you get in average (N+0.5)/60th of a second when you wait for N
rasters.
And again, what others mentioned, in some parts of the world you'd
even get (N+0.5)/50th of a second, which is about 17% off.
The most correct way would be to determine the clock frequency
of the machine (by testing whether it is an NTSC or PAL machine)
and then compute the exact number of cycles for the amount of time
to wait and set a CIA timer with it.
Don't know how this works on a SuperCPU machine, though. But assuming
the base machine still runs at the same clock as without, this
should work as well.
Andre
--
Email address may be invalid. Use "fachat AT physik DOT tu-chemnitz DOT de"
------Fight SPAM - join CAUCE http://www.cauce.org------Thanks, spammers...
Andre Fachat, Institute of physics, Technische Universit�t Chemnitz, FRG
http://www.tu-chemnitz.de/~fachat