亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? tsr.cpp

?? 多任務(wù)操作系統(tǒng)控制的DOS環(huán)境下的實(shí)現(xiàn)的C語(yǔ)言源程序。 利用時(shí)間片的方式
?? CPP
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
//--------------------------------------------------------------------------
//
//      TSR.CPP: body of DOS TSR class.
//      Copyright (c) J.English 1993.
//      Author's address: je@unix.brighton.ac.uk
//
//      Permission is granted to use copy and distribute the
//      information contained in this file provided that this
//      copyright notice is retained intact and that any software
//      or other document incorporating this file or parts thereof
//      makes the source code for the TSR class of which this file
//      is a part freely available.
//
//--------------------------------------------------------------------------
//
//      Note: this class is highly DOS specific and hence non-portable.
//      It also involves the use of assembly language and interrupt
//      functions, so it is also very compiler-specific.  Will require
//      modifications for use with compilers other than Borland C++ 3.0
//      or later.  If Borland compilers prior to version to version 3.0
//      are used, note that they do not support nesting of types within
//      classes (so TSR::F1 etc. will need changing to a global name F1)
//      and that the "_chain_intr" function used here was introduced with
//      version 3.0.
//
//      Revision history:
//      1.0     March 1993      Initial coding
//
//--------------------------------------------------------------------------

#include "tsr.h"
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <bios.h>

//--------------------------------------------------------------------------
//
//      Constants.
//
const int  MIN_STACK  = 512;            // minimum stack size in bytes
const int  ALT_FKEY   = 0x68 - TSR::F1; // hotkey change for Alt-Fn
const int  CTRL_FKEY  = 0x5E - TSR::F1; // hotkey change for Ctrl-Fn
const int  SHIFT_FKEY = 0x54 - TSR::F1; // hotkey change for Shift-Fn
const long DAY_LENGTH = 1573040L;       // length of day in timer ticks

const char far* COPYRIGHT = "C++ TSR class, Copyright (c) J.English 1993";
                                        // copyright notice for self-identify

//--------------------------------------------------------------------------
//
//      Global (static) variables.
//
static TSR* instance = 0;               // pointer to the TSR instance
static char TSRname [32];               // TSR identifying string
static unsigned char hotshift;          // shift state for hotkey
static unsigned char hotscan;           // scancode for hotkey
static int interval;                    // length of timeslice in timer ticks
static int TSRfunction;                 // Int 2F function used to find TSR

static char far* stack;                 // stack for TSR execution
static unsigned stacklen;               // size of TSR stack in bytes
static unsigned pspseg;                 // saved PSP segment
static unsigned dtaseg;                 // saved DTA segment
static unsigned dtaoff;                 // saved DTA offset
static volatile char far* indos;        // saved INDOS flag address
static volatile char far* critical;     // saved critical error flag address

static volatile int diskflag   = 0;     // set if disk interrupt in progress
static volatile int breakflag  = 0;     // set if ctrl-break has been pressed
static volatile int hotkeyflag = 0;     // set if hotkey pressed
static volatile int TSRrequest = 0;     // set if TSR should wake up
static volatile int TSRactive  = 0;     // set if TSR already active
static volatile long nexttick  = 0;     // next timer tick to wake up at

static volatile long far* timer    = (volatile long far*) MK_FP(0x40,0x6C);
static volatile char far* midnight = (volatile char far*) MK_FP(0x40,0x70);
                                        // timer values in BIOS data area

//--------------------------------------------------------------------------
//
//      Functions and function pointers.
//
typedef void interrupt (*Handler)(...); // interrupt handler address type

static Handler oldint8;                 // old int 8 vector  (timer)
static Handler oldint9;                 // old int 9 vector  (keyboard)
static Handler oldint13;                // old int 13 vector (disk)
static Handler oldint21;                // old int 21 vector (DOS services)
static Handler oldint23;                // old int 23 vector (control-break)
static Handler oldint24;                // old int 24 vector (critical error)
static Handler oldint28;                // old int 28 vector (DOS scheduler)
static Handler oldint2F;                // old int 2F vector (multiplex)

static int unhook ();                   // unload function used by int 2F

//--------------------------------------------------------------------------
//
//      Compare two far strings.
//
//      This is the same as "strcmp" except that we need a function to
//      compare far pointers in all memory models, and "strcmp" only
//      handles near pointers in the small and medium models.
//
int compare (const char far* a, const char far* b)
{
    while (*a == *b)
    {   if (*a == '\0')
            return 0;
        a++, b++;
    }
    return *a - *b;
}



//--------------------------------------------------------------------------
//
//      Check if a key has been pressed.
//
//      This nasty little routine is necessary because bioskey(1) does
//      not recognise extended keyboards and will swallow keystrokes
//      such as "ctrl-del" not supported on 84-key keyboards.  This
//      makes it necessary to use bioskey(0x11) instead, but there
//      is a problem in that this function does not leave AX clear
//      if no key has been pressed (it just sets the zero flag) so
//      some assembler is needed to deal with this.  It also means
//      this library will not work with old (pre-AT) BIOSes that
//      don't support int 16h, function 11h.
//
int check_key ()
{
    asm {
        mov ah,0x11;        // do function 11h,
        int 0x16;           // ... int 16h
        jnz key_found;      // skip if a key has been pressed
        mov ax,0;           // else set AX = 0
    };
  key_found:
    return _AX;
}

//--------------------------------------------------------------------------
//
//      Int 08 (timer) handler.
//
//      This handler first calls the original timer handler and then
//      checks if either timeslicing has been selected or the hotkey
//      has been pressed (as shown by "hotkeyflag").  If so, the TSR
//      request flag is set.  If DOS is in a safe state, the TSR is
//      then activated.
//
static void interrupt TSRint8 ()
{
    // chain to old int 8
    oldint8 ();

    // exit if TSR is already running
    if (TSRactive)
        return;

    // amend "nexttick" if midnight has passed
    if (*midnight != 0 && nexttick >= DAY_LENGTH)
        nexttick -= DAY_LENGTH;

    // check if TSR should be activated
    if (hotkeyflag == 0 && (interval == 0 || (*timer - nexttick) < 0))
        return;

    // set request flag if so
    TSRrequest = 1;

    // reset timer if past last activation period
    if (interval != 0 && (*timer - nexttick) >= 0)
        nexttick += interval;

    // activate TSR if DOS is safe
    if (*indos == 0 && *critical == 0 && diskflag == 0)
        activate ();
}

//--------------------------------------------------------------------------
//
//      Int 09 (keyboard) handler.
//
//      This handler first calls the original keyboard handler (with
//      interrupts enabled) and then looks to see if the keys pressed
//      match the hotkey.  If so, "hotkeyflag" is set.  If a keycode
//      is included in the hotkey code (i.e. it is not just a set of
//      shift keys only) the key is removed from the keyboard buffer.
//
static void interrupt TSRint9 ()
{
    // chain to old int 9
    asm { sti; }
    oldint9 ();

    // check if TSR uses hotkey
    if (hotshift == 0 && hotscan == 0)
        return;

    // check if hotkey modifier keys are pressed
    if ((bioskey(2) & 0x0F) != hotshift)
        return;

    // check if hotkey (if any) has been pressed
    if (hotscan == 0 || (check_key() >> 8) == hotscan)
    {   hotkeyflag = 1;
        if (hotscan != 0)
            bioskey (0x10);
    }
}

//--------------------------------------------------------------------------
//
//      Int 13 (disk) handler.
//
//      This handler sets a flag to show that a (time-critical) disk
//      transfer is in progress and then calls the original disk handler.
//      It is declared as a far non-interrupt function, although it will
//      be called as an interrupt handler; the code here does not affect
//      any registers, and we want the flag settings from the original
//      disk handler to be returned to the caller.
//
//      On entry, BP has been pushed on the stack.  DS must be set up
//      so that "diskflag" and "oldint13" can be accessed, so DS is
//      pushed on the stack and the BP is used to reset it.  On exit,
//      DS and BP are popped from the stack and we return via a RETF 2
//      which will throw away the flag register on the stack below the
//      return address.
//
//      The code here is highly dependent on the compiler-generated entry
//      sequence, so CHECK WITH CARE if any compiler other than Borland
//      is being used!
//      
static void far TSRint13 ()
{
    // set correct data segment
    asm { push ds; mov bp,seg diskflag; mov ds,bp; }

    // set flag while disk operation in progress
    diskflag = 1;

    // chain to old int 13
    oldint13 ();

    // clear disk flag
    diskflag = 0;

    // return using "retf 2" to leave flags intact
    asm { pop ds; pop bp; retf 2; }
}

