Added the OPTi 82c602, on-board CL-GD 5430, and also gave the PC87306 Super I/O chip its full NVR capabilities, fixes #2877.

This commit is contained in:
OBattler
2023-08-15 06:45:02 +02:00
parent 1345dbd975
commit f7b5a566cb
14 changed files with 115 additions and 46 deletions

View File

@@ -295,6 +295,7 @@
#define FLAG_AMI_1995_HACK 0x08
#define FLAG_P6RP4_HACK 0x10
#define FLAG_PIIX4 0x20
#define FLAG_MULTI_BANK 0x40
typedef struct local_t {
int8_t stat;
@@ -559,6 +560,8 @@ timer_tick(nvr_t *nvr)
static void
nvr_reg_common_write(uint16_t reg, uint8_t val, nvr_t *nvr, local_t *local)
{
if (local->lock[reg])
return;
if ((reg == 0x2c) && (local->flags & FLAG_AMI_1994_HACK))
nvr->is_new = 0;
if ((reg == 0x2d) && (local->flags & FLAG_AMI_1992_HACK))
@@ -569,8 +572,6 @@ nvr_reg_common_write(uint16_t reg, uint8_t val, nvr_t *nvr, local_t *local)
return;
if ((reg >= 0xb8) && (reg <= 0xbf) && local->wp[1])
return;
if (local->lock[reg])
return;
if (nvr->regs[reg] != val) {
nvr->regs[reg] = val;
nvr_dosave = 1;
@@ -664,9 +665,12 @@ nvr_write(uint16_t addr, uint8_t val, void *priv)
} else {
local->addr[addr_id] = (val & (nvr->size - 1));
/* Some chipsets use a 256 byte NVRAM but ports 70h and 71h always access only 128 bytes. */
if (addr_id == 0x0)
if (addr_id == 0x0) {
local->addr[addr_id] &= 0x7f;
else if ((addr_id == 0x1) && (local->flags & FLAG_PIIX4))
/* Needed for OPTi 82C601/82C602 and NSC PC87306. */
if (local->flags & FLAG_MULTI_BANK)
local->addr[addr_id] |= (0x80 * local->bank[addr_id]);
} else if ((addr_id == 0x1) && (local->flags & FLAG_PIIX4))
local->addr[addr_id] = (local->addr[addr_id] & 0x7f) | 0x80;
if (local->bank[addr_id] > 0)
local->addr[addr_id] = (local->addr[addr_id] & 0x7f) | (0x80 * local->bank[addr_id]);
@@ -1080,6 +1084,12 @@ nvr_at_init(const device_t *info)
break;
}
if (info->local & 0x20)
local->def = 0x00;
if (info->local & 0x40)
local->flags |= FLAG_MULTI_BANK;
local->read_addr = 1;
/* Set up any local handlers here. */
@@ -1174,6 +1184,20 @@ const device_t at_nvr_device = {
.config = NULL
};
const device_t at_mb_nvr_device = {
.name = "PC/AT NVRAM",
.internal_name = "at_nvr",
.flags = DEVICE_ISA | DEVICE_AT,
.local = 0x40 | 0x20 | 1,
.init = nvr_at_init,
.close = nvr_at_close,
.reset = nvr_at_reset,
{ .available = NULL },
.speed_changed = nvr_at_speed_changed,
.force_redraw = NULL,
.config = NULL
};
const device_t ps_nvr_device = {
.name = "PS/1 or PS/2 NVRAM",
.internal_name = "ps_nvr",