Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port; Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX); Finished the 586MC1; Added 8087 emulation; Moved Cyrix 6x86'es to the Dev branch; Sanitized/cleaned up memregs.c/h and intel.c/h; Split the chipsets from machines and sanitized Port 92 emulation; Added support for the 15bpp mode to the Compaq ATI 28800; Moved the MR 386DX and 486 machines to the Dev branch; Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00; Ported the new timer code from PCem; Cleaned up the CPU table of unused stuff and better optimized its structure; Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch; Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem; Added the AHA-1540A and the BusTek BT-542B; Moved the Sumo SCSI-AT to the Dev branch; Minor IDE, FDC, and floppy drive code clean-ups; Made NCR 5380/53C400-based cards' BIOS address configurable; Got rid of the legacy romset variable; Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit; Added the Amstead PPC512 per PCem patch by John Elliott; Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages); Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing; Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem; Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit; Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement; Amstrad MegaPC does now works correctly with non-internal graphics card; The SLiRP code no longer casts a packed struct type to a non-packed struct type; The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present; The S3 Virge on BeOS is no longer broken (was broken by build #1591); OS/2 2.0 build 6.167 now sees key presses again; Xi8088 now work on CGA again; 86F images converted from either the old or new variants of the HxC MFM format now work correctly; Hardware interrupts with a vector of 0xFF are now handled correctly; OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct; Fixed VNC keyboard input bugs; Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver; Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly; Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4; Compaq Portable now works with all graphics cards; Fixed various MDSI Genius bugs; Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly; Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355; OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400. Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391. Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389. Fixed a minor IDE timing bug, fixes #388. Fixed Toshiba T1000 RAM issues, fixes #379. Fixed EGA/(S)VGA overscan border handling, fixes #378; Got rid of the now long useless IDE channel 2 auto-removal, fixes #370; Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366; Ported the Unicode CD image file name fix from VARCem, fixes #365; Fixed high density floppy disks on the Xi8088, fixes #359; Fixed some bugs in the Hercules emulation, fixes #346, fixes #358; Fixed the SCSI hard disk mode sense pages, fixes #356; Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349; Fixed bugs in the serial mouse emulation, fixes #344; Compiled 86Box binaries now include all the required .DLL's, fixes #341; Made some combo boxes in the Settings dialog slightly wider, fixes #276.
This commit is contained in:
132
src/mouse_bus.c
132
src/mouse_bus.c
@@ -18,6 +18,7 @@
|
||||
* of the real hardware, testing of drivers, and the old code.
|
||||
*
|
||||
* Logitech Bus Mouse verified with:
|
||||
* Linux Slackware 3.0
|
||||
* Logitech LMouse.com 3.12
|
||||
* Logitech LMouse.com 3.30
|
||||
* Logitech LMouse.com 3.41
|
||||
@@ -44,12 +45,15 @@
|
||||
* Microsoft Mouse.com 8.21J
|
||||
* Microsoft Windows 1.00 DR5
|
||||
* Microsoft Windows 3.10.026
|
||||
* Microsoft Windows 3.10.068 both MOUSE.DRV and LMOUSE.DRV
|
||||
* Microsoft Windows NT 3.1
|
||||
* Microsoft Windows 95
|
||||
*
|
||||
* InPort verified with:
|
||||
* Linux Slackware 3.0
|
||||
* Logitech LMouse.com 6.12
|
||||
* Logitech LMouse.com 6.41
|
||||
* Microsoft Windows 3.10.068 both MOUSE.DRV and LMOUSE.DRV
|
||||
* Microsoft Windows NT 3.1
|
||||
* Microsoft Windows 98 SE
|
||||
*
|
||||
@@ -124,23 +128,24 @@
|
||||
#define FLAG_TIMER_INT (1 << 3)
|
||||
#define FLAG_DATA_INT (1 << 4)
|
||||
|
||||
static const double periods[4] = { 30.0, 50.0, 100.0, 200.0 };
|
||||
static const uint8_t periods[4] = { 30, 50, 100, 200 };
|
||||
|
||||
|
||||
/* Our mouse device. */
|
||||
typedef struct mouse {
|
||||
uint8_t current_b, control_val,
|
||||
config_val, sig_val,
|
||||
command_val, pad;
|
||||
|
||||
int8_t current_x, current_y;
|
||||
|
||||
int base, irq, bn, flags,
|
||||
mouse_delayed_dx, mouse_delayed_dy,
|
||||
mouse_buttons,
|
||||
current_x, current_y,
|
||||
current_b,
|
||||
control_val, mouse_buttons_last,
|
||||
config_val, sig_val,
|
||||
command_val, toggle_counter;
|
||||
mouse_buttons, mouse_buttons_last,
|
||||
toggle_counter, timer_enabled;
|
||||
|
||||
double period;
|
||||
|
||||
int64_t timer_enabled, timer; /* mouse event timer */
|
||||
pc_timer_t timer; /* mouse event timer */
|
||||
} mouse_t;
|
||||
|
||||
|
||||
@@ -178,15 +183,19 @@ lt_read(uint16_t port, void *priv)
|
||||
switch (dev->control_val & 0x60) {
|
||||
case READ_X_LOW:
|
||||
value = dev->current_x & 0x0F;
|
||||
dev->current_x &= ~0x0F;
|
||||
break;
|
||||
case READ_X_HIGH:
|
||||
value = (dev->current_x >> 4) & 0x0F;
|
||||
dev->current_x &= ~0xF0;
|
||||
break;
|
||||
case READ_Y_LOW:
|
||||
value = dev->current_y & 0x0F;
|
||||
dev->current_y &= ~0x0F;
|
||||
break;
|
||||
case READ_Y_HIGH:
|
||||
value = (dev->current_y >> 4) & 0x0F;
|
||||
dev->current_y &= ~0xF0;
|
||||
break;
|
||||
default:
|
||||
bm_log("ERROR: Reading data port in unsupported mode 0x%02x\n", dev->control_val);
|
||||
@@ -232,13 +241,15 @@ ms_read(uint16_t port, void *priv)
|
||||
case INP_PORT_DATA:
|
||||
switch (dev->command_val) {
|
||||
case INP_CTRL_READ_BUTTONS:
|
||||
value = dev->current_b | 0x80;
|
||||
value = dev->current_b;
|
||||
break;
|
||||
case INP_CTRL_READ_X:
|
||||
value = dev->current_x;
|
||||
dev->current_x = 0;
|
||||
break;
|
||||
case INP_CTRL_READ_Y:
|
||||
value = dev->current_y;
|
||||
dev->current_y = 0;
|
||||
break;
|
||||
case INP_CTRL_COMMAND:
|
||||
value = dev->control_val;
|
||||
@@ -335,7 +346,10 @@ lt_write(uint16_t port, uint8_t val, void *priv)
|
||||
if (val & DEVICE_ACTIVE) {
|
||||
/* Mode set/reset - enable this */
|
||||
dev->config_val = val;
|
||||
dev->flags |= (FLAG_ENABLED | FLAG_TIMER_INT);
|
||||
if (dev->timer_enabled)
|
||||
dev->flags |= (FLAG_ENABLED | FLAG_TIMER_INT);
|
||||
else
|
||||
dev->flags |= FLAG_ENABLED;
|
||||
dev->control_val = 0x0F & ~IRQ_MASK;
|
||||
} else {
|
||||
/* Single bit set/reset */
|
||||
@@ -398,17 +412,19 @@ ms_write(uint16_t port, uint8_t val, void *priv)
|
||||
switch(val & INP_PERIOD_MASK) {
|
||||
case 0:
|
||||
dev->period = 0.0;
|
||||
dev->timer = 0LL;
|
||||
dev->timer_enabled = 0LL;
|
||||
timer_disable(&dev->timer);
|
||||
dev->timer_enabled = 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
dev->period = 1000000.0 / periods[(val & INP_PERIOD_MASK) - 1];
|
||||
dev->timer = ((int64_t) dev->period) * TIMER_USEC;
|
||||
dev->timer_enabled = (val & INP_ENABLE_TIMER_IRQ) ? 1LL : 0LL;
|
||||
dev->period = (1000000.0 / (double)periods[(val & INP_PERIOD_MASK) - 1]);
|
||||
dev->timer_enabled = (val & INP_ENABLE_TIMER_IRQ) ? 1 : 0;
|
||||
timer_disable(&dev->timer);
|
||||
if (dev->timer_enabled)
|
||||
timer_set_delay_u64(&dev->timer, (uint64_t) (dev->period * (double)TIMER_USEC));
|
||||
bm_log("DEBUG: Timer is now %sabled at period %i\n", (val & INP_ENABLE_TIMER_IRQ) ? "en" : "dis", (int32_t) dev->period);
|
||||
break;
|
||||
|
||||
@@ -510,34 +526,35 @@ bm_update_data(mouse_t *dev)
|
||||
int delta_x, delta_y;
|
||||
int xor;
|
||||
|
||||
/* Update the deltas and the delays. */
|
||||
if (dev->mouse_delayed_dx > 127) {
|
||||
delta_x = 127;
|
||||
dev->mouse_delayed_dx -= 127;
|
||||
} else if (dev->mouse_delayed_dx < -128) {
|
||||
delta_x = -128;
|
||||
dev->mouse_delayed_dx += 128;
|
||||
} else {
|
||||
delta_x = dev->mouse_delayed_dx;
|
||||
dev->mouse_delayed_dx = 0;
|
||||
}
|
||||
|
||||
if (dev->mouse_delayed_dy > 127) {
|
||||
delta_y = 127;
|
||||
dev->mouse_delayed_dy -= 127;
|
||||
} else if (dev->mouse_delayed_dy < -128) {
|
||||
delta_y = -128;
|
||||
dev->mouse_delayed_dy += 128;
|
||||
} else {
|
||||
delta_y = dev->mouse_delayed_dy;
|
||||
dev->mouse_delayed_dy = 0;
|
||||
}
|
||||
|
||||
/* If the counters are not frozen, update them. */
|
||||
if (!(dev->flags & FLAG_HOLD)) {
|
||||
dev->current_x = (uint8_t) delta_x;
|
||||
dev->current_y = (uint8_t) delta_y;
|
||||
}
|
||||
/* Update the deltas and the delays. */
|
||||
if (dev->mouse_delayed_dx > 127) {
|
||||
delta_x = 127;
|
||||
dev->mouse_delayed_dx -= 127;
|
||||
} else if (dev->mouse_delayed_dx < -128) {
|
||||
delta_x = -128;
|
||||
dev->mouse_delayed_dx += 128;
|
||||
} else {
|
||||
delta_x = dev->mouse_delayed_dx;
|
||||
dev->mouse_delayed_dx = 0;
|
||||
}
|
||||
|
||||
if (dev->mouse_delayed_dy > 127) {
|
||||
delta_y = 127;
|
||||
dev->mouse_delayed_dy -= 127;
|
||||
} else if (dev->mouse_delayed_dy < -128) {
|
||||
delta_y = -128;
|
||||
dev->mouse_delayed_dy += 128;
|
||||
} else {
|
||||
delta_y = dev->mouse_delayed_dy;
|
||||
dev->mouse_delayed_dy = 0;
|
||||
}
|
||||
|
||||
dev->current_x = (int8_t) delta_x;
|
||||
dev->current_y = (int8_t) delta_y;
|
||||
} else
|
||||
delta_x = delta_y = 0;
|
||||
|
||||
if (dev->flags & FLAG_INPORT) {
|
||||
/* This is an InPort mouse in timer mode, so update current_b always,
|
||||
@@ -564,7 +581,7 @@ bm_timer(void *priv)
|
||||
|
||||
/* The period is configured either via emulator settings (for MS/Logitech Bus mouse)
|
||||
or via software (for InPort mouse). */
|
||||
dev->timer += ((int64_t) dev->period) * TIMER_USEC;
|
||||
timer_advance_u64(&dev->timer, (uint64_t) (dev->period * (double)TIMER_USEC));
|
||||
|
||||
if (dev->flags & FLAG_TIMER_INT) {
|
||||
picint(1 << dev->irq);
|
||||
@@ -591,6 +608,7 @@ static void *
|
||||
bm_init(const device_t *info)
|
||||
{
|
||||
mouse_t *dev;
|
||||
int hz;
|
||||
|
||||
dev = (mouse_t *)malloc(sizeof(mouse_t));
|
||||
memset(dev, 0x00, sizeof(mouse_t));
|
||||
@@ -611,37 +629,44 @@ bm_init(const device_t *info)
|
||||
dev->mouse_buttons_last = 0;
|
||||
dev->sig_val = 0; /* the signature port value */
|
||||
dev->current_x =
|
||||
dev->current_y =
|
||||
dev->current_y = 0;
|
||||
dev->current_b = 0;
|
||||
dev->command_val = 0; /* command byte */
|
||||
dev->toggle_counter = 0; /* signature byte / IRQ bit toggle */
|
||||
dev->period = 0.0;
|
||||
|
||||
timer_add(&dev->timer, bm_timer, dev, 0);
|
||||
|
||||
if (dev->flags & FLAG_INPORT) {
|
||||
dev->control_val = 0; /* the control port value */
|
||||
dev->flags |= FLAG_ENABLED;
|
||||
dev->period = 0.0;
|
||||
|
||||
io_sethandler(dev->base, 4,
|
||||
ms_read, NULL, NULL, ms_write, NULL, NULL, dev);
|
||||
|
||||
dev->timer = 0LL;
|
||||
dev->timer_enabled = 0LL;
|
||||
dev->timer_enabled = 0;
|
||||
} else {
|
||||
dev->control_val = 0x0f; /* the control port value */
|
||||
dev->config_val = 0x9b; /* the config port value - 0x9b is the
|
||||
default state of the 8255: all ports
|
||||
are set to input */
|
||||
dev->period = 1000000.0 / ((double) device_get_config_int("hz"));
|
||||
|
||||
hz = device_get_config_int("hz");
|
||||
if (hz > 0)
|
||||
dev->period = (1000000.0 / (double)hz);
|
||||
|
||||
io_sethandler(dev->base, 4,
|
||||
lt_read, NULL, NULL, lt_write, NULL, NULL, dev);
|
||||
|
||||
dev->timer = ((int64_t) dev->period) * TIMER_USEC;
|
||||
dev->timer_enabled = 1LL;
|
||||
if (hz > 0) {
|
||||
timer_set_delay_u64(&dev->timer, (uint64_t) (dev->period * (double)TIMER_USEC));
|
||||
dev->timer_enabled = 1;
|
||||
} else {
|
||||
dev->flags |= FLAG_DATA_INT;
|
||||
dev->timer_enabled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
timer_add(bm_timer, &dev->timer, &dev->timer_enabled, dev);
|
||||
|
||||
if (dev->flags & FLAG_INPORT)
|
||||
bm_log("MS Inport BusMouse initialized\n");
|
||||
else
|
||||
@@ -693,6 +718,9 @@ static const device_config_t lt_config[] = {
|
||||
},
|
||||
{
|
||||
"hz", "Hz", CONFIG_SELECTION, "", 45, {
|
||||
{
|
||||
"Non-timed (original)", 0
|
||||
},
|
||||
{
|
||||
"30 Hz (JMP2 = 1)", 30
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user