『楼 主』:
DOS下C的一个代码,求解,谢谢.
以下是一个C写的DOS运行的代码,是一个程序的部分.是BIOS看门狗的,
请教一下具体每句的意思,如果用Debug 汇编怎么写. 谢谢了.
------------------------------------------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <stdlib.h>
#include <inlines/pc.h>
#include <dpmi.h>
#define INDEX_PORT 0x2e
#define DATA_PORT 0x2f
#define WDTBaseAddress 0xDF300000;
int selector[0];
__dpmi_meminfo mi[0];
void InitWDTimer()
{
mi[0].address=WDTBaseAddress; //WDT timer base address//
mi[0].size=0x10; //WDT register //
__dpmi_physical_address_mapping(&(mi[0]));
selector[0]=__dpmi_allocate_ldt_descriptors(1);
__dpmi_set_segment_base_address(selector[0],mi[0].address);
__dpmi_set_segment_limit(selector[0],mi[0].size-1);
}
void SetWDtimer(unsigned long timer)
{
_farsetsel(selector[0]);
//; perform unlock sequence for preload 1//
_farnspokeb(0x0C,0x80);
_farnspokeb(0x0C,0x86);
timer = timer * 1000; // Msec hange to Sec//
_farnspokel( 0x00, timer);
//; perform unlock sequence for preload 2//
_farnspokeb(0x0C,0x80);
_farnspokeb(0x0C,0x86);
_farnspokel(0x04, 0x01);
outportl(0x0cf8,0x8000EC00+0x68); //;enable WDT timer//
outportl(0x0cfc,0x00000002);
}
|