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

Re: Steal RAM -- Question



sicklittlemonkey wrote:
mmphosis wrote:

I'm going to move my discussion about the "6502 store instruction
performing a read and write" to a new topic in
comp.sys.apple2.programmer

I don't think I can answer the original posters questions.


I'm sure regular readers here are well used to posts going off topic,
this being such a low volume group.

All I can do is say that I once thought the same as you but now believe
differently. In fact this morning before your post I did a quick test
on my //c, and there was no difference between LDA and STA.

Now, you will say there's a 65C02 in there, which is fair enough even
though I'm sure there is no difference on that account. I would be more
suspicious of differences in the integrated logic chips, and perhaps a
different amplifier circuit for the speaker.

The circuits are different.

In the ][, ][+, and //e, the speaker toggle drives a Darlington
transistor that drive the speaker with current in one state and
no current in the other state.

The "current" state is a relatively low-impedance drive to the
speaker, while the "no current" state is much higher impedance.

As a result, if you successively toggle the speaker, every alternate
toggle will make a louder click than the other.

When the toggle rate is faster than 100Hz or so, the asymmetry becomes
irrelevant, but at very low frequencies, it can cause the speaker to
sound like it's being toggled at half the actual toggle frequency.
(Of course, as the frequency increases, the dominant frequency produced
by toggling *is* half the toggle frequency!)

An more likely factor is something Linards Ticmanis brought up in a
fascinating previous discussion on Apple II speaker emulation. On his
Apple II the initial state of the speaker made a difference in how game
intro music etc sounded. His suggestion was to access $C030 before
running Ultima III, I think.

Since the initial state of the toggle is not generally predictable,
one either *should* or *should not* toggle the speaker for best results.
;-)

Also, googling this group I found that Andy McFadden had found what I
found in an even earlier Apple manual. In the thread titled "Does an
enhanced //e _ALWAYS_ have 80 col. support?" he quotes:


Apple II reference manual (1981 edition), page 20:

 A program can "reference" the address of the special location for the
 speaker by performing a "read" or "write" operation to that address.
 The data which are read or written are irrelevant, as it is the
 _address_ which throws the switch.  Note that a "write" operation on the
 Apple's 6502 microprocessor actually performs a "read" before the
 "write", so that if you use a "write" operation to flip any soft
 switch, you will actually throw that switch _twice_.  For toggle-type
 soft switches, such as the speaker switch, this means that a "write"
 operation to the special location controlling the switch will leave
 the switch in the same state it was in before the operation was
 performed.

This shows that people who write reference manuals don't always know
the correct answer, either.  ;-)

-michael

NadaNet networking for Apple II computers!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it's seriously underused."