home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / v9t9 / linux / sources / V9t9 / source / keyboard.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-10-19  |  2.0 KB  |  78 lines

  1. #include "centry.h"
  2.  
  3. int keyboard_preconfiginit(void);
  4. int    keyboard_postconfiginit(void);
  5. int keyboard_restart(void);
  6. void keyboard_restop(void);
  7.  
  8. void keyboard_setkey(int onoff,u8 shift,u8 key);
  9. int keyboard_isset(u8 shift,u8 key);
  10.  
  11. //    Joy = 1 or 2, x=-1,0,1, y=-1,0,1, fire=0,1
  12.  
  13. enum
  14. {
  15.     JOY_X = 1,    // set X-axis
  16.     JOY_Y = 2,    // set Y-axis
  17.     JOY_B = 4    // set buttons
  18. };
  19.  
  20. void    keyboard_setjoyst(int joy, int mask, int x, int y, int fire);
  21.  
  22. // organized by columns, rows are in 1 << row
  23. extern    u8    crukeyboardmap[8];
  24. extern    u8    caps,crukeyboardcol,AlphaLock;
  25. extern    u8    realshift;    /*    'real' shift keys being held down,
  26.                             as opposed to those being faked */
  27.  
  28. //extern    u16    specialkey;    
  29.  
  30. /*    Map of ASCII codes and their direct CRU mapping
  31.     (high nybble=row, low nybble=column), except for 0xff,
  32.     which should be faked. */
  33. extern    u8 latinto9901[128];
  34.  
  35. /*    This macro tells us whether an ASCII code has a direct mapping
  36.     to a 9901 keyboard matrix location (stored in latinto9901[]).
  37.     The '/' character is special, since its 99/4A shifted value ('-') is not
  38.     the same as the standard keyboard's shifted value ('?'). 
  39.     (This is important when we are using a host keyboard module that
  40.     allows us to know the unshifted value of a pressed key.)
  41. */
  42.  
  43. #define ASCII_DIRECT_TO_9901(x) (latinto9901[x] != 0xff && (x) != '/')
  44.  
  45. #define SETKBDCRU(r,c) crukeyboardmap[c]|=(0x80>>(r))
  46. #define RESETKBDCRU(r,c) crukeyboardmap[c]&=~(0x80>>(r))
  47. #define TESTKBDCRU(r,c) (crukeyboardmap[c]&(0x80>>(r)))
  48. #define TOGGLEKBDCRU(r,c) crukeyboardmap[c]^=(0x80>>(r))
  49.  
  50. #define CHANGEKBDCRU(r,c,v) do { if (v) SETKBDCRU(r,c); else RESETKBDCRU(r,c); } while (0)
  51.  
  52.  
  53. #define SHIFT_R 2
  54. #define SHIFT_C 0
  55. #define FCTN_R 3
  56. #define FCTN_C 0
  57. #define CTRL_R 1
  58. #define CTRL_C 0
  59.  
  60. #define JOY1_C 6
  61. #define JOY2_C 7
  62.  
  63. #define JOY_FIRE_R 7
  64. #define JOY_LEFT_R 6
  65. #define JOY_RIGHT_R 5
  66. #define JOY_DOWN_R 4
  67. #define JOY_UP_R 3
  68.  
  69. //    j=1 or 2
  70. #define CHANGEJOYCRU(j,r,v) CHANGEKBDCRU(r, JOY1_C+(j)-1,v)
  71.  
  72. #define SHIFT 1
  73. #define FCTN 2
  74. #define CTRL 4
  75.  
  76. #include "cexit.h"
  77.  
  78.