Files
86Box/src/um8669f.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

139 lines
4.2 KiB
C

/* Copyright holders: Sarah Walker
see COPYING for more details
*/
/*um8669f :
aa to 108 unlocks
next 108 write is register select (Cx?)
data read/write to 109
55 to 108 locks
C0
bit 3 = LPT1 enable
bit 2 = COM2 enable
bit 1 = COM1 enable
bit 0 = FDC enable
C1
bits 7-6 = LPT1 mode : 11 = ECP/EPP, 01 = EPP, 10 = SPP
bit 3 = clear when LPT1 = 278
C3
bits 7-6 = LPT1 DMA mode : 11 = ECP/EPP DMA1, 10 = ECP/EPP DMA3, 01 = EPP/SPP, 00 = ECP
bits 5-4 = LPT1 addr : 10 = 278/IRQ5, 01 = 3BC/IRQ7, 00 = 378/IRQ7
COM1 :
3f8, IRQ4 - C1 = BF, C3 = 00
2f8, IRQ3 - C1 = BF, C3 = 03
3e8, IRQ4 - C1 = BD, C3 = 00
2e8, IRQ3 - B1 = BD, C3 = 03
COM2 :
3f8, IRQ4 - C1 = BF, C3 = 0C
2f8, IRQ3 - C1 = BF, C3 = 00
3e8, IRQ4 - C1 = BB, C3 = 0C
2e8, IRQ3 - C1 = BB, C3 = 00
*/
#include "ibm.h"
#include "disc.h"
#include "fdc.h"
#include "io.h"
#include "lpt.h"
#include "serial.h"
#include "um8669f.h"
static int um8669f_locked;
static int um8669f_curreg;
static uint8_t um8669f_regs[256];
void um8669f_write(uint16_t port, uint8_t val, void *priv)
{
int temp;
// pclog("um8669f_write : port=%04x reg %02X = %02X locked=%i\n", port, um8669f_curreg, val, um8669f_locked);
if (um8669f_locked)
{
if (port == 0x108 && val == 0xaa)
um8669f_locked = 0;
}
else
{
if (port == 0x108)
{
if (val == 0x55)
um8669f_locked = 1;
else
um8669f_curreg = val;
}
else
{
um8669f_regs[um8669f_curreg] = val;
fdc_remove();
if (um8669f_regs[0xc0] & 1)
fdc_add();
if (um8669f_regs[0xc0] & 2)
{
temp = um8669f_regs[0xc3] & 1; /*might be & 2*/
if (!(um8669f_regs[0xc1] & 2))
temp |= 2;
switch (temp)
{
case 0: serial1_set(0x3f8, 4); break;
case 1: serial1_set(0x2f8, 4); break;
case 2: serial1_set(0x3e8, 4); break;
case 3: serial1_set(0x2e8, 4); break;
}
}
if (um8669f_regs[0xc0] & 4)
{
temp = (um8669f_regs[0xc3] & 4) ? 0 : 1; /*might be & 8*/
if (!(um8669f_regs[0xc1] & 4))
temp |= 2;
switch (temp)
{
case 0: serial2_set(0x3f8, 3); break;
case 1: serial2_set(0x2f8, 3); break;
case 2: serial2_set(0x3e8, 3); break;
case 3: serial2_set(0x2e8, 3); break;
}
}
lpt1_remove();
lpt2_remove();
temp = (um8669f_regs[0xc3] >> 4) & 3;
switch (temp)
{
case 0: lpt1_init(0x378); break;
case 1: lpt1_init(0x3bc); break;
case 2: lpt1_init(0x278); break;
}
}
}
}
uint8_t um8669f_read(uint16_t port, void *priv)
{
// pclog("um8669f_read : port=%04x reg %02X locked=%i\n", port, um8669f_curreg, um8669f_locked);
if (um8669f_locked)
return 0xff;
if (port == 0x108)
return um8669f_curreg; /*???*/
else
return um8669f_regs[um8669f_curreg];
}
void um8669f_init()
{
io_sethandler(0x0108, 0x0002, um8669f_read, NULL, NULL, um8669f_write, NULL, NULL, NULL);
um8669f_locked = 1;
}