Files
86Box/src/amstrad.c
OBattler dc46480aa4 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.
2016-12-23 03:16:24 +01:00

113 lines
2.9 KiB
C

#include "ibm.h"
#include "io.h"
#include "keyboard.h"
#include "lpt.h"
#include "mouse.h"
#include "amstrad.h"
static uint8_t amstrad_dead;
uint8_t amstrad_read(uint16_t port, void *priv)
{
pclog("amstrad_read : %04X\n",port);
switch (port)
{
case 0x379:
return 7 | readdacfifo();
case 0x37a:
if (romset == ROM_PC1512) return 0x20;
if (romset == ROM_PC200) return 0x80;
return 0;
case 0xdead:
return amstrad_dead;
}
return 0xff;
}
void amstrad_write(uint16_t port, uint8_t val, void *priv)
{
switch (port)
{
case 0xdead:
amstrad_dead = val;
break;
}
}
static uint8_t mousex, mousey;
static void amstrad_mouse_write(uint16_t addr, uint8_t val, void *p)
{
// pclog("Write mouse %04X %02X %04X:%04X\n", addr, val, CS, pc);
if (addr == 0x78)
mousex = 0;
else
mousey = 0;
}
static uint8_t amstrad_mouse_read(uint16_t addr, void *p)
{
// printf("Read mouse %04X %04X:%04X %02X\n", addr, CS, pc, (addr == 0x78) ? mousex : mousey);
if (addr == 0x78)
return mousex;
return mousey;
}
typedef struct mouse_amstrad_t
{
int oldb;
} mouse_amstrad_t;
static void mouse_amstrad_poll(int x, int y, int z, int b, void *p)
{
mouse_amstrad_t *mouse = (mouse_amstrad_t *)p;
mousex += x;
mousey -= y;
if ((b & 1) && !(mouse->oldb & 1))
keyboard_send(0x7e);
if ((b & 2) && !(mouse->oldb & 2))
keyboard_send(0x7d);
if (!(b & 1) && (mouse->oldb & 1))
keyboard_send(0xfe);
if (!(b & 2) && (mouse->oldb & 2))
keyboard_send(0xfd);
mouse->oldb = b;
}
static void *mouse_amstrad_init()
{
mouse_amstrad_t *mouse = (mouse_amstrad_t *)malloc(sizeof(mouse_amstrad_t));
memset(mouse, 0, sizeof(mouse_amstrad_t));
return mouse;
}
static void mouse_amstrad_close(void *p)
{
mouse_amstrad_t *mouse = (mouse_amstrad_t *)p;
free(mouse);
}
mouse_t mouse_amstrad =
{
"Amstrad mouse",
mouse_amstrad_init,
mouse_amstrad_close,
mouse_amstrad_poll,
MOUSE_TYPE_AMSTRAD
};
void amstrad_init()
{
lpt2_remove_ams();
io_sethandler(0x0078, 0x0001, amstrad_mouse_read, NULL, NULL, amstrad_mouse_write, NULL, NULL, NULL);
io_sethandler(0x007a, 0x0001, amstrad_mouse_read, NULL, NULL, amstrad_mouse_write, NULL, NULL, NULL);
io_sethandler(0x0379, 0x0002, amstrad_read, NULL, NULL, NULL, NULL, NULL, NULL);
io_sethandler(0xdead, 0x0001, amstrad_read, NULL, NULL, amstrad_write, NULL, NULL, NULL);
}