[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: killing time in 6502 assembly



On Sun, 07 Feb 1999 16:44:11 +0500, joker21@earthlink.net wrote:

> I'd never thought I'd say this, but the Nes is too fast!
> I'm trying to kill about 3/4 of a second. I've come up with this:
> [long string of nops]
> This just loops about 255*3 then comes back. Is there an opcode better
> that nop? Or a whole better why to do it?

If you're doing this on a Commodore product, the easiest (and most
dependable) way is just to watch the "jiffy timer", which is updated
by the interrupt services 60 times a second.  Count 45 jiffy changes,
and you're there.

On most other platforms, you'll have an I/O chip that contains a timer
.. set it and have it signal or interrupt you.

Paul Guertin posted code for a decent delay loop.  On a machine such
as the Commodore 128, you have to watch it, though:  the clock speed
can be changed by the user.  And new architectures which fit the 6502
family with a high-speed clock raise the same problems.  Look to a
jiffy or hardware timer of some sort.  Some even watch the video
raster to get timing data; again, this can be tricky since vertical
retrace differs in different parts of the world.

		 --Jim