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

📄 example1.cpp

📁 这是一个C++编程文档
💻 CPP
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                          //
//                             example1 of ISC...                           //
//                             ------------------                           //
//                                                                          //
//  - Put an isr on timer tick which increments the top left char on vga/ega//
//    screens! (dynamicly created with new.                                 //
//                                                                          //
//  - Put an isr on keyboard interrupts that increments on every press or   //
//    release of any key, 1 char right of the first isr. (static).          //
//                                                                          //
//  - test for the same program in memory, if already resident - get out    //
//    with an error.                                                        //
//  - if not resident already, activate isr and stay resident with about    //
//       10KB in memory.                                                    //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////
//                                                                          //
//                       By:- Ofer Laor (AKA LeucroTTa)                     //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

#include "isc.h"   // ISC.
#include <stdio.h> // printf.

#include <dos.h>; // keep

class SHOW_TICKS: public ISC {
      virtual void isr(void);
};

void SHOW_TICKS::isr(void)
{
    old_vect();
    (*((char far *)0xb8000000L))++;
}

class SHOW_KEYS: public ISC {
      virtual void isr(void);
};

void SHOW_KEYS::isr(void)
{
    old_vect();
    (*((char far *)0xb8000002L))++;
}

SHOW_KEYS keys;

int main()
{
    // check if program is already resident...
    // use as parameter - the name of the program.
    // - note you can check for other programs in mem too (under DOS >= 4.0)
    //   by putting the .exe name (capital letters)- as is_TSR param!
    //
    if (ISC::is_TSR("EXAMPLE1")) {
       printf("Error: already resident!\n\a");
       return 1;
    }

    (new SHOW_TICKS)->activate(0x8); // this is the object that hooks the interrupt.

    keys.activate(0x9);


    ISC::TSR(0); // try and stay resident.
    printf("Error: could not stay resident!\n\a");
    return 2;
}

⌨️ 快捷键说明

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