[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ignore 6502 Cycles on Emulator
- Subject: Re: Ignore 6502 Cycles on Emulator
- From: Sheldon Simms <sheldonsimms@yahoo.com>
- Date: Fri, 24 Oct 2003 14:42:09 -0400
- Newsgroups: comp.sys.apple2
- Organization: Posted via Supernews, http://www.supernews.com
- References: <5x1mb.3498$%x5.3139@twister.austin.rr.com> <pan.2003.10.24.12.57.43.704548@yahoo.com> <RRcmb.5508$%x5.3042@twister.austin.rr.com>
- User-agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)
- Xref: archiver1.google.com comp.sys.apple2:596
[top-posting corrected]
On Fri, 24 Oct 2003 16:57:21 +0000, Bryan Parkoff wrote:
> "Sheldon Simms" <sheldonsimms@yahoo.com> wrote in message
> pan.2003.10.24.12.57.43.704548@yahoo.com">news:pan.2003.10.24.12.57.43.704548@yahoo.com...
>> 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.
>>
> Okay, lets say that emulation does not have cycle counter as timing.
> How can we throttle it to 1MHz without cycle counter as timing?
The same way sound is handled -- assume that each instruction takes 3
cycles, or just say that 305,000 instructions equals one second. This
would obviously not be *exactly* 1Mhz, but it would be pretty close.
I should point out that I'm just making guesses. Personally I'm surprised
if there are emulators that don't count cycles because counting cycles
is not difficult and makes a lot of other stuff in the implementation
easier.
-Sheldon