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

Re: Ignore 6502 Cycles on Emulator



On Fri, 24 Oct 2003 04:04:17 +0000, Bryan Parkoff wrote:

>     I have been analyzing many 6502 emulator source code, but I know that
> they do not look very good.  One of them do not use cycle counter.  All 256
> opcodes ignore cycle counters.  It always starts at integer 60.  Each opcode
> is executed before integer one is subtracted from integer 60.  After it
> reaches to integer 0, emulation will be suspended in order to allow video
> and sound to be updated.
>     I wonder how can video and sound be so accurate without cycle counter.

Emulation of most Apple II video requires no timing information at all.
Bytes written to video memory cause certain patterns to appear on the
screen, without reference to time.

Timing is only important when the video output of a program depends on
the location of the raster beam. In this case, it is necessary to
count cycles to generate a correct emulation of the video display.

But most Apple II software doesn't depend on the beam, and works well
on an emulator that doesn't count cycles.

As for sound, it is probably sufficient (although not optimal) to assume
that every instruction takes the same (average) number of cycles. Choosing
a proper value for that average would be difficult, but maybe a rough
estimate, like "3", would produce acceptable audio output.

-Sheldon