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