This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
VARCem/src/devices/input/keyboard.h

148 lines
4.6 KiB
C
Raw Normal View History

2018-02-20 21:44:51 -05:00
/*
2018-03-08 15:58:46 -05:00
* VARCem Virtual ARchaeological Computer EMulator.
2018-02-20 21:44:51 -05:00
* An emulator of (mostly) x86-based PC systems and devices,
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
* spanning the era between 1981 and 1995.
*
* This file is part of the VARCem Project.
*
* Definitions for the keyboard interface.
*
* Version: @(#)keyboard.h 1.0.14 2019/04/27
2018-02-20 21:44:51 -05:00
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
* Sarah Walker, <tommowalker@tommowalker.co.uk>
*
* Copyright 2017-2019 Fred N. van Kempen.
* Copyright 2016-2019 Miran Grca.
2018-02-20 21:44:51 -05:00
* Copyright 2008-2018 Sarah Walker.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the:
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307
* USA.
*/
#ifndef EMU_KEYBOARD_H
# define EMU_KEYBOARD_H
2018-10-06 18:20:09 -04:00
/* Keyboard State bits. */
#define KBD_FLAG_CAPS 0x01 /* CAPS LOCK currently on */
#define KBD_FLAG_NUM 0x02 /* NUM LOCK currently on */
#define KBD_FLAG_SCROLL 0x04 /* SCROLL LOCK currently on */
#define KBD_FLAG_PAUSE 0x10 /* PAUSE currently on */
2018-02-20 21:44:51 -05:00
#define STATE_SHIFT_MASK 0x22
#define STATE_RSHIFT 0x20
#define STATE_LSHIFT 0x02
#define FAKE_LSHIFT_ON 0x100
#define FAKE_LSHIFT_OFF 0x101
#define LSHIFT_ON 0x102
#define LSHIFT_OFF 0x103
#define RSHIFT_ON 0x104
#define RSHIFT_OFF 0x105
#ifdef __cplusplus
extern "C" {
#endif
2018-10-06 18:20:09 -04:00
typedef struct {
uint8_t mk[4];
uint8_t brk[4];
} scancode_t;
2018-02-20 21:44:51 -05:00
2018-10-06 18:20:09 -04:00
extern uint8_t keyboard_mode;
extern int keyboard_scan;
extern int64_t keyboard_delay;
2018-02-20 21:44:51 -05:00
2018-10-06 18:20:09 -04:00
extern uint8_t keyboard_set3_flags[512];
extern uint8_t keyboard_set3_all_repeat;
extern uint8_t keyboard_set3_all_break;
extern int mouse_queue_start, mouse_queue_end;
extern int mouse_scan;
extern const scancode_t scancode_xt[512];
2018-02-20 21:44:51 -05:00
#ifdef EMU_DEVICE_H
2018-10-06 18:20:09 -04:00
extern const device_t keyboard_pc_device;
extern const device_t keyboard_pc82_device;
extern const device_t keyboard_xt_device;
extern const device_t keyboard_xt86_device;
extern const device_t keyboard_generic_device;
extern const device_t keyboard_tandy_device;
extern const device_t keyboard_laserxt3_device;
extern const device_t keyboard_at_device;
extern const device_t keyboard_at_ami_device;
extern const device_t keyboard_at_toshiba_device;
extern const device_t keyboard_ps2_device;
extern const device_t keyboard_ps2_pci_device;
extern const device_t keyboard_ps2_ps1_device;
extern const device_t keyboard_ps2_ps2_device;
extern const device_t keyboard_ps2_acer_device;
extern const device_t keyboard_ps2_ami_device;
extern const device_t keyboard_ps2_ami_pci_device;
extern const device_t keyboard_ps2_mca_device;
extern const device_t keyboard_ps2_mca_2_device;
extern const device_t keyboard_ps2_quadtel_device;
extern const device_t keyboard_ps2_xi8088_device;
2018-02-20 21:44:51 -05:00
#endif
2018-10-06 18:20:09 -04:00
extern void (*keyboard_send)(uint16_t val);
extern void keyboard_adddata(uint16_t val, void (*adddata)(uint16_t val));
extern void keyboard_poll_host(void);
2018-10-06 18:20:09 -04:00
extern void kbd_log(int level, const char *fmt, ...);
extern void keyboard_reset(void);
2018-02-20 21:44:51 -05:00
extern void keyboard_close(void);
extern void keyboard_set_table(const scancode_t *ptr);
2018-02-20 21:44:51 -05:00
extern void keyboard_input(int down, uint16_t scan);
extern int keyboard_recv(uint16_t key);
2018-02-20 21:44:51 -05:00
extern uint8_t keyboard_get_shift(void);
2018-10-06 18:20:09 -04:00
extern uint8_t keyboard_get_state(void);
extern void keyboard_cad(void);
extern void keyboard_cae(void);
extern void keyboard_cab(void);
2018-02-20 21:44:51 -05:00
extern int keyboard_isfsexit(void);
extern int keyboard_ismsexit(void);
extern void keyboard_xt_set_funcs(void *arg,
uint8_t (*func)(void *), void *priv);
extern void keyboard_at_set_funcs(void *arg,
uint8_t (*rfunc)(void *),
void (*wfunc)(void *, uint8_t),
void *priv);
2018-02-20 21:44:51 -05:00
extern void keyboard_at_adddata_keyboard_raw(uint8_t val);
extern void keyboard_at_adddata_mouse(uint8_t val);
extern void keyboard_at_set_mouse(void (*mouse_write)(uint8_t val,void *), void *);
extern uint8_t keyboard_at_get_mouse_scan(void);
extern void keyboard_at_set_mouse_scan(uint8_t val);
#ifdef __cplusplus
}
#endif
#endif /*EMU_KEYBOARD_H*/