;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ;Program: Input Module ;Platform: MS-DOS/ ;Programmer: Anti Resonance ; ;Replaces the BIOS keyboard handler to allow events to be generated by user defined key combinations ; ;Installs a second mouse handler that replaces the block cursor with a graphical one and allows ;events to be generated by clicking on user defined regions ; ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Revision History: ; ; 1.0 21.01.2000 ; Copyright (C)2000 Alpha-II Productions ;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Equates ;ASCII value - to be used with the option byte of GetKey and GetKeyExt K_ENH = 80h ;ASCII contains an enhanced key, not a character K_NPAD = 08h ;Keypress is from the number pad ;Option flags - to be used with GetKey K_SHIFT = 01h ;Shift key is being pressed K_CTRL = 02h ;Control key is being pressed K_ALT = 04h ;Alternate key is being pressed ;Option flags - to be used with GetKeyExt K_SHIFTL = 10h ;Left shift key is being pressed K_SHIFTR = 01h ;Right shift key is being pressed K_CTRLL = 20h ;Left control key is being pressed K_CTRLR = 02h ;Right control key is being pressed K_ALTL = 40h ;Left alternate key is being pressed K_ALTR = 04h ;Right alternate key is being pressed ;Enhanced keys - ASCII value when K_ENH is set K_ESC = 01h ;Escape K_BKSP = 08h ;Backspace K_TAB = 09h ;Tab K_ENTER = 0Dh ;Enter K_INS = 10h ;Insert K_DEL = 11h ;Delete K_HOME = 12h ;Home K_END = 17h ;End K_PGUP = 1Eh ;Page Up K_PGDN = 1Fh ;Page Down K_UP = 18h ;Up K_DOWN = 19h ;Down K_LEFT = 1Bh ;Left K_RIGHT = 1Ah ;Right K_SYSRQ = 0F0h ;(I'm not sure what that is...) K_WINL = 0FDh ;Left Window K_WINR = 0FEh ;Right Window K_MENU = 0FFh ;Menu (Micro$oft sucks!) K_F1 = 0F1h K_F2 = 0F2h K_F3 = 0F3h K_F4 = 0F4h K_F5 = 0F5h K_F6 = 0F6h K_F7 = 0F7h K_F8 = 0F8h K_F9 = 0F9h K_F10 = 0FAh K_F11 = 0FBh K_F12 = 0FCh K_F13 = 0FDh K_F14 = 0FEh K_F15 = 0FFh ;Switch states - to be used with GetKeyExt K_SCRLCK = 1 ;Scroll Lock is on K_NUMLCK = 2 ;Number Lock is on K_CAPLCK = 4 ;Capitals Lock is on K_INSERT = 8 ;Insert mode is on K_EXT = 80h ;Keypress is from an extended key ;Mouse buttons R_LEFT = 1 ;Left button is being pressed R_MID = 4 ;Middle button is being pressed R_RIGHT = 2 ;Right button is being pressed R_REL = 80h ;Trigger event when button is released CODEMAIN SEGMENT ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Capture Keyboard Interrupt ; ;Desc: ; Replaces interrupt 9 (IRQ 1) with internal handler. ; Note: Make sure interrupt is released before exiting program. ;In: ; nothing ;Out: ; nothing ;Destroys: ; nothing CapKeybd PROCDESC C NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Release Keyboard Interrupt ; ;Desc: ; Restores interrupt 9 with the BIOS handler ;In: ; nothing ;Out: ; nothing ;Destroys: ; nothing RelKeybd PROCDESC C NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Check Keypress ; ;Desc: ; Checks to see if a key's been pressed ; Only returns true if ASCII modified ;In: ; nothing ;Out: ; ZF = Clear if a key's been pressed ;Destroys: ; Nothing ChkKey PROCDESC NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Get Keypress ; ;Desc: ; Returns information about the keypress ; If a key hasn't been pressed, it will wait until one is ;In: ; nothing ;Out: ; AL = ASCII character or extended code ; AH = Flags for option keys and ASCII value ;Destroys: ; Nothing GetKey PROCDESC NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Check Keypress - Extended ; ;Desc: ; Checks to see if a key's been pressed ; Returns true if ANY key is pressed ;In: ; nothing ;Out: ; AL = Switch states ; ZF = Clear if a key's been pressed ;Destroys: ; Nothing ChkKeyExt PROCDESC NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Get Keypress - Extended ; ;Desc: ; Returns information about the keypress ; If a key hasn't been pressed, it will wait until one is ;In: ; nothing ;Out: ; AL = ASCII Code (0 if keypress was an option or switch key) ; AH = Flags for option keys and ASCII value ; DL = Keyboard scan code ; DH = Switch states ;Destroys: ; Nothing GetKeyExt PROCDESC NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Set Keypress Event List ; ;Desc: ; Tells the keyboard handler where the list of events are. ; ; An event is a function called when a key or key combination is pressed. ; ; When a key is pressed it is compared with a 16-bit value. This value is the same as that ; returned in AX by GetKey. ; Values for the word are: ; byte 0 - ASCII character or extended key number ; byte 1 - Option key flags and extended flag ; ; Upon entrance, the following registers will be set: ; AL = ASCII character or extended code ; AH = Flags for option keys and ASCII value ; CS -> CODEMAIN ; DS & ES -> DATAMAIN ; SS:SP -> STAKMAIN ; All others are undefined ; ; Inside the function all registers can be freely modified ; ; Event procedures are near calls, therefore must be located in the segment CODEMAIN. ; ; Keypresses must be an ASCII character or extended key. ; For example: Shift alone can't trigger an event. ; ; Option keys are non specific when triggering events. Specifying left or right doesn't matter. ; For example: If you have an event handler for the combination of the right ALT key and F, ; the event will still be triggered if the user presses the left ALT key and F. ; If you need to know which option key was pressed, call GetKeyExt inside your handler. ; ; Enhanced keys are non specific when triggering events. You cannot specify a key coming from the ; number pad. ; For example: The Delete key and the . key on the number pad (when the num lock is off) will ; trigger the same event. ; If you specify an event to be triggered by the numberpad, it will never get called. ; ;In: ; Num = Number of events in list (0=no event list) ; Lst-> List of events and handlers (6 bytes): ; 0 byte - ASCII character or extended code ; 1 byte - Flags for option keys and ASCII value ; 2 dword - Near pointer to function ;Out: ; nothing ;Destroys: ; AX SetKeyList PROCDESC C NEAR Num:Word,Lst:Word ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Setup Alternate Mouse Handler ; ;Desc: ; Passes a vector to the mouse driver that calls an alternate mouse handler. ; Screen must be in 8x8 text mode with a page width of 128, and have odd/even memory addressing ; turned off. ;In: ; CMap -> 4K (512*8) Character set bitmaps ; CType = Mouse cursor type (0=Graphical 1=Block) ;Out: ; nothing ;Destroys: ; AX,CX,DX TrapRat PROCDESC C NEAR CMap:Word, CType:Word ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Release Mouse Handler ; ;Desc: ; Restores interrupt 9 with the BIOS handler ;In: ; nothing ;Out: ; nothing ;Destroys: ; AX,CX,DX,ES RelRat PROCDESC NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Get Mouse Cursor Information ; ;Desc: ; Returns the status of the mouse ;In: ; nothing ;Out: ; AL = X position on screen ; AH = Y position on screen ; BL = Buttons being pressed ;Destroys: ; Nothing ChkRat PROCDESC NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Set Mouse Click Event List ; ;Desc: ; Tells the mouse handler where the list of events are. ; ; An event is a function called when a button is pressed or released and the cursor is inside ; a specified region. ; ; First the current state of the buttons is tested with a byte. If any of the bits match, the ; event is true. ; Values for the byte are: ; bits 0-2 = buttons 1-3 being pressed ; bits 4-6 = buttons 1-3 being released ; For example: a value of 22h would trigger an event if button 2 was pressed or released ; ; If the buttons match, then the absolute location of the cursor is checked against a region. ; If the cursor is on the border or within the region, then the event handler gets called. ; Values for the region are composed of two words: ; First word = Lower right hand corner of region ; Second word = Upper left hand corner of region ; The upper byte of a word contains the absolute Y value and the lower byte contains the ; absolute X value. ; ; Upon entrance to an event handler: ; The following registers will be set: ; AH = Y ; AL = X ; CH = Button status ; CS -> CODEMAIN ; DS -> DATAMAIN ; ES -> B8000h ; SS:SP -> STAKMAIN ; All others are undefined ; ; The mouse cursor is inactive and erased from the screen. It cannot be turned on. ; ; Inside the function all registers can be freely modified ; ; Event procedures are near calls, therefore must be located in the segment CODEMAIN. ; ;In: ; Num = Number of events in list (0=no event list) ; Lst-> List of events and handlers (12 bytes): ; 0 byte - Button status ; 4 word - Lower, right-hand corner of region (Y,X) ; 6 word - Upper, left-hand corner of region (Y,X) ; 8 dword - Near pointer to function ;Out: ; nothing ;Destroys: ; AX SetRatList PROCDESC C NEAR Num:Word,Lst:Word ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Turn Off Mouse Cursor ; ;Desc: ; Disables the mouse cursor, but keeps the driver active ; The driver keeps track of the number of times the cursor is turned off. For each time the ; cursor is turned off, it must be turned on before it is visible. ; If an event handler is in process, this function has no effect (the cursor is disabled). ;In: ; nothing ;Out: ; nothing ;Destroys: ; Nothing HideRat PROCDESC C NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Turn On Mouse Cursor ; ;Desc: ; Enables the mouse cursor ; The driver keeps track of the number of times the cursor is turned off. For each time the ; cursor is turned off, it must be turned on before it is visible. ; If the cursor is already visible, this function has no effect. ;In: ; nothing ;Out: ; nothing ;Destroys: ; nothing ShowRat PROCDESC C NEAR ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Move Mouse Window ; ;Desc: ; Changes the location of the window specified internally by M_MAXX and M_MAXY. ; (By default the window is located at 0,0, but in the event that the starting offset of display ; memory is changed the mouse window will have to be moved to keep the cursor on the screen.) ;In: ; X = Horizontal location of upper left corner (0-127) ; Y = Vertical location of upper left corner (0-67) ;Out: ; nothing ;Destroys: ; nothing MoveCage PROCDESC C NEAR X:Word,Y:Word ;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ;Move Mouse Cursor ; ;Desc: ; Changes the current location of the mouse cursor ;In: ; X = Absolute horizontal position ; Y = Absolute vertical position ;Out: ; nothing ;Destroys: ; nothing MoveRat PROCDESC C NEAR X:Word,Y:Word CODEMAIN ENDS