//--------------------------------------------------------------------------
//
//      Int 21 (DOS service) handler.
//
//      This handler is installed immediately prior to activating the
//      TSR, and checks that the TSR does not call any unsafe services.
//      The unsafe services are 00-0C (character I/O services), 3E (close
//      file) for standard handles (0-4), 48 (allocate memory) and 4C
//      (terminate process), or functions above 0C if a critical error
//      is being handled.  If any of these are called from the TSR, the
//      virtual function "dos_error" will be called with the service
//      number as a parameter.  All other calls are passed to DOS in
//      the normal way.
//
static void interrupt TSRint21 (unsigned,    unsigned,    unsigned,
                                unsigned,    unsigned,    unsigned,
                                unsigned,    unsigned bx, unsigned ax,
                                unsigned ip, unsigned cs)
{
    // static flag keeps track of whether called from "dos_error"
    static int dosflag = 0;
    
    // ignore DOS calls from within "dos_error"
    if (dosflag != 0)
        return;

    // trap and ignore unsafe calls
    const unsigned ah = ax >> 8;
    if ((!*critical && (ah <= 0x0C || ah == 0x48 || ah == 0x4C
                        || (ah == 0x3E && bx <= 4)))
        || (*critical && ah > 0x0C))
    {   dosflag = 1;
        instance->dos_error (ah, *critical, cs, ip);
        dosflag = 0;
        return;
    }

    // chain to old handler for safe calls
    _chain_intr (oldint21);
}

//--------------------------------------------------------------------------
//
//      Int 23 (control-break) handler.
//
//      This handler is installed immediately prior to activating the
//      TSR.  It just sets a flag to record that control-break has been
//      pressed.  The main TSR function can poll this flag using the
//      member function "userbreak", which returns the flag value and
//      also resets the flag.
//
static void interrupt TSRint23 ()
{
    breakflag = 1;
}



