1 /* MS-DOS specific Lisp utilities. Coded by Manabu Higashida, 1991.
2 Major changes May-July 1993 Morten Welinder (only 10% original code left)
3 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
25 /* The entire file is within this conditional */
32 #include "termhooks.h"
37 DEFUN ("mode25", Fmode25
, Smode25
, 0, 0, "", "\
38 Changes the number of rows to 25.")
44 if (!inhibit_window_system
)
47 if (have_mouse
) mouse_off ();
49 int86 (0x10, ®s
, ®s
);
52 int86 (0x10, ®s
, ®s
);
55 int86 (0x10, ®s
, ®s
);
57 int86 (0x10, ®s
, ®s
);
58 Fset_frame_size (Fselected_frame (), ScreenCols (), ScreenRows ());
61 if (have_mouse
) mouse_init ();
65 DEFUN ("mode4350", Fmode4350
, Smode4350
, 0, 0, "", "\
66 Changes the number of rows to 43 (EGA) or 50 (VGA).")
72 if (!inhibit_window_system
)
75 if (have_mouse
) mouse_off ();
77 int86 (0x10, ®s
, ®s
);
80 int86 (0x10, ®s
, ®s
);
83 int86 (0x10, ®s
, ®s
);
86 int86 (0x10, ®s
, ®s
);
87 Fset_frame_size (Fselected_frame (), ScreenCols (), ScreenRows ());
90 if (have_mouse
) mouse_init ();
94 DEFUN ("int86", Fint86
, Sint86
, 2, 2, 0,
95 "Call specific MSDOS interrupt number INTERRUPT with REGISTERS.\n\
96 Return the updated REGISTER vector.\n\
98 INTERRUPT should be an integer in the range 0 to 255.\n\
99 REGISTERS should be a vector produced by `make-register' and\n\
100 `set-register-value'.")
102 Lisp_Object intno
, regs
;
106 union REGS inregs
, outregs
;
109 CHECK_NUMBER (intno
, 0);
110 no
= (unsigned long) XINT (intno
);
111 CHECK_VECTOR (regs
, 1);
112 if (no
< 0 || no
> 0xff || XVECTOR (regs
)-> size
!= 8)
114 for (i
= 0; i
< 8; i
++)
115 CHECK_NUMBER (XVECTOR (regs
)->contents
[i
], 1);
117 inregs
.x
.ax
= (unsigned long) XFASTINT (XVECTOR (regs
)->contents
[0]);
118 inregs
.x
.bx
= (unsigned long) XFASTINT (XVECTOR (regs
)->contents
[1]);
119 inregs
.x
.cx
= (unsigned long) XFASTINT (XVECTOR (regs
)->contents
[2]);
120 inregs
.x
.dx
= (unsigned long) XFASTINT (XVECTOR (regs
)->contents
[3]);
121 inregs
.x
.si
= (unsigned long) XFASTINT (XVECTOR (regs
)->contents
[4]);
122 inregs
.x
.di
= (unsigned long) XFASTINT (XVECTOR (regs
)->contents
[5]);
123 inregs
.x
.cflag
= (unsigned long) XFASTINT (XVECTOR (regs
)->contents
[6]);
124 inregs
.x
.flags
= (unsigned long) XFASTINT (XVECTOR (regs
)->contents
[7]);
126 int86 (no
, &inregs
, &outregs
);
128 XVECTOR (regs
)->contents
[0] = make_number (outregs
.x
.ax
);
129 XVECTOR (regs
)->contents
[1] = make_number (outregs
.x
.bx
);
130 XVECTOR (regs
)->contents
[2] = make_number (outregs
.x
.cx
);
131 XVECTOR (regs
)->contents
[3] = make_number (outregs
.x
.dx
);
132 XVECTOR (regs
)->contents
[4] = make_number (outregs
.x
.si
);
133 XVECTOR (regs
)->contents
[5] = make_number (outregs
.x
.di
);
134 XVECTOR (regs
)->contents
[6] = make_number (outregs
.x
.cflag
);
135 XVECTOR (regs
)->contents
[7] = make_number (outregs
.x
.flags
);
140 #ifndef HAVE_X_WINDOWS
141 /* Later we might want to control the mouse interface with this function,
142 e.g., with respect to non-80 column screen modes. */
144 DEFUN ("msdos-mouse-p", Fmsdos_mouse_p
, Smsdos_mouse_p
, 0, 0, 0, "\
145 Report whether a mouse is present.")
154 DEFUN ("set-mouse-position", Fset_mouse_position
, Sset_mouse_position
, 3, 3, 0,
155 "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\
156 WARNING: If you use this under X windows,\n\
157 you should call `unfocus-frame' afterwards.")
159 Lisp_Object frame
, x
, y
;
161 mouse_moveto (XINT (x
), XINT (y
));
164 /* Function to translate colour names to integers. See lisp/term/pc-win.el
165 for its definition. */
167 Lisp_Object Qmsdos_color_translate
;
171 int dos_country_code
;
173 Lisp_Object Vdos_version
;
179 _go32_dpmi_seginfo info
;
180 _go32_dpmi_registers dpmiregs
;
182 #ifndef SYSTEM_MALLOC
183 get_lim_data (); /* why the hell isn't this called elsewhere? */
187 intdos (®s
, ®s
);
188 Vdos_version
= Fcons (make_number (regs
.h
.al
), make_number (regs
.h
.ah
));
190 /* Obtain the country code by calling Dos via Dpmi. Don't rely on GO32. */
191 info
.size
= (34 + 15) / 16;
192 if (_go32_dpmi_allocate_dos_memory (&info
))
193 dos_country_code
= 1;
196 dpmiregs
.x
.ax
= 0x3800;
197 dpmiregs
.x
.ds
= info
.rm_segment
;
199 dpmiregs
.x
.ss
= dpmiregs
.x
.sp
= 0;
200 _go32_dpmi_simulate_int (0x21, &dpmiregs
);
201 dos_country_code
= dpmiregs
.x
.bx
;
202 _go32_dpmi_free_dos_memory (&info
);
206 intdos (®s
, ®s
);
208 /* Estimate code page from country code */
209 switch (dos_country_code
)
211 case 45: /* Denmark */
212 case 47: /* Norway */
220 dos_codepage
= regs
.x
.bx
& 0xffff;
229 defsubr (&Smode4350
);
231 #ifndef HAVE_X_WINDOWS
232 defsubr (&Smsdos_mouse_p
);
233 defsubr (&Sset_mouse_position
);
235 Qmsdos_color_translate
= intern ("msdos-color-translate");
236 staticpro (&Qmsdos_color_translate
);
239 DEFVAR_INT ("dos-country-code", &dos_country_code
,
240 "The country code returned by Dos when Emacs was started.\n\
241 Usually this is the international telephone prefix.");
243 DEFVAR_INT ("dos-codepage", &dos_codepage
,
244 "The codepage active when Emacs was started.\n\
245 The following are known:\n\
247 850 Multilingual (Latin I)\n\
248 852 Slavic (Latin II)\n\
252 863 Canada (French)\n\
253 865 Norway/Denmark");
255 DEFVAR_LISP ("dos-version", &Vdos_version
,
256 "The (MAJOR . MINOR) Dos version (subject to modification with setver).");