-
-
[求助]VC2008怎么设置才可以编译这样的汇编代码?
-
发表于: 2011-4-13 16:05 4178
-
C语言嵌入汇编,汇编里面又嵌入了机器码,编译的时候通不过,求解!
#include "stdio.h"
#include "conio.h"
#include "dos.h"
typedef unsigned long DWORD ;
typedef unsigned int WORD ;
typedef unsigned char BYTE ;
DWORD dwSPIBAR;
DWORD ReadPcie( BYTE Bus,BYTE Device, BYTE Fun, WORD Register)
{
DWORD dwRet ;
Device = Device << 3;
_asm{
lea bx, dwRet;
mov al, Device;
add al, Fun;
mov cl, Bus ;
mov dx, Register;
__emit__(
0x66, 0x52,
0x66 ,0x50,
0x66, 0x51,
0x66, 0x53,
0x66, 0x56,
0x55,
0x54,
0x66 ,0xbE ,0x00,0x00,0x00,0xE0 ,
0x66 ,0x0F ,0xB6 ,0xC0 ,
0x66 ,0xC1 ,0xE0 ,0xc ,
0x66 ,0x03 ,0xF0 ,
0x66, 0x0F, 0xB6 ,0xC1 ,
0x66,0xC1, 0xE0 ,0x20 ,
0x66, 0x03 ,0xF0 ,
0x81 ,0xE2 ,0xFF ,0x0F ,
0x66 ,0x0F ,0xB7 ,0xC2 ,
0x66 ,0x03 ,0xF0 ,
0x33, 0xC0,
0x8E, 0xC0,
0x26, 0x67, 0x66 ,0x8B ,0x06 ,
0x66 ,0x89 ,0x07 ,
0x5C,
0x5D,
0x66, 0x5E,
0x66, 0x5B,
0x66, 0x59,
0x66 ,0x58 ,
0x66 ,0x5A
);
}
return dwRet;
}
void main()
{
int Bus=0x0,Device=0x1f,Fun=0x0;
WORD Register=0xf0;
dwSPIBAR=ReadPcie(Bus,Device,Fun,Register)+0x3800h;
printf("SPI Address : %08lx",dwSPIBAR);
}
赞赏
他的文章
看原图
赞赏
雪币:
留言: