Fixed the Schneider EuroPC on-board Logitech-compatible Bus Mouse.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* 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.
|
||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
* running old operating systems and software designed for IBM
|
||||
* PC systems and compatibles from 1981 through fairly recent
|
||||
* system designs based on the PCI bus.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
* This file is part of the 86Box distribution.
|
||||
*
|
||||
* Implementation of the Schneider EuroPC system.
|
||||
*
|
||||
@@ -68,7 +68,7 @@
|
||||
*
|
||||
* WARNING THIS IS A WORK-IN-PROGRESS MODULE. USE AT OWN RISK.
|
||||
*
|
||||
* Version: @(#)europc.c 1.0.10 2019/02/11
|
||||
* Version: @(#)europc.c 1.0.11 2019/09/27
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
@@ -77,37 +77,7 @@
|
||||
* Schneider's schematics and technical manuals, and the
|
||||
* input from people with real EuroPC hardware.
|
||||
*
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
@@ -165,6 +135,8 @@ typedef struct {
|
||||
nvr_t nvr; /* NVR */
|
||||
uint8_t nvr_stat;
|
||||
uint8_t nvr_addr;
|
||||
|
||||
void * mouse;
|
||||
} europc_t;
|
||||
|
||||
|
||||
@@ -638,12 +610,13 @@ europc_boot(const device_t *info)
|
||||
|
||||
/* Set up game port. */
|
||||
b = (sys->nvr.regs[MRTC_CONF_C] & 0xfc);
|
||||
if (mouse_type == MOUSE_TYPE_LOGIBUS) {
|
||||
b |= 0x01; /* enable port as MOUSE */
|
||||
} else if (joystick_type != 7) {
|
||||
if (mouse_type == MOUSE_TYPE_INTERNAL) {
|
||||
sys->mouse = device_add(&mouse_logibus_onboard_device);
|
||||
mouse_bus_set_irq(priv, 2);
|
||||
/* Configure the port for (Bus Mouse Compatible) Mouse. */
|
||||
b |= 0x01;
|
||||
} else if (joystick_type != 7)
|
||||
b |= 0x02; /* enable port as joysticks */
|
||||
device_add(&gameport_device);
|
||||
}
|
||||
sys->nvr.regs[MRTC_CONF_C] = b;
|
||||
|
||||
#if 0
|
||||
|
12
src/mouse.h
12
src/mouse.h
@@ -8,13 +8,13 @@
|
||||
*
|
||||
* Definitions for the mouse driver.
|
||||
*
|
||||
* Version: @(#)mouse.h 1.0.14 2018/11/04
|
||||
* Version: @(#)mouse.h 1.0.15 2019/09/27
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
* Copyright 2017,2018 Fred N. van Kempen.
|
||||
* Copyright 2016-2019 Miran Grca.
|
||||
* Copyright 2017-2019 Fred N. van Kempen.
|
||||
*/
|
||||
#ifndef EMU_MOUSE_H
|
||||
# define EMU_MOUSE_H
|
||||
@@ -35,6 +35,8 @@
|
||||
#define MOUSE_TYPE_LT3BUTTON 10 /* Logitech 3-button Serial Mouse */
|
||||
#define MOUSE_TYPE_PS2 11 /* PS/2 series Bus Mouse */
|
||||
|
||||
#define MOUSE_TYPE_ONBOARD 0x80 /* Mouse is an on-board version of one of the above. */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -50,6 +52,7 @@ extern const device_t *mouse_get_device(int mouse);
|
||||
extern void *mouse_ps2_init(const device_t *);
|
||||
|
||||
extern const device_t mouse_logibus_device;
|
||||
extern const device_t mouse_logibus_onboard_device;
|
||||
extern const device_t mouse_msinport_device;
|
||||
#if 0
|
||||
extern const device_t mouse_genibus_device;
|
||||
@@ -68,6 +71,9 @@ extern void mouse_process(void);
|
||||
extern void mouse_set_poll(int (*f)(int,int,int,int,void *), void *);
|
||||
extern void mouse_poll(void);
|
||||
|
||||
extern void mouse_bus_set_irq(void *priv, int irq);
|
||||
|
||||
|
||||
extern char *mouse_get_name(int mouse);
|
||||
extern char *mouse_get_internal_name(int mouse);
|
||||
extern int mouse_get_from_internal_name(char *s);
|
||||
|
@@ -57,14 +57,14 @@
|
||||
* Microsoft Windows NT 3.1
|
||||
* Microsoft Windows 98 SE
|
||||
*
|
||||
* Version: @(#)mouse_bus.c 1.0.3 2018/10/17
|
||||
* Version: @(#)mouse_bus.c 1.0.4 2019/09/27
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
* Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 200?-2018 Bochs.
|
||||
* Copyright 2017,2018 Miran Grca.
|
||||
* Copyright 1989-2018 Fred N. van Kempen.
|
||||
* Copyright 200?-2019 Bochs.
|
||||
* Copyright 2017-2019 Miran Grca.
|
||||
* Copyright 1989-2019 Fred N. van Kempen.
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
@@ -305,7 +305,8 @@ lt_write(uint16_t port, uint8_t val, void *priv)
|
||||
else
|
||||
dev->flags &= ~FLAG_HOLD;
|
||||
|
||||
picintc(1 << dev->irq);
|
||||
if (dev->irq != -1)
|
||||
picintc(1 << dev->irq);
|
||||
|
||||
break;
|
||||
case BUSM_PORT_CONFIG:
|
||||
@@ -391,7 +392,8 @@ ms_write(uint16_t port, uint8_t val, void *priv)
|
||||
}
|
||||
break;
|
||||
case INP_PORT_DATA:
|
||||
picintc(1 << dev->irq);
|
||||
if (dev->irq != -1)
|
||||
picintc(1 << dev->irq);
|
||||
switch(dev->command_val) {
|
||||
case INP_CTRL_COMMAND:
|
||||
if (val & INP_HOLD_COUNTER)
|
||||
@@ -429,7 +431,7 @@ ms_write(uint16_t port, uint8_t val, void *priv)
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (val & INP_ENABLE_TIMER_IRQ)
|
||||
if ((val & INP_ENABLE_TIMER_IRQ) && (dev->irq != -1))
|
||||
picint(1 << dev->irq);
|
||||
dev->control_val &= INP_PERIOD_MASK;
|
||||
dev->control_val |= (val & ~INP_PERIOD_MASK);
|
||||
@@ -509,7 +511,7 @@ bm_poll(int x, int y, int z, int b, void *priv)
|
||||
}
|
||||
|
||||
/* Send interrupt. */
|
||||
if (dev->flags & FLAG_DATA_INT) {
|
||||
if ((dev->flags & FLAG_DATA_INT) && (dev->irq != -1)) {
|
||||
picint(1 << dev->irq);
|
||||
bm_log("DEBUG: Data Interrupt Fired...\n");
|
||||
}
|
||||
@@ -583,7 +585,7 @@ bm_timer(void *priv)
|
||||
or via software (for InPort mouse). */
|
||||
timer_advance_u64(&dev->timer, (uint64_t) (dev->period * (double)TIMER_USEC));
|
||||
|
||||
if (dev->flags & FLAG_TIMER_INT) {
|
||||
if ((dev->flags & FLAG_TIMER_INT) && (dev->irq != -1)) {
|
||||
picint(1 << dev->irq);
|
||||
bm_log("DEBUG: Timer Interrupt Fired...\n");
|
||||
}
|
||||
@@ -603,6 +605,16 @@ bm_close(void *priv)
|
||||
}
|
||||
|
||||
|
||||
/* Set the mouse's IRQ. */
|
||||
void
|
||||
mouse_bus_set_irq(void *priv, int irq)
|
||||
{
|
||||
mouse_t *dev = (mouse_t *)priv;
|
||||
|
||||
dev->irq = irq;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the device for use by the user. */
|
||||
static void *
|
||||
bm_init(const device_t *info)
|
||||
@@ -613,14 +625,20 @@ bm_init(const device_t *info)
|
||||
dev = (mouse_t *)malloc(sizeof(mouse_t));
|
||||
memset(dev, 0x00, sizeof(mouse_t));
|
||||
|
||||
if (info->local == MOUSE_TYPE_INPORT)
|
||||
if ((info->local & ~MOUSE_TYPE_ONBOARD) == MOUSE_TYPE_INPORT)
|
||||
dev->flags = FLAG_INPORT;
|
||||
else
|
||||
dev->flags = 0;
|
||||
|
||||
dev->base = device_get_config_hex16("base");
|
||||
dev->irq = device_get_config_int("irq");
|
||||
dev->bn = device_get_config_int("buttons");
|
||||
if (info->local & MOUSE_TYPE_ONBOARD) {
|
||||
dev->base = 0x023c;
|
||||
dev->irq = -1;
|
||||
dev->bn = 2;
|
||||
} else {
|
||||
dev->base = device_get_config_hex16("base");
|
||||
dev->irq = device_get_config_int("irq");
|
||||
dev->bn = device_get_config_int("buttons");
|
||||
}
|
||||
mouse_set_buttons(dev->bn);
|
||||
|
||||
dev->mouse_delayed_dx = 0;
|
||||
@@ -822,6 +840,14 @@ const device_t mouse_logibus_device = {
|
||||
lt_config
|
||||
};
|
||||
|
||||
const device_t mouse_logibus_onboard_device = {
|
||||
"Logitech Bus Mouse (On-Board)",
|
||||
DEVICE_ISA,
|
||||
MOUSE_TYPE_LOGIBUS | MOUSE_TYPE_ONBOARD,
|
||||
bm_init, bm_close, NULL,
|
||||
bm_poll, NULL, NULL
|
||||
};
|
||||
|
||||
const device_t mouse_msinport_device = {
|
||||
"Microsoft Bus Mouse (InPort)",
|
||||
DEVICE_ISA,
|
||||
|
Reference in New Issue
Block a user