[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: IIgs too fast for sound
- Subject: Re: IIgs too fast for sound
- From: dempson@actrix.gen.nz (David Empson)
- Date: Sun, 1 Jul 2001 22:30:48 +1200
- Newsgroups: comp.sys.apple2
- Organization: Empsoft
- References: <MHz%6.173502$ff.1346561@news-server.bigpond.net.au>
- User-agent: MacSOUP/2.4.2
- Xref: archiver1.google.com comp.sys.apple2:9796
ralmin <xbiber@bigpond.net.au> wrote:
> I have a machine-language routine for use by BASIC programs to play music on
> the Apple II, from a book that I've misplaced. It's given two byte-sized
> numbers, the length and pitch of the note to play, then you call the
> routine.
>
> READ N
> FOR I=1 to N
> READ L,P
> POKE 864,L: POKE 865,P: CALL 866: REM PLAY A NOTE
> FOR S=1 TO 5: NEXT S: REM SHORT BREAK BETWEEN NOTES
> NEXT T
>
> Anyway, it runs too fast on my IIgs (ROM 3) and produces a tone that's too
> high and internally out of tune. I've tried setting System Speed to Normal
> in the Control Panel and it made no difference. Why is this?
>
> Ralmin.
>
> PS: The routine is:
> 360: length
> 361: pitch
> 362: LDY 0361
> 365: LDX 0361
> 368: INX
> 369: BNE 0368
> 36B: LDA #04
> 36D: JSR FCA8 -- monitor WAIT routine
> 370: LDA C030 -- twiddle speaker
> 373: DEY
> 374: BNE 0365
> 376: DEC 0360
> 379: BNE 0362
> 37B: RTS
The first point is that the WAIT function internally sets the system
speed to normal for the duration of the wait, so changing the control
panel setting would have no effect on that part of the code.
The second point is that changing the control panel speed setting while
in BASIC doesn't always have the desired effect. If you press
Control-Apple-Escape while the computer is waiting for input at the
command prompt, it saves several system settings, including the speed,
and restores them when you exit from the CDA menu. The easiest way to
make a change to the speed setting stick is to press Control-Reset after
you get back to the command prompt.
Do you have an accelerator in your IIgs? If so, it must be set to obey
the system speed setting, so that switching to "normal" speed will
actually slow down the computer. In the case of the ZipGS, there is a
DIP switch called "CPS Follow" which enables this feature, and it is
enabled by default.
The main part of the problem is likely to be the various delay loops
outside of the WAIT routine, as they are probably running in fast mode
(including the "FOR S" loop in the BASIC program, but most importantly
the INX/BNE loop).