home *** CD-ROM | disk | FTP | other *** search
- { SPX Library Version 1.0 Copyright 1993 Scott D. Ramsay }
-
- SPX_KEY is the keyboard handling unit. It takes over the keyboard
- interrupt to allow for reading of multiple keys at the same time.
-
- The (boolean) flags below tells if that key is pressed. If the flag
- is TRUE then a user has key down. FALSE means the key is not pressed.
-
- Look at the following IF-THEN Pascal code:
-
- if enter and esc and space and lshft
- then { Some one is pressing the Enter, Esc, Space, AND, Left Shift key }
-
- There is also a custom array flag build specfically for one/two player
- games.
-
- NP[1..9,1..2] of boolean;
-
- Think of the first index as a key grid like the numeric key pad and
- the second index as which player then your program can use
-
- NP[n,1] Direction NP[n,2]
- Player One Player Two
- ┌───┬───┬───┐ ┌───┬───┬───┐ ┌───┬───┬───┐
- │n=7│n=8│n=9│ │ \ │/|\│ / │ │n=7│n=8│n=9│
- ├───┼───┼───┤ ├───┼───┼───┤ ├───┼───┼───┤
- │n=4│n=5│n=6│ │<- │ │ ->│ │n=4│n=5│n=6│
- ├───┼───┼───┤ ├───┼───┼───┤ ├───┼───┼───┤
- │n=1│n=2│n=3│ │ / │\|/│ \ │ │n=1│n=2│n=3│
- └───┴───┴───┘ └───┴───┴───┘ └───┴───┴───┘
-
-
- You can use NP[8,x] as the up key, NP[6,x] as the right key etc.
-
- e.g.
-
- if np[6,1]
- then { Move player 1 to the right }
- if np[1,2]
- then { Move player 2 left and down }
-
- ───────────────────────────────────────────────────────────────────────────
- cleared, { TRUE - if int is disabled }
- cold, { TRUE - call old int }
- plus, { plus key pressed }
- minus, { minus key pressed }
- lshft,rshft, { shift keys pressed }
- space, { space key pressed }
- bspc, { backspace pressed }
- esc, { esc pressed }
- enter : boolean; { enter pressed }
-
- ───────────────────────────────────────────────────────────────────────────
- procedure clearbuffer;
-
- Waits until no key is pressed
-
- ───────────────────────────────────────────────────────────────────────────
- procedure clearkeyint;
-
- Restores the old keyboard interrupt
-
- ───────────────────────────────────────────────────────────────────────────
- procedure installkeyint;
-
- Installs the SPX_KEY keyboard interrupt
-
- Use with clearkeyint. To install and remove the interrupt multiple
- times during the program.
-
- ───────────────────────────────────────────────────────────────────────────
- function anykey:boolean;
-
- Returns TRUE if any key is pressed
-
- ───────────────────────────────────────────────────────────────────────────
- procedure cli; inline($fa);
-
- Disable maskable interrupts
-
- ───────────────────────────────────────────────────────────────────────────
- procedure sti; inline($fb);
-
- Enable maskable interrupts
-
- ───────────────────────────────────────────────────────────────────────────
-
-