|
|
1.1 root 1: /*
2: Hatari
3: */
4:
1.1.1.2 ! root 5: #include <SDL_keysym.h> /* Needed for SDLK_LAST */
! 6:
! 7:
! 8: /* Keyboard Command */
1.1 root 9: typedef struct {
10: unsigned char Command;
11: unsigned char NumParameters;
12: void *pCallFunction;
13: } IKBD_COMMAND_PARAMS;
14:
1.1.1.2 ! root 15: /* Keyboard processor details */
1.1 root 16: typedef struct {
1.1.1.2 ! root 17: int X,Y; /* Relative position of mouse */
! 18: int PrevX,PrevY; /* Previous position */
1.1 root 19: } REL_MOUSE;
20:
21: typedef struct {
1.1.1.2 ! root 22: int X,Y; /* Position of mouse */
! 23: int MaxX,MaxY; /* Max limits of mouse */
! 24: unsigned char PrevReadAbsMouseButtons; /* Previous button mask for 'IKBD_Cmd_ReadAbsMousePos' */
1.1 root 25: } ABS_MOUSE;
26:
27: typedef struct {
1.1.1.2 ! root 28: int DeltaX,DeltaY; /* XY mouse position delta after scale according to resoution */
! 29: int XScale,YScale; /* Scale of mouse */
! 30: int XThreshold,YThreshold; /* Threshold */
! 31: unsigned char KeyCodeDeltaX,KeyCodeDeltaY; /* Delta X,Y for mouse keycode mode */
! 32: int YAxis; /* Y-Axis direction */
! 33: unsigned char Action; /* Bit 0-Report abs position of press, Bit 1-Report abs on release */
1.1 root 34: } MOUSE;
35:
36: typedef struct {
1.1.1.2 ! root 37: unsigned char JoyData[2]; /* Joystick details */
! 38: unsigned char PrevJoyData[2]; /* Previous joystick details, used to check for 'IKBD_SelAutoJoysticks' */
1.1 root 39: } JOY;
40:
41: typedef struct {
42: REL_MOUSE Rel;
43: ABS_MOUSE Abs;
44: MOUSE Mouse;
45: JOY Joy;
1.1.1.2 ! root 46: int MouseMode; /* AUTOMODE_xxxx */
! 47: int JoystickMode; /* AUTOMODE_xxxx */
! 48: BOOL bReset; /* Set to TRUE is keyboard 'RESET' and now active */
1.1 root 49: } KEYBOARD_PROCESSOR;
50:
1.1.1.2 ! root 51: /* Keyboard state */
! 52: #define SIZE_KEYBOARD_BUFFER 1024 /* Allow this many bytes to be stored in buffer (waiting to send to ACIA) */
! 53: #define KEYBOARD_BUFFER_MASK (SIZE_KEYBOARD_BUFFER-1)
! 54: #define SIZE_KEYBOARDINPUT_BUFFER 8
! 55: typedef struct {
! 56: unsigned char KeyStates[SDLK_LAST]; /* State of PC's keys, TRUE is down */
! 57: unsigned char Buffer[SIZE_KEYBOARD_BUFFER]; /* Keyboard buffer */
! 58: int BufferHead,BufferTail; /* Pointers into above buffer */
! 59: unsigned char InputBuffer[SIZE_KEYBOARDINPUT_BUFFER]; /* Buffer for data send from CPU to keyboard processor (commands) */
! 60: int nBytesInInputBuffer; /* Number of command bytes in above buffer */
1.1 root 61:
1.1.1.2 ! root 62: int bLButtonDown,bRButtonDown; /* Mouse states in emulation system, BUTTON_xxxx */
1.1 root 63: int bOldLButtonDown,bOldRButtonDown;
64: int LButtonDblClk,RButtonDblClk;
65: int LButtonHistory,RButtonHistory;
66: } KEYBOARD;
67:
1.1.1.2 ! root 68: /* Button states, a bit mask so can mimick joystick/right mouse button duplication */
! 69: #define BUTTON_NULL 0x00 /* Button states, so can OR together mouse/joystick buttons */
! 70: #define BUTTON_MOUSE 0x01
! 71: #define BUTTON_JOYSTICK 0x02
1.1 root 72:
1.1.1.2 ! root 73: /* Mouse/Joystick modes */
! 74: #define AUTOMODE_OFF 0
1.1 root 75: #define AUTOMODE_MOUSEREL 1
76: #define AUTOMODE_MOUSEABS 2
1.1.1.2 ! root 77: #define AUTOMODE_MOUSECURSOR 3
1.1 root 78: #define AUTOMODE_JOYSTICK 4
79:
1.1.1.2 ! root 80: /* 0xfffc00 (read status from ACIA) */
1.1 root 81: #define ACIA_STATUS_REGISTER__RX_BUFFER_FULL 0x01
82: #define ACIA_STATUS_REGISTER__TX_BUFFER_EMPTY 0x02
83: #define ACIA_STATUS_REGISTER__OVERRUN_ERROR 0x40
84: #define ACIA_STATUS_REGISTER__INTERRUPT_REQUEST 0x80
85:
86: extern unsigned char ACIAControlRegister;
87: extern unsigned char ACIAStatusRegister;
88: extern unsigned char ACIAByte;
89:
90: extern KEYBOARD_PROCESSOR KeyboardProcessor;
91: extern KEYBOARD Keyboard;
92:
93: extern void IKBD_Reset(BOOL bCold);
94: extern void IKBD_MemorySnapShot_Capture(BOOL bSave);
95: extern void IKBD_SendAutoKeyboardCommands();
96: extern void IKBD_InterruptHandler_ResetTimer(void);
97:
98: extern void IKBD_Cmd_NullFunction(void);
99: extern void IKBD_Cmd_Reset(void);
100: extern void IKBD_Cmd_MouseAction(void);
101: extern void IKBD_Cmd_RelMouseMode(void);
102: extern void IKBD_Cmd_AbsMouseMode(void);
103: extern void IKBD_Cmd_MouseCursorKeycodes(void);
104: extern void IKBD_Cmd_SetMouseThreshold(void);
105: extern void IKBD_Cmd_SetMouseScale(void);
106: extern void IKBD_Cmd_ReadAbsMousePos(void);
107: extern void IKBD_Cmd_SetInternalMousePos(void);
108: extern void IKBD_Cmd_SetYAxisDown(void);
109: extern void IKBD_Cmd_SetYAxisUp(void);
110: extern void IKBD_Cmd_StartKeyboardTransfer(void);
111: extern void IKBD_Cmd_TurnMouseOff(void);
112: extern void IKBD_Cmd_StopKeyboardTransfer(void);
113: extern void IKBD_Cmd_ReturnJoystickAuto(void);
114: extern void IKBD_Cmd_StopJoystick(void);
115: extern void IKBD_Cmd_ReturnJoystick(void);
116: extern void IKBD_Cmd_SetJoystickDuration(void);
117: extern void IKBD_Cmd_SetJoystickFireDuration(void);
118: extern void IKBD_Cmd_SetCursorForJoystick(void);
119: extern void IKBD_Cmd_DisableJoysticks(void);
120: extern void IKBD_Cmd_SetClock(void);
121: extern void IKBD_Cmd_ReadClock(void);
122: extern void IKBD_Cmd_LoadMemory(void);
123: extern void IKBD_Cmd_ReadMemory(void);
124: extern void IKBD_Cmd_Execute(void);
125:
126: extern void IKBD_SendByteToKeyboardProcessor(unsigned short bl);
127: extern unsigned short IKBD_GetByteFromACIA(void);
128: extern void IKBD_InterruptHandler_ACIA(void);
129: extern void IKBD_SendByteToACIA(void);
130: extern void IKBD_AddKeyToKeyboardBuffer(unsigned char Data);
131: extern void IKBD_PressSTKey(unsigned char ScanCode,BOOL bPress);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.