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