Message-ID: <37F871DE.C5C687E5@virtualis.com> Date: Mon, 04 Oct 1999 19:22:39 +1000 From: Alex Mendes da Costa X-Mailer: Mozilla 4.51 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Problem with interrupts Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: a3-p16.syd.fl.net.au X-Trace: 4 Oct 1999 19:26:18 +1000, a3-p16.syd.fl.net.au Organization: Customer of First Link Internet Services, Sydney, Australia Lines: 77 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi all again. I don't know if this is against the rules of the list, and I'm really sorry if it is, but I can't get this code to work. I have read through just about all of the Documentation and FAQ and sent a few posts to this list, but I can't get my code to work!! So if anyone would be as kind to browse this and see where I have slipped up, I would appreciate it greatly. This code stuffs up my computer completely every time I try to run it, but it compiles alright. NOTE: I changed the asm interrupt to contain the bare essentials cause I wasn't sure if that was the problem. My code: #include #include void main(); void keyboard_handler(); void keyboard_handler_end(); char keystatus[128]; int i; unsigned long baseaddr; __dpmi_paddr old_keyboard_handler, new_keyboard_handler; __dpmi_meminfo region; void main() { __dpmi_get_protected_mode_interrupt_vector(0x09, &old_keyboard_handler); /* Lock the interrupt code */ __dpmi_get_segment_base_address(_my_cs(), &baseaddr); region.handle = 0; region.size = (keyboard_handler_end - keyboard_handler); region.address = baseaddr + keyboard_handler; __dpmi_lock_linear_region(®ion); /* Lock the keystatus array */ __dpmi_get_segment_base_address(_my_ds(), &baseaddr); region.handle = 0; region.size = 128; region.address = baseaddr + keystatus; __dpmi_lock_linear_region(®ion); new_keyboard_handler.offset32 = (int)keyboard_handler; new_keyboard_handler.selector = _my_cs(); __dpmi_set_protected_mode_interrupt_vector(0x09, &new_keyboard_handler); i = 0; do { printf("%d\n",(keyboard_handler_end - keyboard_handler)); /* Endless Loop? */ } while (i == 0); __dpmi_set_protected_mode_interrupt_vector(0x09, &old_keyboard_handler); } void keyboard_handler() { asm("pushw %ax movb $0x20, %al outb %al, $0x20 popw %ax sti iret"); } void keyboard_handler_end() { }