ISA PS/2: Clean-ups and converted into a typedef struct.

MCA PS/2: Added Model 60 (8-slot version of 50 with the same bios) and Model 65sx (essentially the same as 55sx but with a new bios and a secondary nvram a la 70-80 but limited to 2KB of size instead of 8KB).
MCA PS/2: Made the i486 cpu selection on only on Type 3 MCA models (70-80) and not Type 2 anymore, therefore the latter is limited to 386DX cpu's only.
This commit is contained in:
TC1995
2022-07-19 16:32:23 +02:00
parent f4f8860606
commit df5c1a1a46
6 changed files with 266 additions and 169 deletions

View File

@@ -53,7 +53,8 @@
typedef struct {
int addr;
uint8_t ram[8192];
uint8_t *ram;
int size;
char *fn;
} ps2_nvr_t;
@@ -114,6 +115,11 @@ ps2_nvr_init(const device_t *info)
nvr = (ps2_nvr_t *)malloc(sizeof(ps2_nvr_t));
memset(nvr, 0x00, sizeof(ps2_nvr_t));
if (info->local)
nvr->size = 2048;
else
nvr->size = 8192;
/* Set up the NVR file's name. */
c = strlen(machine_get_internal_name()) + 9;
nvr->fn = (char *)malloc(c + 1);
@@ -124,9 +130,10 @@ ps2_nvr_init(const device_t *info)
f = nvr_fopen(nvr->fn, "rb");
memset(nvr->ram, 0xff, 8192);
nvr->ram = (uint8_t *)malloc(nvr->size);
memset(nvr->ram, 0xff, nvr->size);
if (f != NULL) {
if (fread(nvr->ram, 1, 8192, f) != 8192)
if (fread(nvr->ram, 1, nvr->size, f) != nvr->size)
fatal("ps2_nvr_init(): Error reading EEPROM data\n");
fclose(f);
}
@@ -144,16 +151,18 @@ ps2_nvr_close(void *priv)
f = nvr_fopen(nvr->fn, "wb");
if (f != NULL) {
(void)fwrite(nvr->ram, 8192, 1, f);
(void)fwrite(nvr->ram, nvr->size, 1, f);
fclose(f);
}
if (nvr->ram != NULL)
free(nvr->ram);
free(nvr);
}
const device_t ps2_nvr_device = {
.name = "PS/2 Secondary NVRAM",
.name = "PS/2 Secondary NVRAM for PS/2 Models 70-80",
.internal_name = "ps2_nvr",
.flags = 0,
.local = 0,
@@ -165,3 +174,17 @@ const device_t ps2_nvr_device = {
.force_redraw = NULL,
.config = NULL
};
const device_t ps2_nvr_55ls_device = {
.name = "PS/2 Secondary NVRAM for PS/2 Models 55LS-65SX",
.internal_name = "ps2_nvr_55ls",
.flags = 0,
.local = 1,
.init = ps2_nvr_init,
.close = ps2_nvr_close,
.reset = NULL,
{ .available = NULL },
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};