[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sound-makes only one click?
>8500:LDA $C036
>8502:JMP $8500
You are on the right track. But you are missing a couple of things.
#1 - Sound is produced on the a2 speaker by peeking and poking at the speaker
port repeatedly. Different rates of "reading/writing" will vary the tone.
#2 - I think you need to do a STA $CO36 as well. If I remember correctly,
reading pushed the speaker cone out, while storing a value retracted the
speaker cone. I could be wrong (and I propably am).
#3 - Doing a tight loop like the one above will only yield tones that a dog
might be able to hear. remember that your computer operates at 1Mhz.
Discounting overhead issues, the above code would cycle 250,000 times a second
(assuming LDA and JMP [direct] consume 2 cycles each, which may be wrong). That
is 250khz, which to my knowledge is MUCH beyond the range of human hearing.
doing something like this might work
(improvising assembly code...hehe... its been a LONG time)
(calling routine)
STX #80 (push decimal 128 onto the X register,
frequency delay value)
JSR _SpeakerOut (call the speaker out routine)
BRK
(speaker output)
_SpeakerOut
TXA (transfer X reg to the accumulator)
LDA $C036
STA $C036
_SpeakerOutLoop
DEC (decrement the accumulator)
CMP #00 (have we decremented to 0?)
BNE _SpeakerOutLoop (if not, delay some more)
JMP _SpeakerOut (click the speaker again).
Hope this helps....
:)
smentzer@ecom.net
But you need to remember that "reading" a value