Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!bionet!csd4.milw.wisc.edu!lll-winken!uunet!pilchuck!dataio!bright From: bright@Data-IO.COM (Walter Bright) Newsgroups: comp.sys.ibm.pc Subject: How to inhibit ^C from appearing Message-ID: <1941@dataio.Data-IO.COM> Date: 12 Apr 89 18:45:07 GMT References: <89Apr4.202845edt.2759@godzilla.eecg.toronto.edu> <4212@ttidca.TTI.COM> <1075@ptolemy.arc.nasa.gov> Reply-To: bright@dataio.Data-IO.COM (Walter Bright) Distribution: na Organization: Data I/O Corporation; Redmond, WA Lines: 31 In article <1075@ptolemy.arc.nasa.gov> raymond@ptolemy.arc.nasa.gov (Eric A. Raymond) writes: >Now, how to get rid of the ^C echo? This requires: 1. Save the state of DOS break checking (DOS function 0x33). 2. Turn off DOS break checking (DOS function 0x33). 3. Intercept interrupt 0x23 (the ^C interrupt). 4. Intercept interrupt 0x1B (the cntl-break interrupt). This is not portable to non-IBM clone BIOSes. Intercepting this will prevent DOS from getting control when a cntl-break occurs. 0x1B is issued by the BIOS when a cntl-break is detected. 5. Don't call any of the DOS functions that always do break checking. Now, if the user presses cntl-break, your handler gets it. If the user presses ^C, it will either appear as an interrupt 0x23, or will appear in the BIOS keyboard buffer (int 0x16), depending on if you got to it before DOS did. Upon program exit, be sure and: 1. Restore the previous 0x1B handler. 2. Restore the original state of the DOS break checking. 3. The previous 0x23 handler will be automatically restored by DOS. I've used the above successfully to eliminate the ^C appearing all over my screen oriented program. Another technique that works in text mode is to intercept interrupt 0x23, and have your service routine set a global flag. In the main loop, check the flag. If it's set, simply rewrite the entire screen, then clear the flag. I've used this technique too, when I wanted to be entirely MS-DOS portable.