//--------------------------------------------------------------------------
//
//      Int 24 (critical error) handler.
//
//      This handler is installed immediately prior to activating the
//      TSR.  It just calls the virtual function "critical_error" to
//      deal with the error.
//
static void interrupt TSRint24 (unsigned, unsigned di, unsigned,
                                unsigned, unsigned,    unsigned,
                                unsigned, unsigned,    unsigned ax)
{
    ax = instance->critical_error (di & 0x00FF);
    if (ax == 2 || ax > 3)
        ax = 3;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产一区二区三区av性色| 亚洲一区二区视频在线观看| 久久久不卡网国产精品一区| 日韩欧美卡一卡二| 日韩欧美亚洲国产精品字幕久久久| 欧美喷水一区二区| 在线播放视频一区| 91精品视频网| 日韩三级伦理片妻子的秘密按摩| 91精品国产一区二区三区香蕉 | 日本电影欧美片| 91亚洲精华国产精华精华液| 91亚洲精品一区二区乱码| 一本久久a久久精品亚洲 | 男男视频亚洲欧美| 日欧美一区二区| 男人的天堂亚洲一区| 久久超级碰视频| 国产麻豆9l精品三级站| 成人黄色小视频| 色婷婷av一区二区三区大白胸| 色婷婷av一区二区三区大白胸| 欧洲色大大久久| 欧美一区二区三区免费大片 | 欧美日韩三级视频| 91精品婷婷国产综合久久| 欧美电影免费观看高清完整版在线 | 精品在线你懂的| 国产精品一级在线| 99精品久久只有精品| 在线日韩国产精品| 日韩一区二区麻豆国产| 久久午夜国产精品| 亚洲视频狠狠干| 亚洲电影一区二区三区| 免费三级欧美电影| 成人a级免费电影| 欧美性受极品xxxx喷水| 日韩一区二区在线看| 国产女人aaa级久久久级| 一区二区三区中文字幕在线观看| 日韩精品久久久久久| 国产成人精品在线看| 欧美综合色免费| 久久蜜臀精品av| 亚洲最色的网站| 国产乱子伦一区二区三区国色天香| 成人黄色电影在线 | 一二三四社区欧美黄| 麻豆精品国产传媒mv男同| 成人免费高清视频| 欧美日韩成人在线| 中文字幕第一页久久| 天天av天天翘天天综合网色鬼国产 | 久草这里只有精品视频| 成人的网站免费观看| 欧美一区二区女人| 中文字幕日韩一区| 老司机一区二区| 在线观看网站黄不卡| 久久久久久毛片| 天堂一区二区在线免费观看| 成人免费视频播放| 欧美成人精品二区三区99精品| 亚洲欧洲综合另类| 国产成人在线视频网站| 欧美精品日韩一区| 亚洲免费观看视频| 高清视频一区二区| 欧美大黄免费观看| 亚洲成av人**亚洲成av**| 99麻豆久久久国产精品免费优播| 日韩一区二区三区电影| 亚洲最大成人网4388xx| 成人动漫一区二区| 秋霞电影网一区二区| 91丨porny丨国产入口| 亚洲精品在线免费播放| 日韩二区三区四区| 色猫猫国产区一区二在线视频| 国产日韩欧美在线一区| 美女久久久精品| 欧美丰满美乳xxx高潮www| 亚洲视频香蕉人妖| 成人激情综合网站| 久久久综合精品| 久久国产免费看| 91麻豆精品国产自产在线 | 裸体歌舞表演一区二区| 欧美日韩五月天| 亚洲三级电影全部在线观看高清| 国产精品亚洲视频| 欧美tk丨vk视频| 久久9热精品视频| 欧美一区二区免费| 日精品一区二区| 欧美日韩成人综合| 同产精品九九九| 欧美日韩国产综合一区二区| 一区二区三区精品在线| 91在线视频在线| 亚洲欧美视频在线观看视频| 99久久综合99久久综合网站| 中文字幕精品三区| 成人免费视频播放| 日韩美女精品在线| 99riav久久精品riav| 中文字幕中文在线不卡住| 不卡一区二区在线| 亚洲欧美福利一区二区| 色一情一伦一子一伦一区| 尤物av一区二区| 欧美日韩在线精品一区二区三区激情| 亚洲已满18点击进入久久| 在线中文字幕不卡| 亚洲国产欧美另类丝袜| 777久久久精品| 久久精品国产秦先生| 久久久久国产精品麻豆ai换脸| 国产黄色精品网站| 国产精品久久久久aaaa| 91久久免费观看| 午夜精品视频一区| 日韩精品一区二区三区swag| 国产精品一区专区| 亚洲三级电影全部在线观看高清| 欧洲一区二区av| 人禽交欧美网站| 国产清纯白嫩初高生在线观看91 | 中文字幕在线不卡一区二区三区| 91一区二区三区在线播放| 亚洲国产成人精品视频| 欧美一区二区三区的| 国产主播一区二区三区| 国产九色sp调教91| 中国色在线观看另类| 91极品视觉盛宴| 日本女优在线视频一区二区| 久久久99久久精品欧美| 91小视频在线免费看| 五月婷婷综合在线| 26uuuu精品一区二区| 91社区在线播放| 美国av一区二区| 欧美国产综合一区二区| 欧美三级午夜理伦三级中视频| 麻豆精品国产91久久久久久| 中文字幕日韩精品一区| 欧美精品高清视频| 国产91富婆露脸刺激对白| 亚洲制服丝袜一区| 久久久久久麻豆| 欧美日韩中字一区| 高清视频一区二区| 日韩成人午夜电影| 国产精品丝袜黑色高跟| 欧美精品在线一区二区| 成人深夜福利app| 日本成人中文字幕| 中文字幕精品一区| 91精品国产色综合久久不卡电影| 成人丝袜视频网| 日韩精品福利网| 亚洲人成网站在线| 欧美精品一区视频| 欧美四级电影网| va亚洲va日韩不卡在线观看| 美女网站视频久久| 亚洲一区二区三区四区不卡| 久久久久久免费网| 4438x亚洲最大成人网| 91小视频在线| 国产盗摄一区二区三区| 日本 国产 欧美色综合| 一区二区高清在线| 国产精品乱码久久久久久| 日韩美一区二区三区| 欧美日韩在线播放一区| 成人av在线电影| 国产麻豆欧美日韩一区| 日韩激情视频在线观看| 成人免费视频免费观看| 久久福利视频一区二区| 亚洲高清三级视频| 亚洲欧美乱综合| 国产精品每日更新在线播放网址 | 亚洲欧美另类在线| 国产日韩v精品一区二区| 日韩女优毛片在线| 在线播放91灌醉迷j高跟美女| 色94色欧美sute亚洲线路一ni| 丁香婷婷综合激情五月色| 国内外成人在线视频| 美女尤物国产一区| 日韩精品欧美精品| 亚洲二区视频在线| 亚洲第一二三四区| 亚洲一区欧美一区| 夜夜精品视频一区二区| 亚洲精品国产一区二区精华液 |