×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Interupts

Interupts

Interupts

(OP)
Im having trouble w/ interupts.
I got the code off the web and am modifying it.
here is the code im having trouble w/

struct Ssoundcard card
{
    int intcount,autoinit,...
    void (interrupt far *oldintvector)(void);
    void (interrupt far *inthandler)();//
//**********inthandler wasn't declaired in original code
}

static void interrupt inthandler(Ssoundcard card)
{
   card.intcount++;

   if (!card.autoinit)/* Start next block first if not using auto-init DMA */
   {
      startblocksc(card);
      copydata(card);
      setcurblock(card,!card.curblock);    /* Toggle block */
   }

    updatevoices(card);
    mixvoices(card);

    if (card.autoinit)
    {
    copydata(card);
    setcurblock(card,!card.curblock);/* Toggle block */
    }

    inp(card.ackport);//Acknowled interrupt with sound card
    outp(0xA0, 0x20);//Acknowledg interrupt with PIC2
    outp(0x20, 0x20);//Acknowledg interrupt with PIC1
}

static void installhandler(Ssoundcard card)
{
   disable();
   outp(card.picmaskport, (inp(card.picmaskport) | card.irqstopmask));

1     card.oldintvector = _dos_getvect(card.irqintvector);
2     _dos_setvect(card.irqintvector, inthandler);

   outp(card.picmaskport, (inp(card.picmaskport) &   card.irqstartmask));
   enable();

   card.handlerinstalled = TRUE;
}

static void uninstallhandler(Ssoundcard card)
{
    disable();
    outp(card.picmaskport, (inp(card.picmaskport) | card.irqstopmask));

3      _dos_setvect(card.irqintvector, card.oldintvector);

    enable();

    card.handlerinstalled = FALSE;
}


im using borlandc v3.1 and the error messages im recieving
are
1  cannot convert 'void (interrupt far*)(...)' to 'void (interrupt far*)()'
1  cannot convert 'void (interrupt far*)(Ssoundcard)' to 'void (interrupt far*)(...)'
2  type mismatch in parameter '__isr' in call to '_dos_setvect(unsigned int, void (interrupt far*)(...)'
3  cannot convert 'void (interrupt far*)() to void (interrupt far*)(...)'
3  type mismatch in parameter '__isr' in call to '_dos_setvect(unsigned int, void (interrupt far*)(...)'

the original code was writen in C and im compiling in C++.
i understand what the error messages mean yet i don't understand interupt coding very much
any help would be very apprecitated.

RE: Interupts

Better take a peek at your header files and see just WHAT C++ expects the types to be...

I believe your only problem is matching the types.  The code looks perfectly fine.  You might just need to do type-casting.

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

RE: Interupts

(OP)
this code was written for c, didn't find that out until i change the compiler to c only, i have fixed the code to work with c++ though.
the interrupt handler needed to be
void interrupt inthandler(...) and i pulled the handler and install/uninstall out of the class/struct. im currently working on a way to keep the handler in a class with your interrupt vector help.
youve been a big help so thankyou alot!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close