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

📄 polycomm.cpp

📁 串行通信编程源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
#define MSR_DCD     0x08                    //  delta carrier detect
#define MSR_CTS     0x10                    //  clear to send
#define MSR_DSR     0x20                    //  data set ready (modem ready)
#define MSR_RI      0x40                    //  ring indicated
#define MSR_CD      0x80                    //  carrier detected



/* ******************************************************************** *
 *
 *    8259 Programmable Interrupt Controller Definitions
 *
 * ******************************************************************** */

#define I8259       0x20                    // control register address
#define EOI         0x20                    // end of interrupt command
#define I8259M      0x21                    // mask register



/* ******************************************************************** *
 *
 *  Routine definitions
 *
 * ******************************************************************** */

void    initialization(int, char *[]),      // initialization
        status_line(void),                  // update status line
        wait_ms(long),                      // wait in milliseconds
        wait(long);                         // ..and wait in seconds

int     about(int, int),                    // about box routine
        pc_exit(int, int),                  // menu exit routine
        ports(int, int),                    // port selection menu routine
        comm_parms(int, int),               // comm parms menu routine
        hangup(int, int),                   // hangup menu routine
        phone_list(int, int),               // phonebook menu routine
        dl_xmodem(int, int),                // xmodem download menu rtn
        ul_xmodem(int, int),                // ..and upload menu routine
        dl_ymodem(int, int),                // ymodem download menu rtn
        ul_ymodem(int, int),                // ..and upload menu routine
        rcv_fax(int, int),                  // receive a fax
        send_fax(int, int),                 // .. and send a fax
        get_key(int);                       // get any type of key




/* ******************************************************************** *
 *
 *  Set the stack size to 8k
 *
 * ******************************************************************** */

extern
unsigned _stklen = 8192;



/* ******************************************************************** *
 *
 *  PolyComm includes
 *
 * ******************************************************************** */

#include "screen.cpp"                       // screen handling routines
#include "window.cpp"                       // window class
#include "menu.cpp"                         // menu class
#include "list.cpp"                         // list class
#include "comm.cpp"                         // basic comm support
#include "global.cpp"                       // strings and global data
#include "utility.cpp"                      // utility functions
#include "protocol.cpp"                     // protocol class
#include "xmodem.cpp"                       // XMODEM and XMODEM/CRC class
#include "ymodem.cpp"                       // YMODEM class
#include "command.cpp"                      // command menu routine
#include "dial.cpp"                         // dial menu routines
#include "config.cpp"                       // configuration menu rtns
#include "fax.cpp"                          // facsimile support
#include "transfer.cpp"                     // transfer file menu rtns


/* ******************************************************************** *
 *
 *  main() -- PolyComm mainline
 *
 * ******************************************************************** */

void    main(int argc,                      // command line token count
             char *argv[])                  // ..and command line tokens
{

printf(copyright);                          // display copyright msg
initialization(argc, argv);                 // init and parse cmd line

while(NOT quit_flag)                        // loop 'til user requests out
    {
    terminal_handler();                     // try to get a keyboard char

    if (NOT comm->IEmpty())                 // q. any incoming com chars?
        terminal_display();                 // a. yes .. show input stream
    }

rc = 0;                                     // clear DOS errorlevel
quit_with(done);                            // ..and give completion msg

}



/* ******************************************************************** *
 *
 *  initialization() -- perform framework initializations
 *
 * ******************************************************************** */

void    initialization(int  ac,             // command line token count
                       char *av[])          // ..and command line tokens
{
struct  videoconfig vc;                     // screen info structure


old_break = _dos_getvect(0x1b);             // get old ^break handler addr

if (ac > 2 ||                               // q. need help..
            NOT strcmp(av[1], "/?"))        // ..or want help?
    quit_with(help);                        // a. yes .. give help/quit

_dos_setvect(0x1b, control_break);          // set up control break
_dos_setvect(0x24, critical_routine);       // ..and DOS critical handler

_getvideoconfig(&vc);                       // get current screen info
max_lines = vc.numtextrows;                 // save maximum nbr of lines

if (vc.numtextcols < 80)                    // q. less than 80 columns?
    quit_with(bad_width);                   // a. yes .. give error/quit

if (vc.mode == _TEXTBW80 ||                 // q. black and white mode..
            vc.mode == _TEXTMONO)           // ..or monochrome mode?
    {
    main_menu.SetColors(mono_1, mono_2);    // a. yes .. set up for
    term_cn = mono_2;                       // ..monochrome display
    term_cr = mono_1;                       // ..for all windows
    stat_cn = mono_1;
    }

if (vc.mode == _TEXTMONO)                   // q. mono adapter?
    vid_seg = (char huge *)MK_FP(0xb000, 0);// a. yes .. use mono memory

load_config(av[1]);                         // load modem config file
load_pb();                                  // ..and phonebook file
check_ports();                              // check for available ports
build_comm();                               // set up Comm object
wait_ms(500L);                              // wait a little bit

full_screen = 1;                            // show init complete
status_line();                              // ..and display status line

_wscroll = 1;                               // set scrolling mode
term = new Window(1, 1, 80, 24,             // define terminal window
              term_cn, term_cr);            // ..and its colors
term->Open(none);                           // ..then open w/o borders
comm->IClear();                             // ..clear input buffer
}

⌨️ 快捷键说明

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