Date: Thu, 10 Sep 1998 20:22:59 +0300 (IDT) From: Eli Zaretskii To: Tal Lavi cc: djgpp AT delorie DOT com Subject: Re: Making a keyboard handler In-Reply-To: <35F805F1.6D65@post.tau.ac.il> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Thu, 10 Sep 1998, Tal Lavi wrote: > For the time being, using he getch, gives me a little side-effect. If you need to support several keys pressed at the same time, you have no other way but to install a hardware interrupt handler. Neither DOS (`getch' calls DOS) nor BIOS will support that. > 1)If I took control on the keyboard hardware interrupt, but I want some > of the keys to be acknowledged to the old one, there is a port number > that I don't remember, right? > should I write the keyboard codes into it? No, you need to chain (i.e. jump) to the old handler whose address you query at startup by calling __dpmi_get_protected_mode_interrupt_vector. > 2)if the keyboard interrupt is a hardware one, how can it be that it has > an address in memory? The interrupt doesn't have an address, only the handler (which is a piece of code) does. > 3)how do I compile ASM files into .S(excuse my ignorance)? .S files *are* assembly language sources. You compile them into object files as usual, by calling GCC: gcc -c foo.S > 4)how will I link those .S files into my program? You link object files, not source files. The above command will produce a file foo.o which you then link as usual. > 5)how will I be able to use the keyboard variable declared in my main c > source, in the handler, that was written somewhere else? You need to declare your assembly function as a public function, then the linker will resolve the references to it. I suggest to take a look at the Allegro library, which has several hardware interrupt handlers, including for the keyboard. You can see there several examples of how this is done.