First commit ~0,10
This commit is contained in:
57
WAVPLAV/SB.CPP
Normal file
57
WAVPLAV/SB.CPP
Normal file
@ -0,0 +1,57 @@
|
||||
#include <dos.h>
|
||||
|
||||
int SBDetect(void);
|
||||
void SBSendByte(unsigned char b);
|
||||
|
||||
/*
|
||||
Soporte de Sound Blaster
|
||||
*/
|
||||
|
||||
unsigned BPORT = 0x210,
|
||||
XPORT = 0x216,
|
||||
WPORT = 0x21C,
|
||||
RPORT = 0x21A,
|
||||
APORT = 0x21E;
|
||||
|
||||
char READY = 0xAA;
|
||||
|
||||
int SBDetect(void)
|
||||
{
|
||||
char Status,Ct;
|
||||
|
||||
Status = 0;
|
||||
while (Status!=READY && BPORT<0x270)
|
||||
{
|
||||
outportb(XPORT,1);
|
||||
outportb(XPORT,0);
|
||||
Ct = 0;
|
||||
while (Status!=READY && Ct<100)
|
||||
{
|
||||
Status = inportb(RPORT);
|
||||
Ct++;
|
||||
};
|
||||
if (Status!=READY)
|
||||
{
|
||||
BPORT += 0x10;
|
||||
XPORT += 0x10;
|
||||
WPORT += 0x10;
|
||||
RPORT += 0x10;
|
||||
APORT += 0x10;
|
||||
}
|
||||
}
|
||||
if (BPORT!=0x270)
|
||||
{
|
||||
while ((inport(WPORT) & 128) != 0);
|
||||
outportb(WPORT,0xD1);
|
||||
return(0);
|
||||
}
|
||||
else return(-1);
|
||||
}
|
||||
|
||||
void SBSendByte(unsigned char b)
|
||||
{
|
||||
while ((inport(WPORT) & 128) != 0);
|
||||
outportb(WPORT,0x10);
|
||||
while ((inport(WPORT) & 128) != 0);
|
||||
outportb(WPORT,b);
|
||||
}
|
Reference in New Issue
Block a user