首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

在TC3.0中程序有一个报错:undefined symbol 'eax'应该如何改

2013-11-05 
在TC3.0中程序有一个报错:undefined symbol ⟪x'应该怎么改?#includestdio.h#includedos.h

在TC3.0中程序有一个报错:undefined symbol 'eax'应该怎么改?
#include<stdio.h>
#include<dos.h>
int main()
{
 void iowrite(short int port1,unsigned long int value);
 unsigned long int ioread(short int port);
 short int Config_Add=0xcf8;
 short int Config_Dat=0xcfc;
 int bus=00,dev=00,fun=00,offset=00;
 unsigned long int dat;
 iowrite(Config_Add,(0x80000000 |(bus<<16) |(dev<<11) |(fun<<8) |(offset<<2)));
 dat=ioread(Config_Dat);
 printf("%x",dat);
 return 0;
 }

 void iowrite(short int port1,unsigned long int value)
    {
      asm{
     mov dx,port1
     mov eax,value        /*Undefined symbol 'eax'*/
     out dx,eax
 }
     }
 unsigned long int ioread(short int port)
  {
   asm{
    mov dx,port
    in eax,dx
      }
    return 0;
    }
我是想编一个在dos下运行的读pci程序,这是个雏形,在TC3.0有如上所描述的一个错误,望各位高手指教如何修改。谢谢!
[解决办法]

引用:
asm{
      mov dx,port1
      db  66h      /* 66h 是我瞎写的,查下x86汇编,看mov ax,1和mov eax,1前面差哪个机器码 */
      mov ax,value        /*Undefined symbol 'eax'*/
      db  66h      /* 同上 */
      out dx,ax
}


嘿嘿,刚查了下,66h是对的,过了10多年,居然没记错,开始佩服自己了。。。

//mov reg32, imm    0110 0110 1011 1rrr [imm32]
//mov reg16, imm              1011 1rrr [imm16]
//out port, ax                1110 0111 [port8]
//out port, eax     0110 0110 1110 0111 [port8]

热点排行