/* 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 #include 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; }