DOS下DSP播音的编程毕业论文(4)
2015-06-03 01:35
导读:while(Port0x260)!Found) {//测端口基址 outportb(Port+6,1); outportb(Port+6,0); cnt2=n2; while(cnt22 inportb(Port+0xe)128)--cnt2; if(cnt2=0||inportb(Port+0xa)!=oxaa) { --cnt1; if(cnt1==0) { cnt1=n1
while(Port≤0x260)&&!Found)
{//测端口基址
outportb(Port+6,1);
outportb(Port+6,0);
cnt2=n2;
while(cnt2>2 && inportb(Port+0xe)<128)--cnt2;
if(cnt2=0||inportb(Port+0xa)!=oxaa)
{
--cnt1;
if(cnt1==0)
{
cnt1=n1;
Port=Port+0x10;
}
}
else Found=1;//找到基址
}
if(!Found)errexit("Reset failed\n");//找不到基址
}
void outwave(unsigned char huge *p,long len)
{//发送声音数据
long i;
int smpl;
smpl=44100/whead.samplespersec/whead.blockalign;
//采样周期系数
for(i=0;i{
WritePortC(0x10);//发送命令
WritePortC(p[i]);//发送数据
while(Counter}
}
void WritePortC(unsigned char v)
{
while(inportb(Port+0xc)&0x80);//等待写有效状态
outportb(Port+0xc,v);//写端口(发送)
}
void errexit(char *msg)
{
-AX=3;
asm int 10h
printf(msg);
exit(0);
}
//Timer.h
#includ
#define OldTimerInt 0x60
unsigned long Counter;
unsigned CounterInt8,fpI8;
void SetTimer(void interrupt(*Rout)(…),unsigned freq)
{//设置新频率的定时中断
int ICnt;