回复 9楼 wp231957
请指教一下还有什么方法可以代替呢....
我的原本代码是:
#include"stdio.h"
#include"dos.h"
#include"string.h"
#include"stdlib.h"
#include"conio.h"
unsigned long Read_VID_DID();
unsigned long ReadPci(unsigned long BusCount);
void ClearScreen(void);
#pragma inline
asm .486p
void main()
{
clrscr();
ClearScreen();
printf("********************- Check LAN type tool -********************* \n");
printf("*
Corporation Copyright (C) By RD Of
Ver:1.0
* \n");
printf("**************************************************************** \n");
printf("\n");
printf("\n");
Read_VID_DID();
}
unsigned long Read_VID_DID(unsigned long BusCount)
{
unsigned long PciData;
for(BusCount=0x80000000;BusCount<0x81000000;BusCount+=0x100)
{
PciData=ReadPci(BusCount);
if(PciData==0x0250197b)
//JMC LAN VID:DID
0250:197B
{
textcolor(2);
printf("This is JMC LAN chip! \n");
textcolor(WHITE);
system("JMCflash.bat");
}
if(PciData==0x817610ec)
//RTL LAN VID:DID
0250:197B
textcolor(2);
printf("This is RTL LAN chip! \n");
textcolor(WHITE);
system("RTLflash.bat");
// return(BusCount);
}
textcolor(4);
printf("The unknown LAN chip! \n");
textcolor(WHITE);
exit(1);
return(PciData);
}
unsigned long ReadPci(unsigned long BusCount)
{
unsigned long PCIdata;
asm{
mov dx, 0cf8h
mov eax, BusCount
out dx, eax
mov dx, 0cfch
in
eax, dx
mov PCIdata, eax
}
/*unsigned long port_a = 0x0cf8;
unsigned long port_d = 0x0cfc;
outport(port_a,BusCount);
PCIdata=inport(port_d);*/
return(PCIdata);
}
void ClearScreen(void)
{
unsigned int far *ptr=(unsigned int far *)0xb8000000;
int i;
for( i=0 ;i< 2000;i++)
ptr[i]=0x0720;
gotoxy(1,1);
}
[
本帖最后由 vopvcp 于 2012-10-29 15:06 编辑 ]