home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer,connect.audit
- Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!giaeb!s1110238
- From: s1110238@giaeb.cc.monash.edu.au (Lee Hollingworth)
- Subject: Re: REQUEST FOR INFO: DISABLING ^C
- Message-ID: <s1110238.711712490@giaeb>
- Sender: news@monu6.cc.monash.edu.au (Usenet system)
- Organization: Monash University, Melb., Australia.
- References: <1992Jul20.124824.2971@ibmpcug.co.uk>
- Date: Tue, 21 Jul 1992 09:54:50 GMT
- Lines: 120
-
- fredc@ibmpcug.co.uk (Fred Curtis) writes:
-
- >I want to disable the ^C interrupt. I can trap it and ignore it
- >by reseting the DOS interrupt vector, but it still prints "^C" on
- >the screen.
-
- Use the bios functions that use Interrupt 16h function 00h, if you are
- using MSC use _bios_keybrd(K_READ), if Borland TC++ or C++ use bioskey(0)
- to wait and read user input.
-
- Or below is a simple asm listing which can be compiled and included in a
- C program...
-
- Lee Hollingworth
- s1110238@giaeb.cc.monash.edu.au
-
- # This is a shell archive. Remove anything before this line,
- # then unpack it by saving it in a file and typing "sh file".
- #
- # Wrapped by Lee Hollingworth <s1110238@giaeb> on Tue Jul 21 20:07:03 1992
- #
- # This archive contains:
- # biosibm.h biosibm.asm
- #
-
- LANG=""; export LANG
- PATH=/bin:/usr/bin:$PATH; export PATH
-
- echo x - biosibm.h
- cat >biosibm.h <<'@EOF'
- /****
- * file: biosibm.h
- * purpose: defines for biosibm.asm
- ****/
-
- #ifndef BIOSKEYS
- #define BIOSKEYS
-
- /* bioskeybrd services */
- #define K_READ 0x10
- #define K_READY 0x11
- #define K_STATUS 0x12
-
- /* enhanced keyboard status bits */
- #define K_RSHIFT 0x0000 /* right shift is down */
- #define K_LSHIFT 0x0002 /* left shift is down */
- #define K_CTRL 0x0004 /* both Ctrl keys down */
- #define K_ALT 0x0008 /* both Alt keys down */
- #define K_SCROLL 0x0010 /* scroll lock toggle on */
- #define K_NUM 0x0020 /* num lock toggle on */
- #define K_CAP 0x0040 /* cap lock toggle on */
- #define K_INS 0x0080 /* insert toggle is on */
- #define K_LCTRL 0x0100 /* left Ctrl key down */
- #define K_LALT 0x0200 /* left Alt key down */
- #define K_RCTRL 0x0400 /* right Ctrl key down */
- #define K_RALT 0x0800 /* right Alt key down */
- #define K_PSCROLL 0x1000 /* scroll key is down */
- #define K_PNUM 0x2000 /* num key is down */
- #define K_PCAP 0x4000 /* cap key is down */
- #define K_SYSRQ 0x8000 /* sys rq key is down */
-
- #endif
-
- extern unsigned bioskeybrd(unsigned int service);
- @EOF
-
- chmod 600 biosibm.h
-
- echo x - biosibm.asm
- cat >biosibm.asm <<'@EOF'
- ;---------------------------------------------------------------------------
- ; file: biosibm.asm
- ; purpose: int 16h keyboard status functions
- ; author: Lee Hollingworth
- ; header: biosibm.h
- ;---------------------------------------------------------------------------
-
- key_ready equ 01h ; function K_READY
-
- .model small
- .code
- public _bioskeybrd
- ;----------------------- bioskeybrd ----------------------------------------
- ; call unsigned int bioskeybrd(service);
- ; unsigned int service;
- ; services
- ; K_READ read character and scan code, wait if none ready
- ; K_READY check if a key is waiting to be read
- ; K_STATUS get the current keyboard status
- ; refer to biosibm.h for defines
- ;----------------------------------------------------------------------------
- _bioskeybrd proc
- push bp
- mov bp, sp ; mov stack pointer to base pointer
- push si
- push di
-
- mov ah, [bp+4] ; get service argument
- cmp ah, key_ready ; special case for key_ready service
- jne key_read_status ; jump if not key_ready
- int 16h
- jnz alldone ; jmp if character waiting to be read
- xor ax, ax ; otherwise return 0
- jmp alldone
-
- key_read_status:
- int 16h ; simple call for read or status
-
- alldone:
- pop di
- pop si
- pop bp
- ret
- _bioskeybrd endp
- end
- @EOF
-
- chmod 600 biosibm.asm
-
- exit 0
-