For Help!!!---在Dev-c++(4.9.9.2)中嵌入汇编出错 ----急!!!
代码如下:#include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <dos.h>
#include <windows.h>
using namespace std;
bool IsNT()//判断是NT
{
bool blNT;
DWORD dwVersion=GetVersion();
if(dwVersion<0x80000000) //NT
blNT=true;
else blNT=false;
return blNT;
}
void PlayWarnningSound(int delay,int freq)
{
const int scale=1193180 ;
WORD freqTemp =(WORD)(scale/freq) ;
if (IsNT()) //NT,2000 and XP
{
_beep(freq,delay);
return ;
}
asm
(
"in al,61h"
"or al,3 "
"out 61h,al"
"mov al,0xb6"
"out 43h,al"
"mov ax, freqTemp"
"out 42h,al"
"mov al,ah"
"out 42h,al"
);
Sleep(delay);
asm //关闭声音
(
"in al,0x61"
"and al,0xfc"
"out 61H,al"
);
}
int main(void)
{
_beep(2000,50);
system("PAUSE");
PlayWarnningSound(150,120);
PlayWarnningSound(150,300);
system("PAUSE");
return 0;
}
------------
编译后提示:
Assembler messages:
too many memory references for `in'
too many memory references for `in'
D:\C++\DEV-CPP\Examples\Makefile.win [Build Error] [main.o] Error 1