msdos.cpp

来自「DOS下采用中断接收数据的串口通讯的例子,很难找到的好东西!」· C++ 代码 · 共 41 行

CPP
41
字号
// *********************** 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 + =
减小字号Ctrl + -
显示快捷键?