home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / msdos / programm / 7982 < prev    next >
Encoding:
Text File  |  1992-07-20  |  4.3 KB  |  132 lines

  1. Newsgroups: comp.os.msdos.programmer,connect.audit
  2. Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!giaeb!s1110238
  3. From: s1110238@giaeb.cc.monash.edu.au (Lee Hollingworth)
  4. Subject: Re: REQUEST FOR INFO: DISABLING ^C
  5. Message-ID: <s1110238.711712490@giaeb>
  6. Sender: news@monu6.cc.monash.edu.au (Usenet system)
  7. Organization: Monash University, Melb., Australia.
  8. References: <1992Jul20.124824.2971@ibmpcug.co.uk>
  9. Date: Tue, 21 Jul 1992 09:54:50 GMT
  10. Lines: 120
  11.  
  12. fredc@ibmpcug.co.uk (Fred Curtis) writes:
  13.  
  14. >I want to disable the ^C interrupt.  I can trap it and ignore it
  15. >by reseting the DOS interrupt vector, but it still prints "^C" on
  16. >the screen.
  17.  
  18. Use the bios functions that use Interrupt 16h function 00h, if you are
  19. using MSC use _bios_keybrd(K_READ), if Borland TC++ or C++ use bioskey(0)
  20. to wait and read user input.
  21.  
  22. Or below is a simple asm listing which can be compiled and included in a
  23. C program...
  24.  
  25. Lee Hollingworth
  26. s1110238@giaeb.cc.monash.edu.au
  27.  
  28. # This is a shell archive.  Remove anything before this line,
  29. # then unpack it by saving it in a file and typing "sh file".
  30. #
  31. # Wrapped by Lee Hollingworth <s1110238@giaeb> on Tue Jul 21 20:07:03 1992
  32. #
  33. # This archive contains:
  34. #    biosibm.h    biosibm.asm    
  35. #
  36.  
  37. LANG=""; export LANG
  38. PATH=/bin:/usr/bin:$PATH; export PATH
  39.  
  40. echo x - biosibm.h
  41. cat >biosibm.h <<'@EOF'
  42. /****
  43.  * file:   biosibm.h
  44.  * purpose: defines for biosibm.asm
  45.  ****/
  46.  
  47. #ifndef BIOSKEYS
  48. #define BIOSKEYS
  49.  
  50. /* bioskeybrd services */
  51. #define K_READ      0x10
  52. #define K_READY     0x11
  53. #define K_STATUS    0x12
  54.  
  55. /* enhanced keyboard status bits */
  56. #define K_RSHIFT    0x0000         /* right shift is down   */
  57. #define K_LSHIFT    0x0002         /* left shift is down    */
  58. #define K_CTRL      0x0004         /* both Ctrl keys down   */
  59. #define K_ALT       0x0008         /* both Alt keys down    */
  60. #define K_SCROLL    0x0010         /* scroll lock toggle on */
  61. #define K_NUM       0x0020         /* num lock toggle on    */
  62. #define K_CAP       0x0040         /* cap lock toggle on    */
  63. #define K_INS       0x0080         /* insert toggle is on   */
  64. #define K_LCTRL     0x0100         /* left Ctrl key down    */
  65. #define K_LALT      0x0200         /* left Alt key down     */
  66. #define K_RCTRL     0x0400         /* right Ctrl key down   */
  67. #define K_RALT      0x0800         /* right Alt key down    */
  68. #define K_PSCROLL   0x1000         /* scroll key is down    */
  69. #define K_PNUM      0x2000         /* num key is down       */
  70. #define K_PCAP      0x4000         /* cap key is down       */
  71. #define K_SYSRQ     0x8000         /* sys rq key is down    */
  72.  
  73. #endif
  74.  
  75. extern unsigned bioskeybrd(unsigned int service);
  76. @EOF
  77.  
  78. chmod 600 biosibm.h
  79.  
  80. echo x - biosibm.asm
  81. cat >biosibm.asm <<'@EOF'
  82. ;---------------------------------------------------------------------------
  83. ; file:     biosibm.asm
  84. ; purpose:  int 16h keyboard status functions
  85. ; author:   Lee Hollingworth
  86. ; header:   biosibm.h
  87. ;---------------------------------------------------------------------------
  88.  
  89. key_ready   equ     01h             ; function K_READY
  90.  
  91.             .model small
  92.             .code
  93. public      _bioskeybrd
  94. ;----------------------- bioskeybrd ----------------------------------------
  95. ;   call    unsigned int bioskeybrd(service);
  96. ;           unsigned int service;
  97. ;   services
  98. ;           K_READ      read character and scan code, wait if none ready
  99. ;           K_READY     check if a key is waiting to be read
  100. ;           K_STATUS    get the current keyboard status
  101. ;               refer to biosibm.h for defines
  102. ;----------------------------------------------------------------------------
  103. _bioskeybrd proc
  104.             push    bp
  105.             mov     bp, sp              ; mov stack pointer to base pointer
  106.             push    si
  107.             push    di
  108.  
  109.             mov     ah, [bp+4]          ; get service argument
  110.             cmp     ah, key_ready       ; special case for key_ready service
  111.             jne     key_read_status     ; jump if not key_ready
  112.             int     16h
  113.             jnz     alldone             ; jmp if character waiting to be read
  114.             xor     ax, ax              ; otherwise return 0
  115.             jmp     alldone
  116.  
  117. key_read_status:
  118.             int     16h                 ; simple call for read or status
  119.  
  120. alldone:
  121.             pop     di
  122.             pop     si
  123.             pop     bp
  124.             ret
  125. _bioskeybrd endp
  126.             end
  127. @EOF
  128.  
  129. chmod 600 biosibm.asm
  130.  
  131. exit 0
  132.