Vastly overhauled the UI, there's now a completely new Settings dialog as well as a status bar with disk activity icons and removable drive menus;
Thoroughly clean up the code to vastly reduce the number of compiler warnings and found and fixed several bugs in the process; Applied all mainline PCem commits; Added SCSI hard disk emulation; Commented out all unfinished machines and graphics cards; Added the AOpen AP53 and ASUS P/I-P55T2 machines as well as another Tyan 440FX machine, all three with AMI WinBIOS (patch from TheCollector1995); Added the Diamond Stealth 3D 3000 (S3 ViRGE/VX) graphics card (patch from TheCollector1995); Added the PS/2 XT IDE (AccuLogic) HDD Controller (patch from TheCollector1995); Added Microsoft/Logitech Bus Mouse emulation (patch from waltje); Overhauled the makefiles (patch from waltje); Added the Adaptec AHA-1542CF SCSI controller (patch from waltje); Added preliminary (but still unfinished) Adaptec AHA-154x SCSI controller BIOS support (patch from waltje); Added an ISABugger debugging device (patch from waltje); Added sanity checks to the Direct3D code.
This commit is contained in:
@@ -1,98 +1,117 @@
|
||||
#include <stdlib.h>
|
||||
#include "ibm.h"
|
||||
#include "mouse.h"
|
||||
#include "pic.h"
|
||||
#include "serial.h"
|
||||
#include "timer.h"
|
||||
|
||||
typedef struct mouse_serial_t
|
||||
{
|
||||
int mousepos, mousedelay;
|
||||
int oldb;
|
||||
SERIAL *serial;
|
||||
|
||||
typedef struct mouse_serial_t {
|
||||
int pos,
|
||||
delay;
|
||||
int oldb;
|
||||
SERIAL *serial;
|
||||
} mouse_serial_t;
|
||||
|
||||
void mouse_serial_poll(int x, int y, int z, int b, void *p)
|
||||
|
||||
static void
|
||||
sermouse_rcr(SERIAL *serial, void *priv)
|
||||
{
|
||||
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;
|
||||
if (y<-128) y=-128;
|
||||
|
||||
/*Use Microsoft format*/
|
||||
mousedat[0]=0x40;
|
||||
mousedat[0]|=(((y>>6)&3)<<2);
|
||||
mousedat[0]|=((x>>6)&3);
|
||||
if (b&1) mousedat[0]|=0x20;
|
||||
if (b&2) mousedat[0]|=0x10;
|
||||
mousedat[1]=x&0x3F;
|
||||
mousedat[2]=y&0x3F;
|
||||
mouse_serial_t *ms = (mouse_serial_t *)priv;
|
||||
|
||||
if (!(serial->mctrl & 0x10))
|
||||
{
|
||||
// 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]);
|
||||
}
|
||||
ms->pos = -1;
|
||||
ms->delay = 5000 * (1 << TIMER_SHIFT);
|
||||
}
|
||||
|
||||
void mouse_serial_rcr(SERIAL *serial, void *p)
|
||||
{
|
||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
||||
|
||||
mouse->mousepos = -1;
|
||||
mouse->mousedelay = 5000 * (1 << TIMER_SHIFT);
|
||||
}
|
||||
|
||||
void mousecallback(void *p)
|
||||
{
|
||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
||||
|
||||
mouse->mousedelay = 0;
|
||||
if (mouse->mousepos == -1)
|
||||
{
|
||||
mouse->mousepos = 0;
|
||||
serial_write_fifo(mouse->serial, 'M');
|
||||
}
|
||||
static void
|
||||
sermouse_timer(void *priv)
|
||||
{
|
||||
mouse_serial_t *ms = (mouse_serial_t *)priv;
|
||||
|
||||
ms->delay = 0;
|
||||
if (ms->pos == -1) {
|
||||
ms->pos = 0;
|
||||
serial_write_fifo(ms->serial, 'M');
|
||||
}
|
||||
}
|
||||
|
||||
void *mouse_serial_init()
|
||||
{
|
||||
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;
|
||||
serial1.rcr_callback_p = mouse;
|
||||
timer_add(mousecallback, &mouse->mousedelay, &mouse->mousedelay, mouse);
|
||||
|
||||
return mouse;
|
||||
static uint8_t
|
||||
sermouse_poll(int x, int y, int z, int b, void *priv)
|
||||
{
|
||||
mouse_serial_t *ms = (mouse_serial_t *)priv;
|
||||
SERIAL *sp = ms->serial;
|
||||
uint8_t mousedat[3];
|
||||
|
||||
if (!(sp->ier & 1)) return(1);
|
||||
|
||||
if (!x && !y && b == ms->oldb) return(1);
|
||||
|
||||
ms->oldb = b;
|
||||
if (x>127) x = 127;
|
||||
if (y>127) y = 127;
|
||||
if (x<-128) x = -128;
|
||||
if (y<-128) y = -128;
|
||||
|
||||
/* Use Microsoft format. */
|
||||
mousedat[0] = 0x40;
|
||||
mousedat[0] |= (((y>>6)&3)<<2);
|
||||
mousedat[0] |= ((x>>6)&3);
|
||||
if (b&1) mousedat[0] |= 0x20;
|
||||
if (b&2) mousedat[0] |= 0x10;
|
||||
mousedat[1] = x & 0x3F;
|
||||
mousedat[2] = y & 0x3F;
|
||||
|
||||
/* FIXME: we should check in serial_write_fifo, not here! --FvK */
|
||||
if (! (sp->mctrl & 0x10)) {
|
||||
#if 0
|
||||
pclog("Serial data %02X %02X %02X\n",
|
||||
mousedat[0], mousedat[1], mousedat[2]);
|
||||
#endif
|
||||
serial_write_fifo(ms->serial, mousedat[0]);
|
||||
serial_write_fifo(ms->serial, mousedat[1]);
|
||||
serial_write_fifo(ms->serial, mousedat[2]);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void mouse_serial_close(void *p)
|
||||
|
||||
static void *
|
||||
sermouse_init(void)
|
||||
{
|
||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
||||
|
||||
free(mouse);
|
||||
|
||||
serial1.rcr_callback = NULL;
|
||||
mouse_serial_t *ms = (mouse_serial_t *)malloc(sizeof(mouse_serial_t));
|
||||
memset(ms, 0x00, sizeof(mouse_serial_t));
|
||||
|
||||
/* Attach a serial port to the mouse. */
|
||||
ms->serial = &serial1;
|
||||
serial1.rcr_callback = sermouse_rcr;
|
||||
serial1.rcr_callback_p = ms;
|
||||
|
||||
timer_add(sermouse_timer, &ms->delay, &ms->delay, ms);
|
||||
|
||||
return(ms);
|
||||
}
|
||||
|
||||
mouse_t mouse_serial_microsoft =
|
||||
|
||||
static void
|
||||
sermouse_close(void *priv)
|
||||
{
|
||||
"Microsoft 2-button mouse (serial)",
|
||||
mouse_serial_init,
|
||||
mouse_serial_close,
|
||||
mouse_serial_poll,
|
||||
MOUSE_TYPE_SERIAL
|
||||
mouse_serial_t *ms = (mouse_serial_t *)priv;
|
||||
|
||||
/* Detach serial port from the mouse. */
|
||||
serial1.rcr_callback = NULL;
|
||||
|
||||
free(ms);
|
||||
}
|
||||
|
||||
|
||||
mouse_t mouse_serial_microsoft = {
|
||||
"Microsoft 2-button mouse (serial)",
|
||||
"msserial",
|
||||
MOUSE_TYPE_SERIAL,
|
||||
sermouse_init,
|
||||
sermouse_close,
|
||||
sermouse_poll
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user