Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!cs.utexas.edu!yale!cmcl2!lanl!summa.tamu.edu!ctl8588 From: ctl8588@summa.tamu.edu (LAUGHLIN, CHET) Newsgroups: comp.os.msdos.programmer Subject: Re: int 70h Summary: Sample code for int 70h Message-ID: <12022@lanl.gov> Date: 19 Jan 91 06:31:49 GMT References: <27944d72@ralf> <1991Jan18.134311.13490@linus.mitre.org> Sender: news@lanl.gov Reply-To: ctl8588@summa.tamu.edu Organization: THE CLUELESS Lines: 80 News-Software: VAX/VMS VNEWS 1.3-4 In article <1991Jan18.134311.13490@linus.mitre.org>, jfjr@mbunix.mitre.org (Freedman) writes... >vector with the dos_getvect,dos_setvect sequence. I am not getting >into the interrupt routine period. After reading whatever >documentation I could get my hands on (very, very sparse) I saw >that int 70h is used by a couple of services of int 15h (event >wait and delay) both of which are intended for multi-tasking purposes. >It really looks to me that its not really there - at least for >the compaq. If someone has actually used this successfully I >would love to communicate with them. I have a working solution >to my problem (speeding up the system timer) but I still >would rather use int 70 if possible. Some of this text >is rattling on so the news program will accept it. > Jerry Freedman,Jr I used the following with success on PS/2s and ATs without problems. Notice that the manuals are not very clear on the subject of enabling this interrupt. Don't forget to include the right support files for the interrupt calls. I hope this helps. +---------------------------------------------------------------+ | Chet Laughlin CTL8588@RIGEL.TAMU.EDU | | "I have no opinions as I (128.194.4.4) | | do not exist, my lawyers | | told me so." | +---------------------------------------------------------------+ ---------------------------CUT HERE----------------------- int dos_flag; /* dummy flag DOS plays with */ void (interrupt far *old_int_handle)(); unsigned long timer_count; /* simple timer */ /* * Prog_Control * * Called by DOS int 70h once every 1/1024 seconds */ void interrupt Prog_Control() { /* do something quickly */ ++timer_count; /* simple timer */ _chain_intr(old_int_handle); /* move on to others in the INT chain*/ } /* * Start_Control * * hook into Int 70h chain so Dos will call us. Then tell Dos to * start making the calls. */ Start_Control() { union REGS regs; union SREGS segs; old_int_handle = _dos_getvect(0x70); /* remember old INT chain */ _dos_setvect(0x70,Prog_Control); /* install program routine */ regs.h.ah = 0x83; /* set function */ regs.x.cx = 0xFFFF; /* call us till hell freezes */ regs.x.dx = 0xFFFF; segs.es = FP_SEG(dos_flag); /* point to dummy flag */ regs.x.bx = FP_OFF(dos_flag); /* set by DOS */ int86x(0x15,®s,®s,&segs); /* start calling...*/ } /* * Stop_Control * * Take the program out of the INT chain softly so we can exit the * program without killing DOS in the process */ Stop_Control() { regs.h.ah = 0x83; /* pick DOS fuction...*/ regs.x.cx = 0x0000; /* only call me once more please */ regs.x.dx = 0x0001; /* then leave me alone */ segs.es = FP_SEG(dos_flag); /* point to DOS dummy flag */ regs.x.bx = FP_OFF(dos_flag); int86x(0x15,®s,®s,&segs); /* now stop it....*/ _dos_setvect(0x70,old_int_handle); /* and get out of the chain */ }