blob: f3fb1c19ba31959668b633e6008349a85e3f7d32 (
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
51
52
53
54
55
56
57
58
59
60
61
62
|
/* Program TOTEXT sets the grafic state of screen to the tex mode 80x25 */
/************************************************************************/
/* 16.8.92 Petr Olsak */
/* If the grafic state is in text mode, program do nothing and terminates.
In the other case program writes message, waits to key pressing
(or mouse buttom pressing) and then it return to the text mode.
The program is used after METAFONT run in the TeX-menu-system.
*/
#include <dos.h>
#include <stdio.h>
struct REGPACK reg;
int mpresent;
unsigned int mouseinit (void) /* true if mouseOK */
{
reg.r_ax = 0;
intr (0x33, ®);
return reg.r_ax;
}
unsigned int mhit (void) /* returns buttoms status */
{
if (!mpresent) return 0;
reg.r_ax = 3;
intr (0x33, ®);
return reg.r_bx;
}
int Mykbhit(char *ac) /* input char from keyboard without Ctrl-Break check */
{
reg.r_ax=0x0600;
reg.r_dx=0x00FF;
intr (0x21, ®);
if (reg.r_flags & 0x0040) return 0;
*ac = reg.r_ax % 256;
return 1;
}
main()
{
unsigned char mode;
char c=0;
reg.r_ax = 0x0F00;
intr (0x10, ®);
mode = reg.r_ax % 256;
if (mode != 2 && mode != 3 && mode != 7)
{
mpresent = mouseinit();
printf("press ENTER to return to the text mode ...");
while (c != 13 && !mhit()) Mykbhit(&c);
reg.r_ax = 0x0003;
intr (0x10, ®);
}
return 0;
}
|