summaryrefslogtreecommitdiff
path: root/f_get_st.c
blob: a8d9c03b57f6d6b9fecc30627f8264d13b2b5b1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "fossil.h"
#include <dos.h>
#include <stdlib.h>
int F_Get_Status(unsigned char function)
{
        int         arg = 0;

        union REGS      regs;

        if(function == CK_DCD && dcd_ignore)
                return TRUE;

        regs.h.ah = 0x03;       /* function = request status */
        regs.h.al = 0x00;
        regs.x.dx = (unsigned char) port;
        int86(FOSSIL_INT, &regs, &regs);


        switch (function) {
        case 1:
                arg = ((regs.h.al & 0x10) == 0x10) ? 1 : 0;  /* CTS * /
                        break;
        case 2:
                arg = ((regs.h.al & 0x20) == 0x20) ? 1 : 0;  /* DSR */
                break;
        case 3:
                arg = ((regs.h.al & 0x40) == 0x40) ? 1 : 0;  /* RING */
                break;
        case 4:
                arg = ((regs.h.al & 0x80) == 0x80) ? 1 : 0;   /* DCD */
                break;
        case 5:
                arg = ((regs.h.ah & 0x00) == 0x00) ? 1 : 0;   /* RDA */
                break;
        case 6:
                arg = ((regs.h.ah & 0x02) == 0x02) ? 1 : 0;   /* OVRN */
                break;
        case 7:
                arg = ((regs.h.ah & 0x20) == 0x20) ? 1 : 0;   /* THRE */
                break;
        case 8:
                arg = ((regs.h.ah & 0x40) == 0x040) ? 1 : 0;  /* TSRE */
                break;
        case 9:
                arg = ((regs.h.ah & 0x80) == 0x80) ? 1 : 0;   /* TIMEOUT */
        default:
                return (FALSE);
        }
        return (arg);
}