[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 6502 false references?
As pointed out by others, indexed stores that don't cross a page
boundary will access the memory once for reading and once for
writing.
Indexed reads or writes that cross page boundaries will read once
at a non-carry-propogated address, and read/write once at the
correct address.
For purposes of emulating an Apple II speaker at $C030, treat the
read/write as a 1 microsecond push of the speaker in the opposite
direction from its current position. Remember that the speaker
cone is an analog device, having inertia and a physical state that
can be somewhere inbetween "on" and "off".
That's how Electric Duet, Music Construction Set and the like can
make multi-voice music: they push the speaker cone into states that
approximate 3 or more discrete physical positions.
Trivia: I once wrote a variable pulse-width digitizing program that
got quite pleasant sound quality. The time between pulses was
variable because it spread the carrier frequency semi-randomly,
reducing artifacts. It worked great for sampled sound, but didn't
apply to music synthesis *because* the carrier frequency changed
on-the-fly.
By the time I built it, Apple II software was rapidly dying in
the marketplace, so it never shipped with a product.
For fun, try jumping "n" cycles into the following binary stream:
301: C9
302: C9
...
37C: C9
37D: C5
37E: EA
37F: 60
Jumping to 37E takes 8 cycles (2 for the NOP, 6 for the RTS)
Jumping to 37D takes 9 cycles (3 for the CMP zp, 6 for the RTS)
Of course, nobody would do a JSR/RTS into code like this (a waste
of perfectly good cycles!) but it should give you an idea of how
6502 code might try to push a speaker around with higher precision.
Multiple cache layers, execution units, and even (gasp) floating
point units make today's processors seem positively *weird* compared
to the predictable behavior of the 6502. Counting cycles isn't
the art form it used to be.
- Jim
--
Jim Nitchals <jimn8@netcom.com>