SW2 support for ISA Memory Devices

This commit is contained in:
Jasmine Iwanek
2022-01-11 20:12:46 -05:00
parent c0be4ce3d5
commit 608905136f
5 changed files with 42 additions and 17 deletions

View File

@@ -160,7 +160,8 @@ int GAMEBLASTER = 0; /* (C) sound option */
int GUS = 0; /* (C) sound option */
int SSI2001 = 0; /* (C) sound option */
int voodoo_enabled = 0; /* (C) video option */
uint32_t mem_size = 0; /* (C) memory size */
uint32_t mem_size = 0; /* (C) memory size (Installed on system board)*/
uint32_t isa_mem_size = 0; /* (C) memory size (ISA Memory Cards) */
int cpu_use_dynarec = 0; /* (C) cpu uses/needs Dyna */
int cpu = 0; /* (C) cpu type */
int fpu_type = 0; /* (C) fpu type */
@@ -976,9 +977,6 @@ pc_reset_hard_init(void)
/* Reset and reconfigure the Sound Card layer. */
sound_card_reset();
/* Reset any ISA memory cards. */
isamem_reset();
/* Reset any ISA RTC cards. */
isartc_reset();

View File

@@ -598,6 +598,8 @@ dev->frame_addr = 0xE0000;
addr += t;
}
isa_mem_size += dev->total_size - (k >> 10);
/* If EMS is enabled, use the remainder for EMS. */
if (dev->flags & FLAG_EMS) {
/* EMS 3.2 cannot have more than 2048KB per board. */
@@ -1187,6 +1189,9 @@ isamem_reset(void)
{
int k, i;
/* We explicitly set to zero here or bad things happen */
isa_mem_size = 0;
for (i = 0; i < ISAMEM_MAX; i++) {
k = isamem_type[i];
if (k == 0) continue;

View File

@@ -566,8 +566,10 @@ kbd_read(uint16_t port, void *priv)
switch (port) {
case 0x60: /* Keyboard Data Register (aka Port A) */
if ((kbd->pb & 0x80) && ((kbd->type <= KBD_TYPE_XT86) || (kbd->type == KBD_TYPE_ZENITH))) {
if (kbd->type <= KBD_TYPE_PC82)
if ((kbd->pb & 0x80) && ((kbd->type == KBD_TYPE_PC81) || (kbd->type == KBD_TYPE_PC82)
|| (kbd->type == KBD_TYPE_XT82) || (kbd->type == KBD_TYPE_XT86)
|| (kbd->type == KBD_TYPE_ZENITH))) {
if ((kbd->type == KBD_TYPE_PC81) || (kbd->type == KBD_TYPE_PC82))
ret = (kbd->pd & ~0x02) | (hasfpu ? 0x02 : 0x00);
else if ((kbd->type == KBD_TYPE_XT82) || (kbd->type == KBD_TYPE_XT86))
ret = 0xff; /* According to Ruud on the PCem forum, this is supposed to return 0xFF on the XT. */
@@ -599,14 +601,23 @@ kbd_read(uint16_t port, void *priv)
break;
case 0x62: /* Switch Register (aka Port C) */
if (kbd->type == KBD_TYPE_PC81)
ret = 0x00;
else if (kbd->type == KBD_TYPE_PC82) {
if ((kbd->type == KBD_TYPE_PC81) || (kbd->type == KBD_TYPE_PC82)) {
if (kbd->pb & 0x04) /* PB2 */
ret = ((mem_size - 64) / 32) & 0x0f;
switch (mem_size + isa_mem_size) {
case 64:
case 48:
case 32:
case 16:
ret = 0x00;
break;
default:
ret = (((mem_size + isa_mem_size) - 64) / 32) & 0x0f;
break;
}
else
ret = ((mem_size - 64) / 32) >> 4;
} else if (kbd->type == KBD_TYPE_OLIVETTI || kbd->type == KBD_TYPE_ZENITH) {
ret = (((mem_size + isa_mem_size) - 64) / 32) >> 4;
} else if (kbd->type == KBD_TYPE_OLIVETTI
|| kbd->type == KBD_TYPE_ZENITH) {
/* Olivetti M19 or Zenith Data Systems Z-151 */
if (kbd->pb & 0x04) /* PB2 */
ret = kbd->pd & 0xbf;
@@ -643,7 +654,8 @@ kbd_read(uint16_t port, void *priv)
case 0x63: /* Keyboard Configuration Register (aka Port D) */
if ((kbd->type == KBD_TYPE_XT82) || (kbd->type == KBD_TYPE_XT86)
|| (kbd->type == KBD_TYPE_COMPAQ) || (kbd->type == KBD_TYPE_TOSHIBA))
|| (kbd->type == KBD_TYPE_COMPAQ)
|| (kbd->type == KBD_TYPE_TOSHIBA))
ret = kbd->pd;
break;
}
@@ -694,8 +706,12 @@ kbd_init(const device_t *info)
video_reset(gfxcard);
if ((kbd->type <= KBD_TYPE_XT86) || (kbd->type == KBD_TYPE_COMPAQ)
|| (kbd->type == KBD_TYPE_TOSHIBA) || (kbd->type == KBD_TYPE_OLIVETTI)) {
if ((kbd->type == KBD_TYPE_PC81) || (kbd->type == KBD_TYPE_PC82)
|| (kbd->type == KBD_TYPE_XT82) || (kbd->type <= KBD_TYPE_XT86)
|| (kbd->type == KBD_TYPE_COMPAQ)
|| (kbd->type == KBD_TYPE_TOSHIBA)
|| (kbd->type == KBD_TYPE_OLIVETTI)) {
/* DIP switch readout: bit set = OFF, clear = ON. */
if (kbd->type == KBD_TYPE_OLIVETTI)
/* Olivetti M19
@@ -713,7 +729,8 @@ kbd_init(const device_t *info)
kbd->pd |= get_videomode_switch_settings();
/* Switches 3, 4 - memory size. */
if ((kbd->type == KBD_TYPE_XT86) || (kbd->type == KBD_TYPE_COMPAQ)
if ((kbd->type == KBD_TYPE_XT86)
|| (kbd->type == KBD_TYPE_COMPAQ)
|| (kbd->type == KBD_TYPE_TOSHIBA)) {
switch (mem_size) {
case 256:

View File

@@ -122,7 +122,8 @@ extern int sound_is_float, /* (C) sound uses FP values */
GUS, GUSMAX, /* (C) sound option */
SSI2001, /* (C) sound option */
voodoo_enabled; /* (C) video option */
extern uint32_t mem_size; /* (C) memory size */
extern uint32_t mem_size; /* (C) memory size (Installed on system board) */
extern uint32_t isa_mem_size; /* (C) memory size (ISA Memory Cards) */
extern int cpu, /* (C) cpu type */
cpu_use_dynarec, /* (C) cpu uses/needs Dyna */
fpu_type; /* (C) fpu type */

View File

@@ -40,6 +40,7 @@
#include "cpu.h"
#include <86box/video.h>
#include <86box/machine.h>
#include <86box/isamem.h>
int bios_only = 0;
@@ -101,6 +102,9 @@ machine_init_ex(int m)
/* Prepare some video-related things if we're using internal
or no video. */
video_pre_reset(gfxcard);
/* Reset any ISA memory cards. */
isamem_reset();
}
/* All good, boot the machine! */