[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sound-makes only one click?
In article <362e4a64.1108849@news.bright.net>,
Jm <j_2001_m@dejanews.com> wrote:
>I have a program programming sound on my apple 2c. This is an exact
>transscript of what I typed.
>
>(turn on computer)
>(says "Check disk Drive")
>CTRL-RESET
>CALL -151
>(at monitor)
>!
>(at mini assembler)
>8500:LDA C036
> JMP 8500
>(blank line)
>8500G
>
>Instead of getting some kind of tone, I just get a single click...then
>silence and blackness until I push ctrl-break then it beeps and goes
>back into basic like usual. What could be wrong here? I know there's
>nothing wrong with the hardware because the computer beeps, plays
>music, etc in games. thank you!
The problem is you're trying to toggle the speaker too fast. Your code
toggles the speaker once every 7 microseconds, which is *much* faster than
the speaker is physically capable of responding to. You need to put some
kind of delay into the loop.
Like this, for example:
8500:LDA C030
LDX #0
JSR FB1E
JMP 8500
That delays using a call to PREAD, the paddle-reading subroutine. The
amount of time that PREAD takes depends strongly on the current setting of
paddle 0, so you get a tone that changes when you move your paddle or
joystick. (This program can make some *really* annoying sounds...)
- Neil Parker
P.S. You should always use $C030 to access the speaker, not $C036.
Location $C030 is guaranteed to always be connected to the speaker, but on
some Apple II's (the IIGS, for example), accessing $C036 just gets you
silence (and the current system speed settings).
--
Neil Parker, nparker@ssil.uoregon.edu, nparker@axis.llx.com,
http://axis.llx.com/~nparker/ (Note new addresses and home page!)
Unsolicited commercial e-mail is not welcome, and will be discarded unread.