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