|
|
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 */
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 root 92: extern void IKBD_Reset(BOOL bCold);
93: extern void IKBD_MemorySnapShot_Capture(BOOL bSave);
1.1.1.4 root 94: extern void IKBD_SendAutoKeyboardCommands(void);
1.1 root 95: extern void IKBD_InterruptHandler_ResetTimer(void);
96:
97: extern void IKBD_Cmd_NullFunction(void);
98: extern void IKBD_Cmd_Reset(void);
99: extern void IKBD_Cmd_MouseAction(void);
100: extern void IKBD_Cmd_RelMouseMode(void);
101: extern void IKBD_Cmd_AbsMouseMode(void);
102: extern void IKBD_Cmd_MouseCursorKeycodes(void);
103: extern void IKBD_Cmd_SetMouseThreshold(void);
104: extern void IKBD_Cmd_SetMouseScale(void);
105: extern void IKBD_Cmd_ReadAbsMousePos(void);
106: extern void IKBD_Cmd_SetInternalMousePos(void);
107: extern void IKBD_Cmd_SetYAxisDown(void);
108: extern void IKBD_Cmd_SetYAxisUp(void);
109: extern void IKBD_Cmd_StartKeyboardTransfer(void);
110: extern void IKBD_Cmd_TurnMouseOff(void);
111: extern void IKBD_Cmd_StopKeyboardTransfer(void);
112: extern void IKBD_Cmd_ReturnJoystickAuto(void);
113: extern void IKBD_Cmd_StopJoystick(void);
114: extern void IKBD_Cmd_ReturnJoystick(void);
115: extern void IKBD_Cmd_SetJoystickDuration(void);
116: extern void IKBD_Cmd_SetJoystickFireDuration(void);
117: extern void IKBD_Cmd_SetCursorForJoystick(void);
118: extern void IKBD_Cmd_DisableJoysticks(void);
119: extern void IKBD_Cmd_SetClock(void);
120: extern void IKBD_Cmd_ReadClock(void);
121: extern void IKBD_Cmd_LoadMemory(void);
122: extern void IKBD_Cmd_ReadMemory(void);
123: extern void IKBD_Cmd_Execute(void);
124:
1.1.1.5 root 125: extern void IKBD_SendByteToKeyboardProcessor(Uint16 bl);
126: extern Uint16 IKBD_GetByteFromACIA(void);
1.1 root 127: extern void IKBD_InterruptHandler_ACIA(void);
128: extern void IKBD_SendByteToACIA(void);
1.1.1.5 root 129: extern void IKBD_AddKeyToKeyboardBuffer(Uint8 Data);
130: extern void IKBD_PressSTKey(Uint8 ScanCode, BOOL bPress);
1.1.1.4 root 131:
132: extern void IKBD_KeyboardControl_ReadByte(void);
133: extern void IKBD_KeyboardData_ReadByte(void);
134: extern void IKBD_KeyboardControl_WriteByte(void);
135: extern void IKBD_KeyboardData_WriteByte(void);
136:
137: #endif /* HATARI_IKBD_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.