2018-04-25 23:51:13 +02:00
|
|
|
/*
|
2022-11-13 16:37:58 -05:00
|
|
|
* 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.
|
2018-04-25 23:51:13 +02:00
|
|
|
*
|
2022-11-13 16:37:58 -05:00
|
|
|
* This file is part of the 86Box distribution.
|
2018-04-25 23:51:13 +02:00
|
|
|
*
|
2022-11-13 16:37:58 -05:00
|
|
|
* Implementation of the SiS 85c496/85c497 chip.
|
2018-04-25 23:51:13 +02:00
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2018-04-25 23:51:13 +02:00
|
|
|
*
|
2022-11-13 16:37:58 -05:00
|
|
|
* Authors: Miran Grca, <mgrca8@gmail.com>
|
2018-04-25 23:51:13 +02:00
|
|
|
*
|
2022-11-13 16:37:58 -05:00
|
|
|
* Copyright 2019-2020 Miran Grca.
|
2018-04-25 23:51:13 +02:00
|
|
|
*/
|
2023-08-24 16:59:57 +02:00
|
|
|
#define USE_DRB_HACK
|
2020-06-29 01:10:20 +02:00
|
|
|
#include <stdarg.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdint.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <stdlib.h>
|
2018-04-25 23:51:13 +02:00
|
|
|
#include <string.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <wchar.h>
|
2020-06-29 01:10:20 +02:00
|
|
|
#define HAVE_STDARG_H
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
2020-02-29 19:12:23 +01:00
|
|
|
#include "cpu.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/mem.h>
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
#include <86box/smram.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/io.h>
|
|
|
|
|
#include <86box/pci.h>
|
|
|
|
|
#include <86box/device.h>
|
|
|
|
|
#include <86box/timer.h>
|
2020-06-29 01:10:20 +02:00
|
|
|
#include <86box/dma.h>
|
|
|
|
|
#include <86box/nvr.h>
|
|
|
|
|
#include <86box/pic.h>
|
2023-06-26 12:47:04 -04:00
|
|
|
#include <86box/plat_unused.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/port_92.h>
|
|
|
|
|
#include <86box/hdc_ide.h>
|
|
|
|
|
#include <86box/machine.h>
|
|
|
|
|
#include <86box/chipset.h>
|
2020-06-29 01:10:20 +02:00
|
|
|
#include <86box/spd.h>
|
2023-07-12 00:32:21 +02:00
|
|
|
#ifndef USE_DRB_HACK
|
|
|
|
|
#include <86box/row.h>
|
2023-07-12 00:37:51 +02:00
|
|
|
#endif
|
2017-09-02 20:39:57 +02:00
|
|
|
|
2022-09-18 17:12:38 -04:00
|
|
|
typedef struct sis_85c496_t {
|
2023-06-26 22:31:03 -04:00
|
|
|
uint8_t cur_reg;
|
|
|
|
|
uint8_t rmsmiblk_count;
|
2023-08-07 03:04:52 +02:00
|
|
|
uint8_t pci_slot;
|
|
|
|
|
uint8_t pad;
|
2023-07-12 00:32:21 +02:00
|
|
|
#ifndef USE_DRB_HACK
|
|
|
|
|
uint8_t drb_default;
|
|
|
|
|
uint8_t drb_bits;
|
2023-08-07 03:04:52 +02:00
|
|
|
uint8_t pad0;
|
|
|
|
|
uint8_t pad1;
|
2023-07-12 00:32:21 +02:00
|
|
|
#endif
|
2023-06-26 22:31:03 -04:00
|
|
|
uint8_t regs[127];
|
|
|
|
|
uint8_t pci_conf[256];
|
2022-09-18 17:12:38 -04:00
|
|
|
smram_t *smram;
|
|
|
|
|
pc_timer_t rmsmiblk_timer;
|
|
|
|
|
port_92_t *port_92;
|
|
|
|
|
nvr_t *nvr;
|
2017-09-02 20:39:57 +02:00
|
|
|
} sis_85c496_t;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
#ifdef ENABLE_SIS_85C496_LOG
|
|
|
|
|
int sis_85c496_do_log = ENABLE_SIS_85C496_LOG;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
sis_85c496_log(const char *fmt, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
if (sis_85c496_do_log) {
|
2022-09-18 17:12:38 -04:00
|
|
|
va_start(ap, fmt);
|
|
|
|
|
pclog_ex(fmt, ap);
|
|
|
|
|
va_end(ap);
|
2020-06-29 01:10:20 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#else
|
2022-09-18 17:12:38 -04:00
|
|
|
# define sis_85c496_log(fmt, ...)
|
2020-06-29 01:10:20 +02:00
|
|
|
#endif
|
|
|
|
|
|
2018-11-08 19:21:55 +01:00
|
|
|
static void
|
2020-06-29 01:10:20 +02:00
|
|
|
sis_85c497_isa_write(uint16_t port, uint8_t val, void *priv)
|
2018-11-08 19:21:55 +01:00
|
|
|
{
|
|
|
|
|
sis_85c496_t *dev = (sis_85c496_t *) priv;
|
|
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
sis_85c496_log("[%04X:%08X] ISA Write %02X to %04X\n", CS, cpu_state.pc, val, port);
|
|
|
|
|
|
|
|
|
|
if (port == 0x22)
|
2022-09-18 17:12:38 -04:00
|
|
|
dev->cur_reg = val;
|
|
|
|
|
else if (port == 0x23)
|
|
|
|
|
switch (dev->cur_reg) {
|
|
|
|
|
case 0x01: /* Built-in 206 Timing Control */
|
|
|
|
|
dev->regs[dev->cur_reg] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x70: /* ISA Bus Clock Selection */
|
|
|
|
|
dev->regs[dev->cur_reg] = val & 0xc0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x71: /* ISA Bus Timing Control */
|
|
|
|
|
dev->regs[dev->cur_reg] = val & 0xf6;
|
|
|
|
|
break;
|
|
|
|
|
case 0x72:
|
|
|
|
|
case 0x76: /* SMOUT */
|
|
|
|
|
case 0x74: /* BIOS Timer */
|
|
|
|
|
dev->regs[dev->cur_reg] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x73: /* BIOS Timer */
|
|
|
|
|
dev->regs[dev->cur_reg] = val & 0xfd;
|
|
|
|
|
break;
|
|
|
|
|
case 0x75: /* DMA / Deturbo Control */
|
|
|
|
|
dev->regs[dev->cur_reg] = val & 0xfc;
|
|
|
|
|
dma_set_mask((val & 0x80) ? 0xffffffff : 0x00ffffff);
|
|
|
|
|
break;
|
2023-06-26 12:47:04 -04:00
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:12:38 -04:00
|
|
|
}
|
2018-11-08 19:21:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static uint8_t
|
2020-06-29 01:10:20 +02:00
|
|
|
sis_85c497_isa_read(uint16_t port, void *priv)
|
2018-11-08 19:21:55 +01:00
|
|
|
{
|
2023-07-20 18:58:26 -04:00
|
|
|
const sis_85c496_t *dev = (sis_85c496_t *) priv;
|
|
|
|
|
uint8_t ret = 0xff;
|
2018-11-08 19:21:55 +01:00
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
if (port == 0x23)
|
2022-09-18 17:12:38 -04:00
|
|
|
ret = dev->regs[dev->cur_reg];
|
2020-06-29 01:10:20 +02:00
|
|
|
else if (port == 0x33)
|
2022-09-18 17:12:38 -04:00
|
|
|
ret = 0x3c /*random_generate()*/;
|
2020-06-29 01:10:20 +02:00
|
|
|
|
|
|
|
|
sis_85c496_log("[%04X:%08X] ISA Read %02X from %04X\n", CS, cpu_state.pc, ret, port);
|
2018-11-08 19:21:55 +01:00
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
|
|
|
|
sis_85c496_recalcmapping(sis_85c496_t *dev)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
uint32_t base;
|
2023-05-11 03:02:36 -04:00
|
|
|
uint32_t shflags = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2022-09-18 17:12:38 -04:00
|
|
|
shadowbios = 0;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
shadowbios_write = 0;
|
|
|
|
|
|
2023-05-11 03:02:36 -04:00
|
|
|
for (uint8_t i = 0; i < 8; i++) {
|
2022-09-18 17:12:38 -04:00
|
|
|
base = 0xc0000 + (i << 15);
|
|
|
|
|
|
|
|
|
|
if (dev->pci_conf[0x44] & (1 << i)) {
|
|
|
|
|
shadowbios |= (base >= 0xe0000) && (dev->pci_conf[0x45] & 0x02);
|
|
|
|
|
shadowbios_write |= (base >= 0xe0000) && !(dev->pci_conf[0x45] & 0x01);
|
|
|
|
|
shflags = (dev->pci_conf[0x45] & 0x02) ? MEM_READ_INTERNAL : MEM_READ_EXTANY;
|
|
|
|
|
shflags |= (dev->pci_conf[0x45] & 0x01) ? MEM_WRITE_EXTANY : MEM_WRITE_INTERNAL;
|
|
|
|
|
mem_set_mem_state_both(base, 0x8000, shflags);
|
|
|
|
|
} else
|
|
|
|
|
mem_set_mem_state_both(base, 0x8000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
2020-06-29 01:10:20 +02:00
|
|
|
}
|
2021-12-26 22:46:31 +01:00
|
|
|
|
|
|
|
|
flushmmucache_nopc();
|
2020-06-29 01:10:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sis_85c496_ide_handler(sis_85c496_t *dev)
|
|
|
|
|
{
|
|
|
|
|
uint8_t ide_cfg[2];
|
|
|
|
|
|
|
|
|
|
ide_cfg[0] = dev->pci_conf[0x58];
|
|
|
|
|
ide_cfg[1] = dev->pci_conf[0x59];
|
|
|
|
|
|
|
|
|
|
ide_pri_disable();
|
|
|
|
|
ide_sec_disable();
|
|
|
|
|
|
|
|
|
|
if (ide_cfg[1] & 0x02) {
|
2022-09-18 17:12:38 -04:00
|
|
|
ide_set_base(0, 0x0170);
|
|
|
|
|
ide_set_side(0, 0x0376);
|
|
|
|
|
ide_set_base(1, 0x01f0);
|
|
|
|
|
ide_set_side(1, 0x03f6);
|
|
|
|
|
|
|
|
|
|
if (ide_cfg[1] & 0x01) {
|
|
|
|
|
if (!(ide_cfg[0] & 0x40))
|
|
|
|
|
ide_pri_enable();
|
|
|
|
|
if (!(ide_cfg[0] & 0x80))
|
|
|
|
|
ide_sec_enable();
|
|
|
|
|
}
|
2020-06-29 01:10:20 +02:00
|
|
|
} else {
|
2022-09-18 17:12:38 -04:00
|
|
|
ide_set_base(0, 0x01f0);
|
|
|
|
|
ide_set_side(0, 0x03f6);
|
|
|
|
|
ide_set_base(1, 0x0170);
|
|
|
|
|
ide_set_side(1, 0x0376);
|
|
|
|
|
|
|
|
|
|
if (ide_cfg[1] & 0x01) {
|
|
|
|
|
if (!(ide_cfg[0] & 0x40))
|
|
|
|
|
ide_sec_enable();
|
|
|
|
|
if (!(ide_cfg[0] & 0x80))
|
|
|
|
|
ide_pri_enable();
|
|
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2020-06-29 01:10:20 +02:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2023-07-12 00:32:21 +02:00
|
|
|
#ifndef USE_DRB_HACK
|
|
|
|
|
static void
|
|
|
|
|
sis_85c496_drb_recalc(sis_85c496_t *dev)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
2023-07-12 00:37:51 +02:00
|
|
|
uint32_t boundary;
|
2023-07-12 00:32:21 +02:00
|
|
|
|
|
|
|
|
for (i = 7; i >= 0; i--)
|
|
|
|
|
row_disable(i);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i <= 7; i++) {
|
|
|
|
|
boundary = ((uint32_t) dev->pci_conf[0x48 + i]);
|
|
|
|
|
row_set_boundary(i, boundary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flushmmucache();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
/* 00 - 3F = PCI Configuration, 40 - 7F = 85C496, 80 - FF = 85C497 */
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2023-06-26 12:47:04 -04:00
|
|
|
sis_85c49x_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-11-08 19:21:55 +01:00
|
|
|
sis_85c496_t *dev = (sis_85c496_t *) priv;
|
2023-05-11 03:02:36 -04:00
|
|
|
uint8_t old;
|
|
|
|
|
uint8_t valxor;
|
2022-09-18 17:12:38 -04:00
|
|
|
uint8_t smm_irq[4] = { 10, 11, 12, 15 };
|
2023-05-11 03:02:36 -04:00
|
|
|
uint32_t host_base;
|
|
|
|
|
uint32_t ram_base;
|
|
|
|
|
uint32_t size;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2022-09-18 17:12:38 -04:00
|
|
|
old = dev->pci_conf[addr];
|
2020-06-29 01:10:20 +02:00
|
|
|
valxor = (dev->pci_conf[addr]) ^ val;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
sis_85c496_log("[%04X:%08X] PCI Write %02X to %02X:%02X\n", CS, cpu_state.pc, val, func, addr);
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
switch (addr) {
|
2022-09-18 17:12:38 -04:00
|
|
|
/* PCI Configuration Header Registers (00h ~ 3Fh) */
|
|
|
|
|
case 0x04: /* PCI Device Command */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x40;
|
|
|
|
|
break;
|
|
|
|
|
case 0x05: /* PCI Device Command */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x03;
|
|
|
|
|
break;
|
|
|
|
|
case 0x07: /* Device Status */
|
|
|
|
|
dev->pci_conf[addr] &= ~(val & 0xf1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* 86C496 Specific Registers (40h ~ 7Fh) */
|
|
|
|
|
case 0x40: /* CPU Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x7f;
|
|
|
|
|
break;
|
|
|
|
|
case 0x41: /* DRAM Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x42: /* Cache Configure */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
cpu_cache_ext_enabled = (val & 0x01);
|
|
|
|
|
cpu_update_waitstates();
|
|
|
|
|
break;
|
|
|
|
|
case 0x43: /* Cache Configure */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x8f;
|
|
|
|
|
break;
|
|
|
|
|
case 0x44: /* Shadow Configure */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
if (valxor & 0xff) {
|
|
|
|
|
sis_85c496_recalcmapping(dev);
|
|
|
|
|
if (((old & 0xf0) == 0xf0) && ((val & 0xf0) == 0x30))
|
|
|
|
|
flushmmucache_nopc();
|
|
|
|
|
else if (((old & 0xf0) == 0xf0) && ((val & 0xf0) == 0x00))
|
|
|
|
|
flushmmucache_nopc();
|
|
|
|
|
else
|
|
|
|
|
flushmmucache();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x45: /* Shadow Configure */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x0f;
|
|
|
|
|
if (valxor & 0x03)
|
|
|
|
|
sis_85c496_recalcmapping(dev);
|
|
|
|
|
break;
|
|
|
|
|
case 0x46: /* Cacheable Control */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x47: /* 85C496 Address Decoder */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x1f;
|
|
|
|
|
break;
|
|
|
|
|
case 0x48:
|
|
|
|
|
case 0x49:
|
|
|
|
|
case 0x4a:
|
|
|
|
|
case 0x4b: /* DRAM Boundary */
|
|
|
|
|
case 0x4c:
|
|
|
|
|
case 0x4d:
|
|
|
|
|
case 0x4e:
|
|
|
|
|
case 0x4f:
|
2023-07-12 00:32:21 +02:00
|
|
|
#ifdef USE_DRB_HACK
|
|
|
|
|
spd_write_drbs(dev->pci_conf, 0x48, 0x4f, 1);
|
|
|
|
|
#else
|
2023-06-26 12:47:04 -04:00
|
|
|
dev->pci_conf[addr] = val;
|
2023-07-12 00:32:21 +02:00
|
|
|
sis_85c496_drb_recalc(dev);
|
2023-06-26 12:47:04 -04:00
|
|
|
#endif
|
2022-09-18 17:12:38 -04:00
|
|
|
break;
|
|
|
|
|
case 0x50:
|
|
|
|
|
case 0x51: /* Exclusive Area 0 Setup */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x52:
|
|
|
|
|
case 0x53: /* Exclusive Area 1 Setup */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x54: /* Exclusive Area 2 Setup */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x55: /* Exclusive Area 3 Setup */
|
|
|
|
|
dev->pci_conf[addr] = val & 0xf0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x56: /* PCI / Keyboard Configure */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
if (valxor & 0x02) {
|
|
|
|
|
port_92_remove(dev->port_92);
|
|
|
|
|
if (val & 0x02)
|
|
|
|
|
port_92_add(dev->port_92);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x57: /* Output Pin Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x58: /* Build-in IDE Controller / VESA Bus Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val & 0xd7;
|
|
|
|
|
if (valxor & 0xc0)
|
|
|
|
|
sis_85c496_ide_handler(dev);
|
|
|
|
|
break;
|
|
|
|
|
case 0x59: /* Build-in IDE Controller / VESA Bus Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
if (valxor & 0x03)
|
|
|
|
|
sis_85c496_ide_handler(dev);
|
|
|
|
|
break;
|
|
|
|
|
case 0x5a: /* SMRAM Remapping Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val & 0xbe;
|
|
|
|
|
if (valxor & 0x3e) {
|
|
|
|
|
unmask_a20_in_smm = !!(val & 0x20);
|
|
|
|
|
|
|
|
|
|
smram_disable_all();
|
|
|
|
|
|
|
|
|
|
if (val & 0x02) {
|
|
|
|
|
host_base = 0x00060000;
|
|
|
|
|
ram_base = 0x000a0000;
|
|
|
|
|
size = 0x00010000;
|
|
|
|
|
switch ((val >> 3) & 0x03) {
|
|
|
|
|
case 0x00:
|
|
|
|
|
host_base = 0x00060000;
|
|
|
|
|
ram_base = 0x000a0000;
|
|
|
|
|
break;
|
|
|
|
|
case 0x01:
|
|
|
|
|
host_base = 0x00060000;
|
|
|
|
|
ram_base = 0x000b0000;
|
|
|
|
|
break;
|
|
|
|
|
case 0x02:
|
|
|
|
|
host_base = 0x000e0000;
|
|
|
|
|
ram_base = 0x000a0000;
|
|
|
|
|
break;
|
|
|
|
|
case 0x03:
|
|
|
|
|
host_base = 0x000e0000;
|
|
|
|
|
ram_base = 0x000b0000;
|
|
|
|
|
break;
|
2023-06-26 12:47:04 -04:00
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:12:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
smram_enable(dev->smram, host_base, ram_base, size,
|
|
|
|
|
((val & 0x06) == 0x06), (val & 0x02));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x5b: /* Programmable I/O Traps Configure */
|
|
|
|
|
case 0x5c:
|
|
|
|
|
case 0x5d: /* Programmable I/O Trap 0 Base */
|
|
|
|
|
case 0x5e:
|
|
|
|
|
case 0x5f: /* Programmable I/O Trap 0 Base */
|
|
|
|
|
case 0x60:
|
|
|
|
|
case 0x61: /* IDE Controller Channel 0 Configuration */
|
|
|
|
|
case 0x62:
|
|
|
|
|
case 0x63: /* IDE Controller Channel 1 Configuration */
|
|
|
|
|
case 0x64:
|
|
|
|
|
case 0x65: /* Exclusive Area 3 Setup */
|
|
|
|
|
case 0x66: /* EDO DRAM Configuration */
|
|
|
|
|
case 0x68:
|
|
|
|
|
case 0x69: /* Asymmetry DRAM Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x67: /* Miscellaneous Control */
|
|
|
|
|
dev->pci_conf[addr] = val & 0xf9;
|
|
|
|
|
if (valxor & 0x60)
|
|
|
|
|
port_92_set_features(dev->port_92, !!(val & 0x20), !!(val & 0x40));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* 86C497 Specific Registers (80h ~ FFh) */
|
|
|
|
|
case 0x80: /* PMU Configuration */
|
|
|
|
|
case 0x85: /* STPCLK# Event Control */
|
|
|
|
|
case 0x86:
|
|
|
|
|
case 0x87: /* STPCLK# Deassertion IRQ Selection */
|
|
|
|
|
case 0x89: /* Fast Timer Count */
|
|
|
|
|
case 0x8a: /* Generic Timer Count */
|
|
|
|
|
case 0x8b: /* Slow Timer Count */
|
|
|
|
|
case 0x8e: /* Clock Throttling On Timer Count */
|
|
|
|
|
case 0x8f: /* Clock Throttling Off Timer Count */
|
|
|
|
|
case 0x90: /* Clock Throttling On Timer Reload Condition */
|
|
|
|
|
case 0x92: /* Fast Timer Reload Condition */
|
|
|
|
|
case 0x94: /* Generic Timer Reload Condition */
|
|
|
|
|
case 0x96: /* Slow Timer Reload Condition */
|
|
|
|
|
case 0x98:
|
|
|
|
|
case 0x99: /* Fast Timer Reload IRQ Selection */
|
|
|
|
|
case 0x9a:
|
|
|
|
|
case 0x9b: /* Generic Timer Reload IRQ Selection */
|
|
|
|
|
case 0x9c:
|
|
|
|
|
case 0x9d: /* Slow Timer Reload IRQ Selection */
|
|
|
|
|
case 0xa2: /* SMI Request Status Selection */
|
|
|
|
|
case 0xa4:
|
|
|
|
|
case 0xa5: /* SMI Request IRQ Selection */
|
|
|
|
|
case 0xa6:
|
|
|
|
|
case 0xa7: /* Clock Throttlign On Timer Reload IRQ Selection */
|
|
|
|
|
case 0xa8: /* GPIO Control */
|
|
|
|
|
case 0xaa: /* GPIO DeBounce Count */
|
|
|
|
|
case 0xd2: /* Exclusive Area 2 Base Address */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0x81: /* PMU CPU Type Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x9f;
|
|
|
|
|
break;
|
|
|
|
|
case 0x88: /* Timer Control */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x3f;
|
|
|
|
|
break;
|
|
|
|
|
case 0x8d: /* RMSMIBLK Timer Count */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
dev->rmsmiblk_count = val;
|
|
|
|
|
timer_stop(&dev->rmsmiblk_timer);
|
|
|
|
|
if (val >= 0x02)
|
|
|
|
|
timer_on_auto(&dev->rmsmiblk_timer, 35.0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x91: /* Clock Throttling On Timer Reload Condition */
|
|
|
|
|
case 0x93: /* Fast Timer Reload Condition */
|
|
|
|
|
case 0x95: /* Generic Timer Reload Condition */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x03;
|
|
|
|
|
break;
|
|
|
|
|
case 0x97: /* Slow Timer Reload Condition */
|
|
|
|
|
dev->pci_conf[addr] = val & 0xc3;
|
|
|
|
|
break;
|
|
|
|
|
case 0x9e: /* Soft-SMI Generation / RMSMIBLK Trigger */
|
|
|
|
|
if (!smi_block && (val & 0x01) && (dev->pci_conf[0x80] & 0x80) && (dev->pci_conf[0xa2] & 0x10)) {
|
|
|
|
|
if (dev->pci_conf[0x80] & 0x10)
|
|
|
|
|
picint(1 << smm_irq[dev->pci_conf[0x81] & 0x03]);
|
|
|
|
|
else
|
|
|
|
|
smi_raise();
|
|
|
|
|
smi_block = 1;
|
|
|
|
|
dev->pci_conf[0xa0] |= 0x10;
|
|
|
|
|
}
|
|
|
|
|
if (val & 0x02) {
|
|
|
|
|
timer_stop(&dev->rmsmiblk_timer);
|
|
|
|
|
if (dev->rmsmiblk_count >= 0x02)
|
|
|
|
|
timer_on_auto(&dev->rmsmiblk_timer, 35.0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0xa0:
|
|
|
|
|
case 0xa1: /* SMI Request Status */
|
|
|
|
|
dev->pci_conf[addr] &= ~val;
|
|
|
|
|
break;
|
|
|
|
|
case 0xa3: /* SMI Request Status Selection */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x7f;
|
|
|
|
|
break;
|
|
|
|
|
case 0xa9: /* GPIO SMI Request Status */
|
|
|
|
|
dev->pci_conf[addr] = ~(val & 0x03);
|
|
|
|
|
break;
|
|
|
|
|
case 0xc0: /* PCI INTA# -to-IRQ Link */
|
|
|
|
|
case 0xc1: /* PCI INTB# -to-IRQ Link */
|
|
|
|
|
case 0xc2: /* PCI INTC# -to-IRQ Link */
|
|
|
|
|
case 0xc3: /* PCI INTD# -to-IRQ Link */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x8f;
|
|
|
|
|
if (val & 0x80)
|
|
|
|
|
pci_set_irq_routing(PCI_INTA + (addr & 0x03), val & 0xf);
|
|
|
|
|
else
|
|
|
|
|
pci_set_irq_routing(PCI_INTA + (addr & 0x03), PCI_IRQ_DISABLED);
|
|
|
|
|
break;
|
|
|
|
|
case 0xc6: /* 85C497 Post / INIT Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x0f;
|
|
|
|
|
break;
|
|
|
|
|
case 0xc8:
|
|
|
|
|
case 0xc9:
|
|
|
|
|
case 0xca:
|
|
|
|
|
case 0xcb: /* Mail Box */
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0xd0: /* ISA BIOS Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val & 0xfb;
|
|
|
|
|
break;
|
|
|
|
|
case 0xd1: /* ISA Address Decoder */
|
|
|
|
|
if (dev->pci_conf[0xd0] & 0x01)
|
|
|
|
|
dev->pci_conf[addr] = val;
|
|
|
|
|
break;
|
|
|
|
|
case 0xd3: /* Exclusive Area 2 Base Address */
|
|
|
|
|
dev->pci_conf[addr] = val & 0xf0;
|
|
|
|
|
break;
|
|
|
|
|
case 0xd4: /* Miscellaneous Configuration */
|
|
|
|
|
dev->pci_conf[addr] = val & 0x6e;
|
|
|
|
|
nvr_bank_set(0, !!(val & 0x40), dev->nvr);
|
|
|
|
|
break;
|
2023-06-26 22:31:03 -04:00
|
|
|
|
2023-06-26 12:47:04 -04:00
|
|
|
default:
|
|
|
|
|
break;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static uint8_t
|
2023-06-26 12:47:04 -04:00
|
|
|
sis_85c49x_pci_read(UNUSED(int func), int addr, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2023-07-20 18:58:26 -04:00
|
|
|
const sis_85c496_t *dev = (sis_85c496_t *) priv;
|
|
|
|
|
uint8_t ret = dev->pci_conf[addr];
|
2018-04-25 23:51:13 +02:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
switch (addr) {
|
2022-09-18 17:12:38 -04:00
|
|
|
case 0xa0:
|
|
|
|
|
ret &= 0x10;
|
|
|
|
|
break;
|
|
|
|
|
case 0xa1:
|
|
|
|
|
ret = 0x00;
|
|
|
|
|
break;
|
|
|
|
|
case 0x82: /*Port 22h Mirror*/
|
|
|
|
|
ret = dev->cur_reg;
|
|
|
|
|
break;
|
|
|
|
|
case 0x83: /*Port 70h Mirror*/
|
|
|
|
|
ret = inb(0x70);
|
|
|
|
|
break;
|
2023-06-26 22:31:03 -04:00
|
|
|
|
2023-06-26 12:47:04 -04:00
|
|
|
default:
|
|
|
|
|
break;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
sis_85c496_log("[%04X:%08X] PCI Read %02X from %02X:%02X\n", CS, cpu_state.pc, ret, func, addr);
|
|
|
|
|
|
2020-02-29 19:12:23 +01:00
|
|
|
return ret;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2022-02-20 02:26:27 -05:00
|
|
|
|
2018-11-08 19:21:55 +01:00
|
|
|
static void
|
2020-06-29 01:10:20 +02:00
|
|
|
sis_85c496_rmsmiblk_count(void *priv)
|
|
|
|
|
{
|
|
|
|
|
sis_85c496_t *dev = (sis_85c496_t *) priv;
|
|
|
|
|
|
|
|
|
|
dev->rmsmiblk_count--;
|
|
|
|
|
|
|
|
|
|
if (dev->rmsmiblk_count == 1) {
|
2022-09-18 17:12:38 -04:00
|
|
|
smi_block = 0;
|
|
|
|
|
dev->rmsmiblk_count = 0;
|
|
|
|
|
timer_stop(&dev->rmsmiblk_timer);
|
2020-06-29 01:10:20 +02:00
|
|
|
} else
|
2022-09-18 17:12:38 -04:00
|
|
|
timer_on_auto(&dev->rmsmiblk_timer, 35.0);
|
2020-06-29 01:10:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sis_85c497_isa_reset(sis_85c496_t *dev)
|
2018-11-08 19:21:55 +01:00
|
|
|
{
|
|
|
|
|
memset(dev->regs, 0, sizeof(dev->regs));
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->regs[0x01] = 0xc0;
|
|
|
|
|
dev->regs[0x71] = 0x01;
|
|
|
|
|
dev->regs[0x72] = 0xff;
|
2020-06-29 01:10:20 +02:00
|
|
|
dev->regs[0x76] = 0xff;
|
|
|
|
|
|
|
|
|
|
dma_set_mask(0x00ffffff);
|
2018-11-08 19:21:55 +01:00
|
|
|
|
|
|
|
|
io_removehandler(0x0022, 0x0002,
|
2022-09-18 17:12:38 -04:00
|
|
|
sis_85c497_isa_read, NULL, NULL, sis_85c497_isa_write, NULL, NULL, dev);
|
2020-06-29 01:10:20 +02:00
|
|
|
io_removehandler(0x0033, 0x0001,
|
2022-09-18 17:12:38 -04:00
|
|
|
sis_85c497_isa_read, NULL, NULL, sis_85c497_isa_write, NULL, NULL, dev);
|
2018-11-08 19:21:55 +01:00
|
|
|
io_sethandler(0x0022, 0x0002,
|
2022-09-18 17:12:38 -04:00
|
|
|
sis_85c497_isa_read, NULL, NULL, sis_85c497_isa_write, NULL, NULL, dev);
|
2020-06-29 01:10:20 +02:00
|
|
|
io_sethandler(0x0033, 0x0001,
|
2022-09-18 17:12:38 -04:00
|
|
|
sis_85c497_isa_read, NULL, NULL, sis_85c497_isa_write, NULL, NULL, dev);
|
2018-11-08 19:21:55 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
|
|
|
|
sis_85c496_reset(void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
sis_85c496_t *dev = (sis_85c496_t *) priv;
|
2020-06-29 01:10:20 +02:00
|
|
|
|
|
|
|
|
sis_85c49x_pci_write(0, 0x44, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0x45, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0x58, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0x59, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0x5a, 0x00, dev);
|
2021-04-11 07:25:08 +02:00
|
|
|
// sis_85c49x_pci_write(0, 0x5a, 0x06, dev);
|
2020-06-29 01:10:20 +02:00
|
|
|
|
2023-05-11 03:02:36 -04:00
|
|
|
for (uint8_t i = 0; i < 8; i++)
|
2023-07-12 00:32:21 +02:00
|
|
|
dev->pci_conf[0x48 + i] = 0x02;
|
2020-06-29 01:10:20 +02:00
|
|
|
|
|
|
|
|
sis_85c49x_pci_write(0, 0x80, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0x81, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0x9e, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0x8d, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xa0, 0xff, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xa1, 0xff, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xc0, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xc1, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xc2, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xc3, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xc8, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xc9, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xca, 0x00, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xcb, 0x00, dev);
|
|
|
|
|
|
|
|
|
|
sis_85c49x_pci_write(0, 0xd0, 0x79, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xd1, 0xff, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xd0, 0x78, dev);
|
|
|
|
|
sis_85c49x_pci_write(0, 0xd4, 0x00, dev);
|
|
|
|
|
|
|
|
|
|
ide_pri_disable();
|
|
|
|
|
ide_sec_disable();
|
|
|
|
|
|
|
|
|
|
nvr_bank_set(0, 0, dev->nvr);
|
|
|
|
|
|
|
|
|
|
sis_85c497_isa_reset(dev);
|
2017-05-21 19:16:23 +02:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2023-08-21 20:22:20 -04:00
|
|
|
sis_85c496_close(void *priv)
|
2017-05-21 19:16:23 +02:00
|
|
|
{
|
2023-08-21 20:22:20 -04:00
|
|
|
sis_85c496_t *dev = (sis_85c496_t *) priv;
|
2017-05-21 19:16:23 +02:00
|
|
|
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
smram_del(dev->smram);
|
|
|
|
|
|
|
|
|
|
free(dev);
|
2017-05-21 19:16:23 +02:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2022-09-18 17:12:38 -04:00
|
|
|
*
|
|
|
|
|
sis_85c496_init(const device_t *info)
|
2017-05-21 19:16:23 +02:00
|
|
|
{
|
2018-11-08 19:21:55 +01:00
|
|
|
sis_85c496_t *dev = malloc(sizeof(sis_85c496_t));
|
2020-06-29 01:10:20 +02:00
|
|
|
memset(dev, 0x00, sizeof(sis_85c496_t));
|
|
|
|
|
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
dev->smram = smram_add();
|
|
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
/* PCI Configuration Header Registers (00h ~ 3Fh) */
|
2022-09-18 17:12:38 -04:00
|
|
|
dev->pci_conf[0x00] = 0x39; /* SiS */
|
2020-06-29 01:10:20 +02:00
|
|
|
dev->pci_conf[0x01] = 0x10;
|
2022-09-18 17:12:38 -04:00
|
|
|
dev->pci_conf[0x02] = 0x96; /* 496/497 */
|
2020-06-29 01:10:20 +02:00
|
|
|
dev->pci_conf[0x03] = 0x04;
|
|
|
|
|
dev->pci_conf[0x04] = 0x07;
|
2018-11-08 19:21:55 +01:00
|
|
|
dev->pci_conf[0x06] = 0x80;
|
|
|
|
|
dev->pci_conf[0x07] = 0x02;
|
2022-09-18 17:12:38 -04:00
|
|
|
dev->pci_conf[0x08] = 0x02; /* Device revision */
|
|
|
|
|
dev->pci_conf[0x09] = 0x00; /* Device class (PCI bridge) */
|
2018-11-08 19:21:55 +01:00
|
|
|
dev->pci_conf[0x0b] = 0x06;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
/* 86C496 Specific Registers (40h ~ 7Fh) */
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
/* 86C497 Specific Registers (80h ~ FFh) */
|
2022-09-18 17:12:38 -04:00
|
|
|
dev->pci_conf[0xd0] = 0x78; /* ROM at E0000-FFFFF, Flash enable. */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->pci_conf[0xd1] = 0xff;
|
|
|
|
|
|
2023-08-07 03:04:52 +02:00
|
|
|
pci_add_card(PCI_ADD_NORTHBRIDGE, sis_85c49x_pci_read, sis_85c49x_pci_write, dev, &dev->pci_slot);
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2023-06-26 12:47:04 -04:00
|
|
|
#if 0
|
|
|
|
|
sis_85c497_isa_reset(dev);
|
|
|
|
|
#endif
|
2018-04-25 23:51:13 +02:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->port_92 = device_add(&port_92_device);
|
|
|
|
|
port_92_set_period(dev->port_92, 2ULL * TIMER_USEC);
|
|
|
|
|
port_92_set_features(dev->port_92, 0, 0);
|
|
|
|
|
|
|
|
|
|
sis_85c496_recalcmapping(dev);
|
|
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
ide_pri_disable();
|
|
|
|
|
ide_sec_disable();
|
|
|
|
|
|
|
|
|
|
if (info->local)
|
2022-09-18 17:12:38 -04:00
|
|
|
dev->nvr = device_add(&ami_1994_nvr_device);
|
2020-06-29 01:10:20 +02:00
|
|
|
else
|
2022-09-18 17:12:38 -04:00
|
|
|
dev->nvr = device_add(&at_nvr_device);
|
2020-06-29 01:10:20 +02:00
|
|
|
|
|
|
|
|
dma_high_page_init();
|
|
|
|
|
|
|
|
|
|
timer_add(&dev->rmsmiblk_timer, sis_85c496_rmsmiblk_count, dev, 0);
|
|
|
|
|
|
2023-07-12 00:32:21 +02:00
|
|
|
#ifndef USE_DRB_HACK
|
2023-07-22 15:49:27 +02:00
|
|
|
row_device.local = 7 | (1 << 8) | (0x02 << 16) | (8 << 24);
|
2023-07-12 00:32:21 +02:00
|
|
|
device_add((const device_t *) &row_device);
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-04-11 07:25:08 +02:00
|
|
|
sis_85c496_reset(dev);
|
|
|
|
|
|
2018-11-08 19:21:55 +01:00
|
|
|
return dev;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2022-03-13 09:21:08 -04:00
|
|
|
const device_t sis_85c496_device = {
|
2022-09-18 17:12:38 -04:00
|
|
|
.name = "SiS 85c496/85c497",
|
2022-03-13 09:21:08 -04:00
|
|
|
.internal_name = "sis_85c496",
|
2022-09-18 17:12:38 -04:00
|
|
|
.flags = DEVICE_PCI,
|
|
|
|
|
.local = 0,
|
|
|
|
|
.init = sis_85c496_init,
|
|
|
|
|
.close = sis_85c496_close,
|
|
|
|
|
.reset = sis_85c496_reset,
|
2022-03-13 09:21:08 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:12:38 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-04-25 23:51:13 +02:00
|
|
|
};
|
2020-06-29 01:10:20 +02:00
|
|
|
|
2022-03-13 09:21:08 -04:00
|
|
|
const device_t sis_85c496_ls486e_device = {
|
2022-09-18 17:12:38 -04:00
|
|
|
.name = "SiS 85c496/85c497 (Lucky Star LS-486E)",
|
2022-03-13 09:21:08 -04:00
|
|
|
.internal_name = "sis_85c496_ls486e",
|
2022-09-18 17:12:38 -04:00
|
|
|
.flags = DEVICE_PCI,
|
|
|
|
|
.local = 1,
|
|
|
|
|
.init = sis_85c496_init,
|
|
|
|
|
.close = sis_85c496_close,
|
|
|
|
|
.reset = sis_85c496_reset,
|
2022-03-13 09:21:08 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:12:38 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2020-06-29 01:10:20 +02:00
|
|
|
};
|