home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c329 / 2.img / INCL / DOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-31  |  4.0 KB  |  156 lines

  1. /*
  2.  * dos.h
  3.  *
  4.  * Defines the structures, unions, constants and function declarations
  5.  * needed when using the DOS interface routines.
  6.  *
  7.  * Copyright (C) MicroWay, Inc., 1987, 1988, 1989
  8.  *
  9.  */
  10.  
  11.  
  12. struct DOUBLEREGS {        /* Double-word registers. */
  13.     unsigned long    eax;
  14.     unsigned long    ebx;
  15.     unsigned long    ecx;
  16.     unsigned long    edx;
  17.     unsigned long    esi;
  18.     unsigned long    edi;
  19.     unsigned long    eflag;
  20. };
  21.  
  22. struct WORDREGS {        /* Word registers. */
  23.     unsigned short    ax, l_ax;
  24.     unsigned short    bx, l_bx;
  25.     unsigned short    cx, l_cx;
  26.     unsigned short    dx, l_dx;
  27.     unsigned short    si, l_si;
  28.     unsigned short     di, l_di;
  29.     unsigned short    cflag, l_cflag;
  30. };
  31.  
  32.  
  33.  
  34. struct BYTEREGS {        /* Byte registers. */
  35.     unsigned char    al, ah, l_al, l_ah;
  36.     unsigned char    bl, bh, l_bl, l_bh;
  37.     unsigned char    cl, ch, l_cl, l_ch;
  38.     unsigned char    dl, dh, l_dl, l_dh;
  39.     unsigned long    esi;
  40.     unsigned long    edi;
  41.     unsigned char    flag, lr_flag, rl_flag, ll_flag;
  42. };
  43.  
  44.  
  45. /* Union to overlay byte, word and doubleword register structures. */
  46.  
  47. union REGS {
  48.     struct DOUBLEREGS    d;
  49.     struct WORDREGS        w;
  50.     struct BYTEREGS     b;
  51. };
  52.  
  53.  
  54.  
  55.  
  56. /* Exception handling function declarations. */
  57.  
  58. unsigned    stndpenv_();        /* Get environment information. */
  59. unsigned    stndpsw_();        /* Get status word. */
  60. unsigned    stndpcw_();        /* Get control word. */
  61. unsigned    ldndpcw_();        /* Load new control word. */
  62. unsigned    ndptype_();        /* Get NDP type. */
  63. void        init_ndp_();        /* Initialize the NDP. */
  64. int        set_ex_hdl_();        /* Set up exception handler. */
  65. void        clrndpex_();        /* Clear NDP exception flags. */
  66. void        ldndpenv_();        /* Restore environment information. */
  67.  
  68.  
  69. /* Structure declaration for 80387 NDP environmental information. */
  70.  
  71. struct excep {                /* For environmental information. */
  72.     unsigned short    cw;
  73.     unsigned short    l_cw;           /* Padding. */
  74.     unsigned short    sw;
  75.     unsigned short    l_sw;           /* Padding. */
  76.     unsigned short    tag;
  77.     unsigned short    l_tag;          /* Padding. */
  78.     unsigned    ip_off;
  79.     unsigned short    cs_sel;
  80.     unsigned short    l_cs_sel;       /* Padding. */
  81.     unsigned    data_off;
  82.     unsigned short    oper_sel;
  83.     unsigned short    l_oper_sel;     /* Padding. */
  84.  
  85.     unsigned char    st0[10];
  86.     unsigned char    st1[10];
  87.     unsigned char    st2[10];
  88.     unsigned char    st3[10];
  89.     unsigned char    st4[10];
  90.     unsigned char    st5[10];
  91.     unsigned char    st6[10];
  92.     unsigned char    st7[10];
  93. };
  94.  
  95.  
  96. /* Structure declaration for 80287 NDP environmental information. */
  97.  
  98. struct excep287 {            /* For environmental information. */
  99.     unsigned short    cw;
  100.     unsigned short    sw;
  101.     unsigned short    tag;
  102.     unsigned short    l_cw;           /* Padding. */
  103.     unsigned short    l_sw;           /* Padding. */
  104.     unsigned short    l_tag;          /* Padding. */
  105.     unsigned    ip_off;
  106.     unsigned short    cs_sel;
  107.     unsigned short    l_cs_sel;       /* Padding. */
  108.     unsigned    data_off;
  109.     unsigned short    oper_sel;
  110.     unsigned short    l_oper_sel;     /* Padding. */
  111.  
  112.     unsigned char    st0[10];
  113.     unsigned char    st1[10];
  114.     unsigned char    st2[10];
  115.     unsigned char    st3[10];
  116.     unsigned char    st4[10];
  117.     unsigned char    st5[10];
  118.     unsigned char    st6[10];
  119.     unsigned char    st7[10];
  120. };
  121.  
  122.  
  123. /* Structure declaration for Weitek NDP environmental information. */
  124.  
  125. struct wexcep {
  126.     unsigned short    cw;
  127.     unsigned short    sw;
  128.     union {
  129.         unsigned    regs[32];
  130.         float        f_regs[32];
  131.         double        d_regs[16];
  132.     } u;
  133. };
  134.  
  135.  
  136.  
  137. /* The following symbolic constants correspond to the
  138.  * exception-handling bits in the Control Word of both
  139.  * the 80x87 and the Weitek coprocessors. Because the
  140.  * error bits in the Status Word are in the same 
  141.  * positions, the same values can be used for the
  142.  * Status Word as well.
  143.  */
  144.  
  145. #define IM      1               /* All NDPs. */
  146. #define DM      2               /* 80x87 only */
  147. #define ZM      4               /* All NDPs. */
  148. #define OM      8               /* All NDPs. */
  149. #define UM      16              /* All NDPs. */
  150. #define PM      32              /* All NDPs. */
  151. #define UOM     64              /* Weitek only. */
  152. #define DCM     128             /* Weitek only. */
  153.  
  154. #define _disable() asm("\tcli\n")
  155. #define _enable() asm("\tsti\n")
  156.