}
#endif
-static
+static void
dos_direct_output (y, x, buf, len)
int y;
int x;
static int cursor_cleared;
-static
+static void
IT_display_cursor (int on)
{
if (on && cursor_cleared)
es_value = regs.x.es;
__dpmi_int (0x10, ®s);
- if (regs.x.es != es_value && regs.x.es != (ScreenPrimary >> 4) & 0xffff)
+ if (regs.x.es != es_value)
{
- screen_old_address = ScreenPrimary;
+ /* screen_old_address is only set if ScreenPrimary does NOT
+ already point to the relocated buffer address returned by
+ the Int 10h/AX=FEh call above. DJGPP v2.02 and later sets
+ ScreenPrimary to that address at startup under DOS/V. */
+ if (regs.x.es != (ScreenPrimary >> 4) & 0xffff)
+ screen_old_address = ScreenPrimary;
screen_virtual_segment = regs.x.es;
screen_virtual_offset = regs.x.di;
ScreenPrimary = (screen_virtual_segment << 4) + screen_virtual_offset;
* SPACE
*/
+#define Ignore 0x0000
+#define Normal 0x0000 /* normal key - alt changes scan-code */
+#define FctKey 0x1000 /* func key if c == 0, else c */
+#define Special 0x2000 /* func key even if c != 0 */
+#define ModFct 0x3000 /* special if mod-keys, else 'c' */
+#define Map 0x4000 /* alt scan-code, map to unshift/shift key */
+#define KeyPad 0x5000 /* map to insert/kp-0 depending on c == 0xe0 */
+#define Grey 0x6000 /* Grey keypad key */
+
+#define Alt 0x0100 /* alt scan-code */
+#define Ctrl 0x0200 /* ctrl scan-code */
+#define Shift 0x0400 /* shift scan-code */
+
static int extended_kbd; /* 101 (102) keyboard present. */
+struct kbd_translate {
+ unsigned char sc;
+ unsigned char ch;
+ unsigned short code;
+};
+
struct dos_keyboard_map
{
char *unshifted;
char *shifted;
char *alt_gr;
+ struct kbd_translate *translate_table;
};
"`1234567890-= qwertyuiop[] asdfghjkl;'\\ zxcvbnm,./ ",
/* 0123456789012345678901234567890123456789 012345678901234 */
"~!@#$%^&*()_+ QWERTYUIOP{} ASDFGHJKL:\"| ZXCVBNM<>? ",
- 0 /* no Alt-Gr key */
+ 0, /* no Alt-Gr key */
+ 0 /* no translate table */
};
static struct dos_keyboard_map fr_keyboard = {
/* 0123456789012345678901234567890123456789012345678901234 */
" 1234567890ø+ AZERTYUIOPù\9c QSDFGHJKLM%æ WXCVBN?./õ ",
/* 01234567 89012345678901234567890123456789012345678901234 */
- " ~#{[|`\\^@]} Ï "
+ " ~#{[|`\\^@]} Ï ",
+ 0 /* no translate table */
};
/*
* added also {,},` as, respectively, AltGr-8, AltGr-9, AltGr-'
* Donated by Stefano Brozzi <brozzis@mag00.cedi.unipr.it>
*/
+
+static struct kbd_translate it_kbd_translate_table[] = {
+ { 0x56, 0x3c, Map | 13 },
+ { 0x56, 0x3e, Map | 13 },
+ { 0, 0, 0 }
+};
static struct dos_keyboard_map it_keyboard = {
/* 0 1 2 3 4 5 */
/* 0 123456789012345678901234567890123456789012345678901234 */
- "\\1234567890'\8d qwertyuiop\8a+ asdfghjkl\95\85\97 zxcvbnm,.- ",
+ "\\1234567890'\8d< qwertyuiop\8a+ asdfghjkl\95\85\97 zxcvbnm,.- ",
/* 01 23456789012345678901234567890123456789012345678901234 */
- "|!\"\9c$%&/()=?^ QWERTYUIOP\82* ASDFGHJKL\87øõ ZXCVBNM;:_ ",
+ "|!\"\9c$%&/()=?^> QWERTYUIOP\82* ASDFGHJKL\87øõ ZXCVBNM;:_ ",
/* 0123456789012345678901234567890123456789012345678901234 */
- " {}~` [] @# "
+ " {}~` [] @# ",
+ it_kbd_translate_table
};
static struct dos_keyboard_map dk_keyboard = {
/* 01 23456789012345678901234567890123456789012345678901234 */
"õ!\"#$%&/()=?` QWERTYUIOP\8f^ ASDFGHJKL\92\9d* ZXCVBNM;:_ ",
/* 0123456789012345678901234567890123456789012345678901234 */
- " @\9c$ {[]} | "
+ " @\9c$ {[]} | ",
+ 0 /* no translate table */
+};
+
+static struct kbd_translate jp_kbd_translate_table[] = {
+ { 0x73, 0x5c, Map | 0 },
+ { 0x7d, 0x5c, Map | 13 },
+ { 0, 0, 0 }
+};
+static struct dos_keyboard_map jp_keyboard = {
+/* 0 1 2 3 4 5 */
+/* 0123456789012 345678901234567890123456789012345678901234 */
+ "\\1234567890-^\\ qwertyuiop@[ asdfghjkl;:] zxcvbnm,./ ",
+/* 01 23456789012345678901234567890123456789012345678901234 */
+ "_!\"#$%&'()~=~| QWERTYUIOP`{ ASDFGHJKL+*} ZXCVBNM<>? ",
+ 0, /* no Alt-Gr key */
+ jp_kbd_translate_table
};
static struct keyboard_layout_list
1, &us_keyboard,
33, &fr_keyboard,
39, &it_keyboard,
- 45, &dk_keyboard
+ 45, &dk_keyboard,
+ 81, &jp_keyboard
};
static struct dos_keyboard_map *keyboard;
return 0;
}
\f
-#define Ignore 0x0000
-#define Normal 0x0000 /* normal key - alt changes scan-code */
-#define FctKey 0x1000 /* func key if c == 0, else c */
-#define Special 0x2000 /* func key even if c != 0 */
-#define ModFct 0x3000 /* special if mod-keys, else 'c' */
-#define Map 0x4000 /* alt scan-code, map to unshift/shift key */
-#define KeyPad 0x5000 /* map to insert/kp-0 depending on c == 0xe0 */
-#define Grey 0x6000 /* Grey keypad key */
-
-#define Alt 0x0100 /* alt scan-code */
-#define Ctrl 0x0200 /* ctrl scan-code */
-#define Shift 0x0400 /* shift scan-code */
-
static struct
{
unsigned char char_code; /* normal code */
Ignore, /* Right shift */
Grey | 1, /* Grey * */
Ignore, /* Alt */
- Normal | ' ', /* ' ' */
+ Normal | 55, /* ' ' */
Ignore, /* Caps Lock */
FctKey | 0xbe, /* F1 */
FctKey | 0xbf, /* F2 */
{
union REGS regs;
register unsigned char c;
- int sc, code, mask, kp_mode;
+ int sc, code = -1, mask, kp_mode;
int modifiers;
regs.h.ah = extended_kbd ? 0x10 : 0x00;
}
else
{
- if (sc >= (sizeof (ibmpc_translate_map) / sizeof (short)))
- continue;
- if ((code = ibmpc_translate_map[sc]) == Ignore)
- continue;
+ /* Try the keyboard-private translation table first. */
+ if (keyboard->translate_table)
+ {
+ struct kbd_translate *p = keyboard->translate_table;
+
+ while (p->sc)
+ {
+ if (p->sc == sc && p->ch == c)
+ {
+ code = p->code;
+ break;
+ }
+ p++;
+ }
+ }
+ /* If the private table didn't translate it, use the general
+ one. */
+ if (code == -1)
+ {
+ if (sc >= (sizeof (ibmpc_translate_map) / sizeof (short)))
+ continue;
+ if ((code = ibmpc_translate_map[sc]) == Ignore)
+ continue;
+ }
}
if (c == 0)
}
case Map:
+ if (keyboard->translate_table)
+ c = 0; /* so key gets mapped through country-specific kbd */
if (c && !(mask & ALT_P) && !((mask & SHIFT_P) && (mask & CTRL_P)))
if (!keyboard_map_all)
return c;
#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2
if (screen_virtual_segment)
dosv_refresh_virtual_screen (2 * 10 * screen_size_X, 4 * screen_size_X);
-#endif /* __DJGPP_MINOR__ < 2 */
/* Generate traceback, so we could tell whodunit. */
signal (SIGINT, SIG_DFL);
__asm__ __volatile__ ("movb $0x1b,%al;call ___djgpp_hw_exception");
+#else /* __DJGPP_MINOR__ >= 2 */
+ raise (SIGABRT);
+#endif /* __DJGPP_MINOR__ >= 2 */
#endif
exit (2);
}