Mail Archives: djgpp-workers/1998/01/13/03:49:38
On Mon, 12 Jan 1998, DJ Delorie wrote:
> Herewith suggested alterations to make it easier for a user to hook
> interrupt 9 to get the keyboard events raw:-
Some comments:
> + extern void (*userskeyboardhandler)(int X);
Why is this added to go32cbrk.c?
It *should* be added to some header, however, so an application that
uses this feature will have a prototype. I suggest <sys/exceptn.h>.
Also, the name of this user-defined callback should begin with an
underscore, since it (the name) gets linked into every application and
will pollute the ANSI/POSIX name space. I suggest something like
`__djgpp_kbd_callback'.
> + sti /* disable interrupts */
Charles, isn't this dangerous/slow/unnecessary in the keyboard
handler?
> + movw __go32_info_block+26,%ax
> + movw %ax,%fs /* FS = _dos_ds */
> + .byte 0x64 /* use segment reg FS */
> + movw 0417,%ax /* [0x417] [0x418] are shift status */
The current keyboard handler already sets its DS to point to
conventional memory, with this line:
movw %cs:___djgpp_dos_sel, %ds
Isn't it better to just move this line a couple of lines up, so it
takes effect before _calluserskeyboardhandler is called, instead of
doing it twice and bloating the code?
Also, how about some minimal documentation?
- Raw text -