Date: Tue, 13 Jan 1998 10:49:08 +0200 (IST) From: Eli Zaretskii To: DJ Delorie cc: Anthony DOT Appleyard AT umist DOT ac DOT uk, djgpp-workers AT delorie DOT com Subject: Re: [MCLSSAA2 AT fs2 DOT mt DOT umist DOT ac DOT uk: Hooking interrupt 9 : a DIFF] In-Reply-To: <199801122321.SAA13895@delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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 . 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?