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

Re: IIgs too fast for sound



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?

Not sure about that, but let's see if we can fix it...

: 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

Hmmm...You might try fiddling with the value in $036C in order to increase
the time delay between speaker twiddles.  That's an interesting routine in
that it is the only one I have seen with a little trick in it to make sure
that given a particular duration, the length of the note will be the same
regardless of the pitch...typically the higher pitches will give shorter
notes without that Y loop in there.

Another option would be to put some kind of delay loop into the INX loop,
but of course if you do that with Y you'll have to store Y and then
recover it later.  But you might try something like...

(ORG $368)
    TYA
    LDY #$04
DLA DEY
    BNE DLA
    TAY

added into the code to slow it down.

--Dave Althoff, ][.
-- 
    /X\        _       _               _  *** Now open every day! ***
   /XXX\      /X\     /X\_      _     /X\__      _     _        _____  
  /XXXXX\    /XXX\  _/XXXX\_   /X\   /XXXXX\    /X\   /X\      /XXXXX
_/XXXXXXX\__/XXXXX\/XXXXXXXX\_/XXX\_/XXXXXXX\__/XXX\_/XXX\_/\_/XXXXXX