Applied all mainline PCem commits;
Added experimental NVidia Riva TNT2 emulation (patch from MoochMcGee); ASUS P/I-P54TP4XE, ASUS P/I-P55T2P4, and ASUS P/I-P55TVP4 are back; National Semiconductor PC87306 Super I/O chip now correctly reenables devices after a chip power cycle; Several FDC improvements and the behavior is now a bit closer to real hardware (based on actual tests); Added MR Intel Advanced/ATX with Microid Research BIOS with support for 4 floppy drives and up to 4 IDE controllers; Added floppy drives 3 and 4, bringing the maximum to 4; You can now connect hard disks to the tertiary IDE controller; Correct undocumented behavior of the LEA instruction with register is back on 286 and later CPU's; Pentium-rea models with Intel chipsets now have port 92 (with alternate reset and alternate A20 toggle); Overhauled DMA channel read and write routines and fixed cascading; Improved IMG detection of a bad BPB (or complete lack of a BPB); Added preliminary emulation of PS/2 1.44 MB and PC-98 1.25 MB 3-mode drives (both have an inverted DENSEL pin); Removed the incorrect Amstrad mouse patch from TheCollector1995; Fixed ATAPI CD-ROM disk change detection; Windows IOCTL CD-ROM handler now tries to use direct SCSI passthrough for more things, including obtaining CD-ROM capacity; The Diamond Stealth32 (ET4000/W32p) now also works correctly on the two Award SiS 496/497 boxes; The (S)VGA handler now converts 6-bit RAMDAC RGB channels to standard 8-bit RGB using a lookup table generated at emulator start, calculated using the correct intensity conversion method and treating intensity 64 as equivalent to 63; Moved a few options from the Configuration dialog box to the menu; SIO, PIIX, and PIIX3 now have the reset control register on port CF9 as they should; Several bugfixes.
This commit is contained in:
@@ -1,23 +1,28 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include "ibm.h"
|
||||
#include "mouse.h"
|
||||
#include "pic.h"
|
||||
#include "serial.h"
|
||||
#include "timer.h"
|
||||
|
||||
static int oldb=0;
|
||||
|
||||
void mouse_serial_poll(int x, int y, int b)
|
||||
typedef struct mouse_serial_t
|
||||
{
|
||||
uint8_t mousedat[3];
|
||||
|
||||
if (!(serial1.ier & 1))
|
||||
return;
|
||||
if (!x && !y && b==oldb) return;
|
||||
int mousepos, mousedelay;
|
||||
int oldb;
|
||||
SERIAL *serial;
|
||||
} mouse_serial_t;
|
||||
|
||||
oldb=b;
|
||||
void mouse_serial_poll(int x, int y, int z, int b, void *p)
|
||||
{
|
||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
||||
SERIAL *serial = mouse->serial;
|
||||
uint8_t mousedat[3];
|
||||
|
||||
if (!(serial->ier & 1))
|
||||
return;
|
||||
if (!x && !y && b == mouse->oldb)
|
||||
return;
|
||||
|
||||
mouse->oldb = b;
|
||||
if (x>127) x=127;
|
||||
if (y>127) y=127;
|
||||
if (x<-128) x=-128;
|
||||
@@ -32,44 +37,62 @@ void mouse_serial_poll(int x, int y, int b)
|
||||
mousedat[1]=x&0x3F;
|
||||
mousedat[2]=y&0x3F;
|
||||
|
||||
if (!(serial1.mctrl&0x10))
|
||||
if (!(serial->mctrl & 0x10))
|
||||
{
|
||||
// pclog("Serial data %02X %02X %02X\n", mousedat[0], mousedat[1], mousedat[2]);
|
||||
serial_write_fifo(&serial1, mousedat[0]);
|
||||
serial_write_fifo(&serial1, mousedat[1]);
|
||||
serial_write_fifo(&serial1, mousedat[2]);
|
||||
// pclog("Serial data %02X %02X %02X\n", mousedat[0], mousedat[1], mousedat[2]);
|
||||
serial_write_fifo(mouse->serial, mousedat[0]);
|
||||
serial_write_fifo(mouse->serial, mousedat[1]);
|
||||
serial_write_fifo(mouse->serial, mousedat[2]);
|
||||
}
|
||||
}
|
||||
|
||||
void mouse_serial_rcr(void *p)
|
||||
void mouse_serial_rcr(SERIAL *serial, void *p)
|
||||
{
|
||||
mousepos=-1;
|
||||
mousedelay=5000 * (1 << TIMER_SHIFT);
|
||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
||||
|
||||
mouse->mousepos = -1;
|
||||
mouse->mousedelay = 5000 * (1 << TIMER_SHIFT);
|
||||
}
|
||||
|
||||
void mousecallback(void *p)
|
||||
{
|
||||
SERIAL *serial = (SERIAL *)p;
|
||||
mousedelay = 0;
|
||||
if (mousepos == -1)
|
||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
||||
|
||||
mouse->mousedelay = 0;
|
||||
if (mouse->mousepos == -1)
|
||||
{
|
||||
mousepos = 0;
|
||||
/* serial_fifo_read = serial_fifo_write = 0;
|
||||
serial.lsr &= ~1;*/
|
||||
serial_write_fifo(serial, 'M');
|
||||
mouse->mousepos = 0;
|
||||
serial_write_fifo(mouse->serial, 'M');
|
||||
}
|
||||
/* else if (serial_fifo_read != serial_fifo_write)
|
||||
{
|
||||
serial.iir=4;
|
||||
serial.lsr|=1;
|
||||
if (serial.mctrl&8) picint(0x10);
|
||||
}*/
|
||||
}
|
||||
|
||||
void mouse_serial_init()
|
||||
void *mouse_serial_init()
|
||||
{
|
||||
mouse_poll = mouse_serial_poll;
|
||||
mouse_serial_t *mouse = (mouse_t *)malloc(sizeof(mouse_serial_t));
|
||||
memset(mouse, 0, sizeof(mouse_serial_t));
|
||||
|
||||
mouse->serial = &serial1;
|
||||
serial1.rcr_callback = mouse_serial_rcr;
|
||||
timer_add(mousecallback, &mousedelay, &mousedelay, &serial1);
|
||||
serial1.rcr_callback_p = mouse;
|
||||
timer_add(mousecallback, &mouse->mousedelay, &mouse->mousedelay, mouse);
|
||||
|
||||
return mouse;
|
||||
}
|
||||
|
||||
void mouse_serial_close(void *p)
|
||||
{
|
||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
||||
|
||||
free(mouse);
|
||||
|
||||
serial1.rcr_callback = NULL;
|
||||
}
|
||||
|
||||
mouse_t mouse_serial_microsoft =
|
||||
{
|
||||
"Microsoft 2-button mouse (serial)",
|
||||
mouse_serial_init,
|
||||
mouse_serial_close,
|
||||
mouse_serial_poll,
|
||||
MOUSE_TYPE_SERIAL
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user