⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msdos.cpp

📁 DOS下采用中断接收数据的串口通讯的例子,很难找到的好东西!
💻 CPP
字号:
// *********************** START OF MSDOS.CPP ***********************
//
// Copyright (c) 1992 Mark R. Nelson. All Rights Reserved.
//
//
// This module contains O/S-specific routines.  These routines are
// all defined for MS-DOS.  When the target OS is OS/2, Windows, or
// UNIX, different versions of these routines must be linked in.
//

#include <dos.h>
#include "rs232.h"

// The default idle function for MS-DOS does nothing.

int RS232::IdleFunction( void )
{
    return RS232_SUCCESS;
}

//
// ReadTime() returns the current time of day in milliseconds.
//

long ReadTime( void )
{
    union REGS r;
    long milliseconds;

    r.h.ah = 0x2c;
    int86( 0x21, &r, &r );
    milliseconds = (long) r.h.dl * 10;        // dl : hundredths
    milliseconds += (long) r.h.dh * 1000;     // dh : seconds
    milliseconds += (long) r.h.cl * 60000L;   // cl : minutes
    milliseconds += (long) r.h.ch * 3600000L; // ch : hours
    return( milliseconds );
}

// *********************** END OF MSDOS.CPP ***********************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -