From: DavMac AT iname DOT com (Davin McCall) Newsgroups: comp.os.msdos.djgpp Subject: Re: newbie interrupt programmer Date: Fri, 21 May 1999 00:44:59 GMT Organization: Monash Uni Lines: 43 Distribution: world Message-ID: <3744ab46.8419473@newsserver.cc.monash.edu.au> References: NNTP-Posting-Host: damcc5.halls.monash.edu.au X-Trace: towncrier.cc.monash.edu.au 927247476 714 130.194.198.138 (21 May 1999 00:44:36 GMT) X-Complaints-To: abuse AT monash DOT edu DOT au NNTP-Posting-Date: 21 May 1999 00:44:36 GMT X-Newsreader: Forte Free Agent 1.1/32.230 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Thu, 20 May 1999 16:07:52 -0500, Mark Phillips wrote: You might need to declare 'donePlaying' as volatile (eg volatile int donePlaying;) or optimizations might mean its value is stored in a register throughout the while loop. Thus, even when the 'in memory' value changes, the while loop continues. Know assembler? You could try compiling to an .s file and see what code is produced (to see if the variable *is* being stored in a register). Alternatively, are you *sure* that your interrupt handler is being called? Is there any way you could make it give some other signal (write something to video memory, for instance). Have you enabled sound card interrupts in the PIC? Look at the FAQ for other things to try/other hints. Davin. > i'm trying to write a program that >will play a buffer of data to the soundblaster, and then quit when it's >done. it works fine, except that it doesn't quit when it's done. here's >the loop it gets stuck in: > >while ( !donePlaying ) {} > >donePlaying is a global bool. my interrupt function looks like this: > >static void interrupt_handler() >{ > inportb(interptAcknowlg8); // sb acknowledge > donePlaying = true; > outportb(0x20,0x20); // acknowledge interrupt > outportb(0xA0,0x20); >} > __________________________________________________________ *** davmac - sharkin'!! davmac AT iname DOT com *** my programming page: http://yoyo.cc.monash.edu.au/~davmac/