|
|
1.1 root 1: /*
1.1.1.4 root 2: Hatari - ikbd.h
3:
1.1.1.11 root 4: This file is distributed under the GNU General Public License, version 2
5: or at your option any later version. Read the file gpl.txt for details.
1.1 root 6: */
7:
1.1.1.4 root 8: #ifndef HATARI_IKBD_H
9: #define HATARI_IKBD_H
10:
1.1.1.2 root 11: /* Keyboard processor details */
1.1 root 12:
13: typedef struct {
1.1.1.2 root 14: int X,Y; /* Position of mouse */
15: int MaxX,MaxY; /* Max limits of mouse */
1.1.1.5 root 16: Uint8 PrevReadAbsMouseButtons; /* Previous button mask for 'IKBD_Cmd_ReadAbsMousePos' */
1.1 root 17: } ABS_MOUSE;
18:
19: typedef struct {
1.1.1.3 root 20: int dx, dy; /* Mouse delta to be added */
21: int DeltaX,DeltaY; /* Final XY mouse position delta */
1.1.1.2 root 22: int XScale,YScale; /* Scale of mouse */
23: int XThreshold,YThreshold; /* Threshold */
1.1.1.5 root 24: Uint8 KeyCodeDeltaX,KeyCodeDeltaY; /* Delta X,Y for mouse keycode mode */
1.1.1.2 root 25: int YAxis; /* Y-Axis direction */
1.1.1.5 root 26: Uint8 Action; /* Bit 0-Report abs position of press, Bit 1-Report abs on release */
1.1 root 27: } MOUSE;
28:
29: typedef struct {
1.1.1.5 root 30: Uint8 JoyData[2]; /* Joystick details */
1.1.1.12 root 31: Uint8 PrevJoyData[2]; /* Previous joystick details, used to check for 'IKBD_SendAutoJoysticks' */
1.1 root 32: } JOY;
33:
34: typedef struct {
35: ABS_MOUSE Abs;
36: MOUSE Mouse;
37: JOY Joy;
1.1.1.2 root 38: int MouseMode; /* AUTOMODE_xxxx */
39: int JoystickMode; /* AUTOMODE_xxxx */
1.1 root 40: } KEYBOARD_PROCESSOR;
41:
1.1.1.2 root 42: /* Keyboard state */
1.1.1.12 root 43: #define KBD_MAX_SCANCODE 0x72
1.1.1.2 root 44: #define SIZE_KEYBOARD_BUFFER 1024 /* Allow this many bytes to be stored in buffer (waiting to send to ACIA) */
45: #define KEYBOARD_BUFFER_MASK (SIZE_KEYBOARD_BUFFER-1)
46: #define SIZE_KEYBOARDINPUT_BUFFER 8
47: typedef struct {
1.1.1.12 root 48: Uint8 KeyStates[KBD_MAX_SCANCODE + 1]; /* State of ST keys, TRUE is down */
1.1.1.11 root 49:
50: Uint8 Buffer[SIZE_KEYBOARD_BUFFER]; /* Keyboard output buffer */
51: int BufferHead,BufferTail; /* Pointers into above buffer */
52: int NbBytesInOutputBuffer; /* Number of bytes in output buffer */
1.1.1.12 root 53: bool PauseOutput; /* If true, don't send bytes anymore (see command 0x13) */
1.1.1.11 root 54:
55: Uint8 InputBuffer[SIZE_KEYBOARDINPUT_BUFFER]; /* Buffer for data send from CPU to keyboard processor (commands) */
56: int nBytesInInputBuffer; /* Number of command bytes in above buffer */
1.1 root 57:
1.1.1.2 root 58: int bLButtonDown,bRButtonDown; /* Mouse states in emulation system, BUTTON_xxxx */
1.1 root 59: int bOldLButtonDown,bOldRButtonDown;
60: int LButtonDblClk,RButtonDblClk;
1.1.1.13! root 61: unsigned int LButtonHistory, RButtonHistory;
1.1.1.12 root 62:
63: int AutoSendCycles; /* Number of cpu cycles to call INTERRUPT_IKBD_AUTOSEND */
1.1 root 64: } KEYBOARD;
65:
1.1.1.2 root 66: /* Button states, a bit mask so can mimick joystick/right mouse button duplication */
67: #define BUTTON_NULL 0x00 /* Button states, so can OR together mouse/joystick buttons */
68: #define BUTTON_MOUSE 0x01
69: #define BUTTON_JOYSTICK 0x02
1.1 root 70:
1.1.1.2 root 71: /* Mouse/Joystick modes */
1.1.1.12 root 72: #define AUTOMODE_OFF 0
73: #define AUTOMODE_MOUSEREL 1
74: #define AUTOMODE_MOUSEABS 2
75: #define AUTOMODE_MOUSECURSOR 3
76: #define AUTOMODE_JOYSTICK 4
77: #define AUTOMODE_JOYSTICK_MONITORING 5
1.1 root 78:
1.1.1.2 root 79: /* 0xfffc00 (read status from ACIA) */
1.1 root 80: #define ACIA_STATUS_REGISTER__RX_BUFFER_FULL 0x01
81: #define ACIA_STATUS_REGISTER__TX_BUFFER_EMPTY 0x02
1.1.1.10 root 82: #define ACIA_STATUS_REGISTER__OVERRUN_ERROR 0x20
1.1 root 83: #define ACIA_STATUS_REGISTER__INTERRUPT_REQUEST 0x80
84:
85: extern KEYBOARD_PROCESSOR KeyboardProcessor;
86: extern KEYBOARD Keyboard;
87:
1.1.1.11 root 88: extern void IKBD_Init ( void );
1.1.1.7 root 89: extern void IKBD_Reset(bool bCold);
90: extern void IKBD_MemorySnapShot_Capture(bool bSave);
1.1.1.11 root 91:
1.1 root 92: extern void IKBD_InterruptHandler_ResetTimer(void);
1.1.1.8 root 93: extern void IKBD_InterruptHandler_AutoSend(void);
1.1.1.4 root 94:
1.1.1.11 root 95: extern void IKBD_UpdateClockOnVBL ( void );
96:
97:
1.1.1.7 root 98: extern void IKBD_PressSTKey(Uint8 ScanCode, bool bPress);
1.1.1.4 root 99:
100: #endif /* HATARI_IKBD_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.