|
|
1.1 root 1: /*
1.1.1.4 root 2: Hatari - ikbd.h
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: 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.1.7 root 43: bool bReset; /* Set to TRUE is keyboard 'RESET' and now active */
1.1 root 44: } KEYBOARD_PROCESSOR;
45:
1.1.1.2 root 46: /* Keyboard state */
47: #define SIZE_KEYBOARD_BUFFER 1024 /* Allow this many bytes to be stored in buffer (waiting to send to ACIA) */
48: #define KEYBOARD_BUFFER_MASK (SIZE_KEYBOARD_BUFFER-1)
49: #define SIZE_KEYBOARDINPUT_BUFFER 8
50: typedef struct {
1.1.1.5 root 51: Uint8 KeyStates[SDLK_LAST]; /* State of PC's keys, TRUE is down */
52: Uint8 Buffer[SIZE_KEYBOARD_BUFFER]; /* Keyboard buffer */
1.1.1.2 root 53: int BufferHead,BufferTail; /* Pointers into above buffer */
1.1.1.5 root 54: Uint8 InputBuffer[SIZE_KEYBOARDINPUT_BUFFER]; /* Buffer for data send from CPU to keyboard processor (commands) */
1.1.1.2 root 55: int nBytesInInputBuffer; /* Number of command bytes in above buffer */
1.1 root 56:
1.1.1.2 root 57: int bLButtonDown,bRButtonDown; /* Mouse states in emulation system, BUTTON_xxxx */
1.1 root 58: int bOldLButtonDown,bOldRButtonDown;
59: int LButtonDblClk,RButtonDblClk;
60: int LButtonHistory,RButtonHistory;
61: } KEYBOARD;
62:
1.1.1.2 root 63: /* Button states, a bit mask so can mimick joystick/right mouse button duplication */
64: #define BUTTON_NULL 0x00 /* Button states, so can OR together mouse/joystick buttons */
65: #define BUTTON_MOUSE 0x01
66: #define BUTTON_JOYSTICK 0x02
1.1 root 67:
1.1.1.2 root 68: /* Mouse/Joystick modes */
69: #define AUTOMODE_OFF 0
1.1 root 70: #define AUTOMODE_MOUSEREL 1
71: #define AUTOMODE_MOUSEABS 2
1.1.1.2 root 72: #define AUTOMODE_MOUSECURSOR 3
1.1 root 73: #define AUTOMODE_JOYSTICK 4
74:
1.1.1.2 root 75: /* 0xfffc00 (read status from ACIA) */
1.1 root 76: #define ACIA_STATUS_REGISTER__RX_BUFFER_FULL 0x01
77: #define ACIA_STATUS_REGISTER__TX_BUFFER_EMPTY 0x02
1.1.1.10! root 78: #define ACIA_STATUS_REGISTER__OVERRUN_ERROR 0x20
1.1 root 79: #define ACIA_STATUS_REGISTER__INTERRUPT_REQUEST 0x80
80:
81: extern KEYBOARD_PROCESSOR KeyboardProcessor;
82: extern KEYBOARD Keyboard;
83:
1.1.1.6 root 84: extern void ACIA_Reset(void);
1.1.1.7 root 85: extern void IKBD_Reset_ExeMode ( void );
86: extern void IKBD_Reset(bool bCold);
87: extern void IKBD_MemorySnapShot_Capture(bool bSave);
1.1 root 88: extern void IKBD_InterruptHandler_ResetTimer(void);
1.1.1.10! root 89: extern void IKBD_InterruptHandler_ACIA_RX(void);
! 90: extern void IKBD_InterruptHandler_ACIA_TX(void);
1.1.1.7 root 91: extern void IKBD_InterruptHandler_MFP(void);
1.1.1.8 root 92: extern void IKBD_InterruptHandler_AutoSend(void);
1.1.1.4 root 93:
1.1.1.7 root 94: extern void IKBD_PressSTKey(Uint8 ScanCode, bool bPress);
1.1.1.4 root 95: extern void IKBD_KeyboardControl_ReadByte(void);
96: extern void IKBD_KeyboardData_ReadByte(void);
97: extern void IKBD_KeyboardControl_WriteByte(void);
98: extern void IKBD_KeyboardData_WriteByte(void);
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.