home *** CD-ROM | disk | FTP | other *** search
- ' *********** CHNEVENT.BAS *******************************************
-
- DEFINT A-Z
-
- DECLARE FUNCTION InstallHandler% (BYVAL InterruptNumber%)
-
- ' This MASM function attempts to install our service routine,
- ' returning -1 if it could not do so (zero if OK). The parameter
- ' InterruptNumber can range from 0-255, but for the sake of your
- ' sanity, please don't try it indiscriminately... there *are* some
- ' vectors which will cause crashes (at a minimum).
- '
- ' Contrast this with the InstallHandler in the HDWEVENT package, which
- ' is passed an IRQ number from 2-7, not a vector number from 0 to 255.
- '
- ' NOTE that this CANNOT be called multiple times to install multiple
- ' handlers!
-
- ON UEVENT GOSUB MyEventHandler 'establish a handler
- UEVENT ON 'activate handler
-
- IF InstallHandler(9) THEN
- PRINT "Could not install interrupt handler"
- STOP
- END IF
-
- ' The following is just a way to get INT 9's to occur. Whatever you
- ' type will be echoed onto the screen, and each press, release, or
- ' repeat of a key will invoke MyEventHandler, causing a click sound.
-
- DO
- k$ = INKEY$
- IF k$ = CHR$(27) THEN
- EXIT DO
- END IF
- PRINT k$;
- LOOP
- SYSTEM
-
- MyEventHandler: 'just make a ticking noise when the event is detected
-
- SOUND 2000, .1 'make a small noise
- RETURN
-
-