diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/mnu/totext.c |
Initial commit
Diffstat (limited to 'support/mnu/totext.c')
-rw-r--r-- | support/mnu/totext.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/support/mnu/totext.c b/support/mnu/totext.c new file mode 100644 index 0000000000..f3fb1c19ba --- /dev/null +++ b/support/mnu/totext.c @@ -0,0 +1,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;
+}
+
|