delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/15/14:22:29

Message-ID: <319A1F93.37C6@nuernberg.netsurf.de>
Date: Wed, 15 May 1996 20:16:51 +0200
From: Ralf Suessbrich <ralf DOT suessbrich AT nuernberg DOT netsurf DOT de>
Organization: The Internet
MIME-Version: 1.0
To: DJGPP Mailing List <djgpp AT delorie DOT com>
Subject: Realmode interrupts

Hello,

first thank you all for the answers to my last question (about
installing a protected mode interrupt handler) !!! ;)

This time i have some questions about realtime ones. I read the 
section 18 of the FAQ and the part of INFO about the used functions.

I wrote following code:

#include <dpmi.h>
#include <stdio.h>
#include <dos.h>
#include <sys/movedata.h>


handler () {

	nosound ();
	sound (500);
	sleep (1);
	nosound ();
}

int bottom () {};

main () {
	

	int (* funcptr) ();
	int len, return_selector, real_address;
	__dpmi_raddr handler_adr;		/* real mode addresses */

	len = (int) (bottom - handler);   /* ???? does this work ?? */



         /* i need the lenght for allocating DOS mem with: */

	real_address = __dpmi_allocate_dos_memory (((len+15)>>4, &return_selector);

	funcptr = handler; /* now i have a pointer to my handler */
        
	dosmemput (funcptr, len, real_address); /* now i moved my handler to first 1 MB memory */
	
 	handler_adr.segment = ra_adr >> 4;  /* FAQ section 18.9: lower 4 bits to offset16 */
    	handler_adr.offset16 = ra_adr & 15; /* the rest to segment, did i do this right ? */
	

	__dpmi_set_real_mode_interrupt_vector (9, &handler_adr);

	/* now all should be done */

	while (true);    /*now every keystroke should produce a 500 Hz tone for one second*/
}


I tried this with hooking int9 (IRQ1), keyboard interrupt, i know this is a critical
interrupt, compiling is ok, but when running, my system hangs, i get an exception from qemm.

thank you all, who look at my code and/or have an idea, what i made wrong ;)



Ralf Suessbrich

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019