# New Keyboard Code

This file describes the keyboard code which was written in 1999

It was last updated by Eric Biederman <ebiederm@xmission.com> on 22 April 2000

## Whats New

What's new in the new keyboard code?

Virtually all of the interface code gets keystrokes has been rewritten. While the actual emulation of the hardware has been fairly static.

To the user:

- The terminal interface has been internationalized.

- Keymaps can now be written in unicode making them character set independant.

- On non-us keyboard layouts the scan codes should always be correct now.

- The X { keycode } option is now fully supported and portable, to any X server that implements the X keyboard extension.

To the dosemu hacker:

- While the old code already claimed to be "client-server" (and was, to some extent), the new code introduces a clean, well-defined interface between the `server', which is the interface to DOS (int9, bios etc.), and the `clients', which are the interfaces to the user frontends supported by dosemu. Currently, clients are `raw', `slang' (i.e. terminal), and `X'.

  Clients send keystrokes to the server through the interface mentioned above (which is defined in "keyboard.h"), the most important functions being `putkey()' and `putrawkey()'.

- The keyboard server was rewritten from scratch, the clients were heavily modified.

- There is now general and efficient support for pasting large text objects. Simply call paste_text().

- The keyboard-related code is now largely confined to base/keyboard, rather than scattered around in various files.

There is a compile-time option NEW_KBD_CODE (on by default) to activate the new keyboard code. Once the new code is reasonably well tested I'll remove it.

Just like the old keyboard code, we still have the rawkeyboard=on/off modes. The keybint=on/off modes have gone away.

## Status

Almost everything seems to work well now.

The keyboard server should now quite accurately emulate all key combinations described the `MAKE CODES' & `SCAN CODES' tables of HelpPC 2.1, which I used as a reference.

See below for a list of known bugs.

What I need now is YOUR beta-testing... please go ahead and try if all your application's wierd key combinations work, and let me know if they don't.

## Known bugs & incompatibilites

- behaviour wrt. cli/sti is inaccurate, because the PIC code currently doesn't allow un-requesting if IRQ's.

- emulation of special 8042 and keyboard commands is incomplete and probably still somewhat faulty.

- the 'internal' keyboard flags in seg 0x40, like E0 prefix received etc. are never set. This shouldn't hurt, for all but the most braindead TSRs.

- the Pause key works in terms of raw scancodes, however it's function is not implemented (i.e. it doesn't actually halt DOS execution.)

- If the interrupt is not acknowledged and the keyboard port is read we don't eventually give up like a real keyboard and deliver the next byte in the keyboard buffer.

## TODO

- Implement better multinational cut/paste in X

- Implement timeouts on the length of type a byte is available in the keyboard data port.

- implement pause key

- once everything is proved to work, remove the old keyboard code

- implement utf8 and possibly iso2022 terminal support