[comp.sys.apple] Interrupts & GS Sound Tools

tribby@hpindda.HP.COM (David Tribby) (06/09/89)

I'm working on a program that uses the GS Sound Tools, Note Synthesizer, and
Note Sequencer. One part of the program moves waveforms in and out of
DOC memory by calling the Sound Tool routines (MoveToRam, MoveFromRam?).
The Toolbox Reference (Vol II) has a "Warning" that interrupts must be
turned off while accessing the DOC RAM. My questions...

   Which interrupts must be off? The Sequencer interrupts are off
   during the moves, but do others have to be off as well?

   How does one turn interrupts off and on from TML Pascal? Miscellaneous
   Toolset routine? Inline procedure to invoke machine code? Assembly
   language subroutines?

   What happens if the interrupts are not off during the data moves?

Thanks in advance!

--Dave Tribby
                                   - - - - -
        ARPA: tribby%hpda@hplabs.HP.COM   UUCP: hplabs!hpda!tribby

dlyons@Apple.COM (David Lyons) (06/10/89)

In article <6230034@hpindda.HP.COM> tribby@hpindda.HP.COM (David Tribby) writes:
>I'm working on a program that uses the GS Sound Tools, Note Synthesizer, and
>Note Sequencer. One part of the program moves waveforms in and out of
>DOC memory by calling the Sound Tool routines (MoveToRam, MoveFromRam?).
>The Toolbox Reference (Vol II) has a "Warning" that interrupts must be
>turned off while accessing the DOC RAM. My questions...
>
>   Which interrupts must be off? The Sequencer interrupts are off
>   during the moves, but do others have to be off as well?

It's saying interrupts *in general* should be off during this time, to insure
that nothing touches the sound chip in the middle of the operation.  In
other words, do a PHP, SEI to disable interrupts, and do a PLP to restore
interrupts to their previous state.

>   How does one turn interrupts off and on from TML Pascal? Miscellaneous
>   Toolset routine? Inline procedure to invoke machine code? Assembly
>   language subroutines?

There is no toolbox function to enable or disable interrupts.  The other two
options are fine.  In standalone TML Pascal, inline assembly code is easiest:

PROCEDURE PHP; INLINE $08;
PROCEDURE SEI; INLINE $78;
PROCEDURE PLP; INLINE $28;

Then you just use PHP, SEI, and PLP as procedure calls whenever you want.

PROCEDURE MyProcedure;
BEGIN
  PHP;
  SEI;
  DoSomeNiftyStuff;
  PLP;
END;

>   What happens if the interrupts are not off during the data moves?

Bad things.  Maybe.  Or maybe not.  Or maybe only after you give your
program to thousands of people.

>--Dave Tribby
>        ARPA: tribby%hpda@hplabs.HP.COM   UUCP: hplabs!hpda!tribby

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.