Brought the ISA memory card emulation and some other things up to par with VARCem and fixed the ISA memory card configuration.

This commit is contained in:
OBattler
2018-09-06 14:38:43 +02:00
parent 9a180ed33c
commit ea5a226a97
9 changed files with 267 additions and 265 deletions

View File

@@ -8,7 +8,7 @@
* *
* Configuration file handler. * Configuration file handler.
* *
* Version: @(#)config.c 1.0.51 2018/09/03 * Version: @(#)config.c 1.0.52 2018/09/06
* *
* Authors: Sarah Walker, * Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -1743,7 +1743,7 @@ save_other_peripherals(void)
config_delete_var(cat, temp); config_delete_var(cat, temp);
else else
config_set_string(cat, temp, config_set_string(cat, temp,
isamem_get_internal_name(isamem_type[c])); (char *) isamem_get_internal_name(isamem_type[c]));
} }
if (isartc_type == 0) if (isartc_type == 0)

View File

@@ -9,7 +9,7 @@
* Implementation of the generic device interface to handle * Implementation of the generic device interface to handle
* all devices attached to the emulator. * all devices attached to the emulator.
* *
* Version: @(#)device.c 1.0.10 2018/09/04 * Version: @(#)device.c 1.0.15 2018/09/06
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -91,19 +91,18 @@ device_log(const char *format, ...)
void void
device_init(void) device_init(void)
{ {
clonedev_t *ptr; clonedev_t *ptr;
memset(devices, 0x00, sizeof(devices)); memset(devices, 0x00, sizeof(devices));
ptr = NULL; ptr = NULL;
while (clones != NULL) while (clones != NULL) {
{ ptr = clones->next;
ptr = clones->next; free(clones);
free(clones); clones = ptr;
clones = ptr; }
}
clones = NULL;
clones = NULL;
} }
@@ -150,14 +149,14 @@ device_clone(const device_t *master)
return((const device_t *)dev); return((const device_t *)dev);
} }
void * void *
device_add(const device_t *d) device_add(const device_t *d)
{ {
void *priv = NULL; void *priv = NULL;
int c; int c;
for (c=0; c<256; c++) { for (c = 0; c < 256; c++) {
if (devices[c] == (device_t *)d) { if (devices[c] == (device_t *)d) {
device_log("DEVICE: device already exists!\n"); device_log("DEVICE: device already exists!\n");
return(NULL); return(NULL);
@@ -169,22 +168,18 @@ device_add(const device_t *d)
device_current = (device_t *)d; device_current = (device_t *)d;
devices[c] = (device_t *)d;
if (d->init != NULL) { if (d->init != NULL) {
priv = d->init(d); priv = d->init(d);
if (priv == NULL) { if (priv == NULL) {
if (d->name) if (d->name)
device_log("DEVICE: device '%s' init failed\n", d->name); device_log("DEVICE: device '%s' init failed\n", d->name);
else else
device_log("DEVICE: device init failed\n"); device_log("DEVICE: device init failed\n");
device_priv[c] = NULL;
return(NULL); return(NULL);
} }
} }
devices[c] = (device_t *)d;
device_priv[c] = priv; device_priv[c] = priv;
return(priv); return(priv);
@@ -197,7 +192,7 @@ device_add_ex(const device_t *d, void *priv)
{ {
int c; int c;
for (c=0; c<256; c++) { for (c = 0; c < 256; c++) {
if (devices[c] == (device_t *)d) { if (devices[c] == (device_t *)d) {
fatal("device_add: device already exists!\n"); fatal("device_add: device already exists!\n");
break; break;
@@ -219,7 +214,7 @@ device_close_all(void)
{ {
int c; int c;
for (c=0; c<DEVICE_MAX; c++) { for (c = 0; c < DEVICE_MAX; c++) {
if (devices[c] != NULL) { if (devices[c] != NULL) {
if (devices[c]->close != NULL) if (devices[c]->close != NULL)
devices[c]->close(device_priv[c]); devices[c]->close(device_priv[c]);
@@ -234,7 +229,7 @@ device_reset_all(void)
{ {
int c; int c;
for (c=0; c<DEVICE_MAX; c++) { for (c = 0; c < DEVICE_MAX; c++) {
if (devices[c] != NULL) { if (devices[c] != NULL) {
if (devices[c]->reset != NULL) if (devices[c]->reset != NULL)
devices[c]->reset(device_priv[c]); devices[c]->reset(device_priv[c]);
@@ -263,7 +258,7 @@ device_get_priv(const device_t *d)
{ {
int c; int c;
for (c=0; c<DEVICE_MAX; c++) { for (c = 0; c < DEVICE_MAX; c++) {
if (devices[c] != NULL) { if (devices[c] != NULL) {
if (devices[c] == d) if (devices[c] == d)
return(device_priv[c]); return(device_priv[c]);
@@ -292,7 +287,7 @@ device_speed_changed(void)
{ {
int c; int c;
for (c=0; c<DEVICE_MAX; c++) { for (c = 0; c < DEVICE_MAX; c++) {
if (devices[c] != NULL) { if (devices[c] != NULL) {
if (devices[c]->speed_changed != NULL) if (devices[c]->speed_changed != NULL)
devices[c]->speed_changed(device_priv[c]); devices[c]->speed_changed(device_priv[c]);
@@ -308,7 +303,7 @@ device_force_redraw(void)
{ {
int c; int c;
for (c=0; c<DEVICE_MAX; c++) { for (c = 0; c < DEVICE_MAX; c++) {
if (devices[c] != NULL) { if (devices[c] != NULL) {
if (devices[c]->force_redraw != NULL) if (devices[c]->force_redraw != NULL)
devices[c]->force_redraw(device_priv[c]); devices[c]->force_redraw(device_priv[c]);
@@ -317,14 +312,14 @@ device_force_redraw(void)
} }
char * const char *
device_get_config_string(char *s) device_get_config_string(const char *s)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) if (! strcmp(s, c->name))
return(config_get_string((char *)device_current->name, s, (char *)c->default_string)); return(config_get_string((char *) device_current->name, (char *) s, (char *) c->default_string));
c++; c++;
} }
@@ -334,13 +329,13 @@ device_get_config_string(char *s)
int int
device_get_config_int(char *s) device_get_config_int(const char *s)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) if (! strcmp(s, c->name))
return(config_get_int((char *)device_current->name, s, c->default_int)); return(config_get_int((char *) device_current->name, (char *) s, c->default_int));
c++; c++;
} }
@@ -350,29 +345,29 @@ device_get_config_int(char *s)
int int
device_get_config_int_ex(char *s, int default_int) device_get_config_int_ex(const char *s, int def)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) if (! strcmp(s, c->name))
return(config_get_int((char *)device_current->name, s, default_int)); return(config_get_int((char *) device_current->name, (char *) s, def));
c++; c++;
} }
return(default_int); return(def);
} }
int int
device_get_config_hex16(char *s) device_get_config_hex16(const char *s)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) if (! strcmp(s, c->name))
return(config_get_hex16((char *)device_current->name, s, c->default_int)); return(config_get_hex16((char *) device_current->name, (char *) s, c->default_int));
c++; c++;
} }
@@ -382,13 +377,13 @@ device_get_config_hex16(char *s)
int int
device_get_config_hex20(char *s) device_get_config_hex20(const char *s)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) if (! strcmp(s, c->name))
return(config_get_hex20((char *)device_current->name, s, c->default_int)); return(config_get_hex20((char *) device_current->name, (char *) s, c->default_int));
c++; c++;
} }
@@ -398,29 +393,29 @@ device_get_config_hex20(char *s)
int int
device_get_config_mac(char *s, int default_int) device_get_config_mac(const char *s, int def)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) if (! strcmp(s, c->name))
return(config_get_mac((char *)device_current->name, s, default_int)); return(config_get_mac((char *) device_current->name, (char *) s, def));
c++; c++;
} }
return(default_int); return(def);
} }
void void
device_set_config_int(char *s, int val) device_set_config_int(const char *s, int val)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) { if (! strcmp(s, c->name)) {
config_set_int((char *)device_current->name, s, val); config_set_int((char *) device_current->name, (char *) s, val);
break; break;
} }
@@ -430,13 +425,13 @@ device_set_config_int(char *s, int val)
void void
device_set_config_hex16(char *s, int val) device_set_config_hex16(const char *s, int val)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) { if (! strcmp(s, c->name)) {
config_set_hex16((char *)device_current->name, s, val); config_set_hex16((char *) device_current->name, (char *) s, val);
break; break;
} }
@@ -446,13 +441,13 @@ device_set_config_hex16(char *s, int val)
void void
device_set_config_hex20(char *s, int val) device_set_config_hex20(const char *s, int val)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) { if (! strcmp(s, c->name)) {
config_set_hex20((char *)device_current->name, s, val); config_set_hex20((char *) device_current->name, (char *) s, val);
break; break;
} }
@@ -462,13 +457,13 @@ device_set_config_hex20(char *s, int val)
void void
device_set_config_mac(char *s, int val) device_set_config_mac(const char *s, int val)
{ {
const device_config_t *c = device_current->config; const device_config_t *c = device_current->config;
while (c && c->type != -1) { while (c && c->type != -1) {
if (! strcmp(s, c->name)) { if (! strcmp(s, c->name)) {
config_set_mac((char *)device_current->name, s, val); config_set_mac((char *) device_current->name, (char *) s, val);
break; break;
} }

View File

@@ -8,7 +8,7 @@
* *
* Definitions for the device handler. * Definitions for the device handler.
* *
* Version: @(#)device.h 1.0.6 2018/09/02 * Version: @(#)device.h 1.0.8 2018/09/06
* *
* Authors: Fred N. van Kempen, <decwiz@yahoo.com> * Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -53,7 +53,7 @@
enum { enum {
DEVICE_NOT_WORKING = 1, /* does not currently work correctly and will be disabled in a release build*/ DEVICE_UNSTABLE = 1, /* unstable device, be cautious */
DEVICE_AT = 2, /* requires an AT-compatible system */ DEVICE_AT = 2, /* requires an AT-compatible system */
DEVICE_PS2 = 4, /* requires a PS/1 or PS/2 system */ DEVICE_PS2 = 4, /* requires a PS/1 or PS/2 system */
DEVICE_ISA = 8, /* requires the ISA bus */ DEVICE_ISA = 8, /* requires the ISA bus */
@@ -99,11 +99,11 @@ typedef struct _device_ {
uint32_t local; /* flags local to device */ uint32_t local; /* flags local to device */
void *(*init)(const struct _device_ *); void *(*init)(const struct _device_ *);
void (*close)(void *p); void (*close)(void *priv);
void (*reset)(void *p); void (*reset)(void *priv);
int (*available)(/*void*/); int (*available)(/*void*/);
void (*speed_changed)(void *p); void (*speed_changed)(void *priv);
void (*force_redraw)(void *p); void (*force_redraw)(void *priv);
const device_config_t *config; const device_config_t *config;
} device_t; } device_t;
@@ -113,29 +113,30 @@ typedef struct _device_ {
extern "C" { extern "C" {
#endif #endif
extern void device_init(void); extern void device_init(void);
extern const device_t * device_clone(const device_t *master); extern const device_t * device_clone(const device_t *master);
extern void *device_add(const device_t *d); extern void *device_add(const device_t *);
extern void device_add_ex(const device_t *d, void *priv); extern void device_add_ex(const device_t *d, void *priv);
extern void device_close_all(void); extern void device_close_all(void);
extern void device_reset_all(void); extern void device_reset_all(void);
extern void device_reset_all_pci(void); extern void device_reset_all_pci(void);
extern void *device_get_priv(const device_t *d); extern void *device_get_priv(const device_t *);
extern int device_available(const device_t *d); extern int device_available(const device_t *);
extern void device_speed_changed(void); extern void device_speed_changed(void);
extern void device_force_redraw(void); extern void device_force_redraw(void);
extern int device_get_config_int(char *name); extern int device_is_valid(const device_t *, int machine_flags);
extern int device_get_config_int_ex(char *s, int default_int);
extern int device_get_config_hex16(char *name); extern int device_get_config_int(const char *name);
extern int device_get_config_hex20(char *name); extern int device_get_config_int_ex(const char *s, int dflt_int);
extern int device_get_config_mac(char *name, int default_int); extern int device_get_config_hex16(const char *name);
extern void device_set_config_int(char *s, int val); extern int device_get_config_hex20(const char *name);
extern void device_set_config_hex16(char *s, int val); extern int device_get_config_mac(const char *name, int dflt_int);
extern void device_set_config_hex20(char *s, int val); extern void device_set_config_int(const char *s, int val);
extern void device_set_config_mac(char *s, int val); extern void device_set_config_hex16(const char *s, int val);
extern char *device_get_config_string(char *name); extern void device_set_config_hex20(const char *s, int val);
extern int device_is_valid(const device_t *device, int machine_flags); extern void device_set_config_mac(const char *s, int val);
extern const char *device_get_config_string(const char *name);
extern int machine_get_config_int(char *s); extern int machine_get_config_int(char *s);
extern char *machine_get_config_string(char *s); extern char *machine_get_config_string(char *s);

View File

@@ -32,7 +32,7 @@
* TODO: The EV159 is supposed to support 16b EMS transfers, but the * TODO: The EV159 is supposed to support 16b EMS transfers, but the
* EMM.sys driver for it doesn't seem to want to do that.. * EMM.sys driver for it doesn't seem to want to do that..
* *
* Version: @(#)isamem.c 1.0.3 2018/09/04 * Version: @(#)isamem.c 1.0.5 2018/09/06
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -83,6 +83,9 @@
#include "plat.h" #include "plat.h"
#include "isamem.h" #include "isamem.h"
#define ISAMEM_DEBUG 0
#define RAM_TOPMEM (640 << 10) /* end of low memory */ #define RAM_TOPMEM (640 << 10) /* end of low memory */
#define RAM_UMAMEM (384 << 10) /* upper memory block */ #define RAM_UMAMEM (384 << 10) /* upper memory block */
#define RAM_EXTMEM (1024 << 10) /* start of high memory */ #define RAM_EXTMEM (1024 << 10) /* start of high memory */
@@ -150,6 +153,15 @@ isamem_log(const char *fmt, ...)
} }
/* Local variables. */
static const device_t *instance[ISAMEM_MAX] = {
NULL,
NULL,
NULL,
NULL
};
/* Read one byte from onboard RAM. */ /* Read one byte from onboard RAM. */
static uint8_t static uint8_t
ram_readb(uint32_t addr, void *priv) ram_readb(uint32_t addr, void *priv)
@@ -218,6 +230,9 @@ ems_readb(uint32_t addr, void *priv)
/* Grab the data. */ /* Grab the data. */
ret = *(uint8_t *)(dev->ems[vpage].addr + (addr - map->base)); ret = *(uint8_t *)(dev->ems[vpage].addr + (addr - map->base));
#if ISAMEM_DEBUG
if ((addr % 4096)==0) isamem_log("EMS readb(%06x) = %02x\n",addr-map->base,ret);
#endif
return(ret); return(ret);
} }
@@ -237,6 +252,9 @@ ems_readw(uint32_t addr, void *priv)
/* Grab the data. */ /* Grab the data. */
ret = *(uint16_t *)(dev->ems[vpage].addr + (addr - map->base)); ret = *(uint16_t *)(dev->ems[vpage].addr + (addr - map->base));
#if ISAMEM_DEBUG
if ((addr % 4096)==0) isamem_log("EMS readw(%06x) = %04x\n",addr-map->base,ret);
#endif
return(ret); return(ret);
} }
@@ -254,6 +272,9 @@ ems_writeb(uint32_t addr, uint8_t val, void *priv)
vpage = ((addr & 0xffff) / EMS_PGSIZE); vpage = ((addr & 0xffff) / EMS_PGSIZE);
/* Write the data. */ /* Write the data. */
#if ISAMEM_DEBUG
if ((addr % 4096)==0) isamem_log("EMS writeb(%06x, %02x)\n",addr-map->base,val);
#endif
*(uint8_t *)(dev->ems[vpage].addr + (addr - map->base)) = val; *(uint8_t *)(dev->ems[vpage].addr + (addr - map->base)) = val;
} }
@@ -270,6 +291,9 @@ ems_writew(uint32_t addr, uint16_t val, void *priv)
vpage = ((addr & 0xffff) / EMS_PGSIZE); vpage = ((addr & 0xffff) / EMS_PGSIZE);
/* Write the data. */ /* Write the data. */
#if ISAMEM_DEBUG
if ((addr % 4096)==0) isamem_log("EMS writew(%06x, %04x)\n",addr-map->base,val);
#endif
*(uint16_t *)(dev->ems[vpage].addr + (addr - map->base)) = val; *(uint16_t *)(dev->ems[vpage].addr + (addr - map->base)) = val;
} }
@@ -284,7 +308,7 @@ ems_read(uint16_t port, void *priv)
/* Get the viewport page number. */ /* Get the viewport page number. */
vpage = (port / EMS_PGSIZE); vpage = (port / EMS_PGSIZE);
port &= (EMS_PGSIZE - 1); port &= (EMS_PGSIZE - 1);
switch(port - dev->base_addr) { switch(port - dev->base_addr) {
case 0x0000: /* page number register */ case 0x0000: /* page number register */
@@ -292,12 +316,14 @@ ems_read(uint16_t port, void *priv)
if (dev->ems[vpage].enabled) if (dev->ems[vpage].enabled)
ret |= 0x80; ret |= 0x80;
break; break;
case 0x0001: /* W/O */ case 0x0001: /* W/O */
break; break;
} }
#if ISAMEM_DEBUG
isamem_log("ISAMEM: read(%04x) = %02x)\n", port, ret); isamem_log("ISAMEM: read(%04x) = %02x)\n", port, ret);
#endif
return(ret); return(ret);
} }
@@ -312,11 +338,13 @@ ems_write(uint16_t port, uint8_t val, void *priv)
/* Get the viewport page number. */ /* Get the viewport page number. */
vpage = (port / EMS_PGSIZE); vpage = (port / EMS_PGSIZE);
port &= (EMS_PGSIZE - 1); port &= (EMS_PGSIZE - 1);
#if ISAMEM_DEBUG
isamem_log("ISAMEM: write(%04x, %02x) page=%d\n", port, val, vpage); isamem_log("ISAMEM: write(%04x, %02x) page=%d\n", port, val, vpage);
#endif
switch(port - dev->base_addr) {
switch(port - dev->base_addr) {
case 0x0000: /* page mapping registers */ case 0x0000: /* page mapping registers */
/* Set the page number. */ /* Set the page number. */
dev->ems[vpage].enabled = (val & 0x80); dev->ems[vpage].enabled = (val & 0x80);
@@ -355,11 +383,17 @@ ems_write(uint16_t port, uint8_t val, void *priv)
* *
* 00 04 08 Address * 00 04 08 Address
* ----------------- * -----------------
* 80 c0 e0 C0000
* 80 c0 e0 C4000
* 80 c0 e0 C8000
* 80 c0 e0 CC000
* 80 c0 e0 D0000
* 80 c0 e0 D4000
* 80 c0 e0 D8000
* 80 c0 e0 DC000
* 80 c0 e0 E0000 * 80 c0 e0 E0000
*/ */
isamem_log("EMS: write(%02x) to register 1 !\n");
isamem_log("EMS: write(%02x) to register 1 !\n");
dev->ems[vpage].frame = val; dev->ems[vpage].frame = val;
if (val) if (val)
dev->flags |= FLAG_CONFIG; dev->flags |= FLAG_CONFIG;
@@ -380,10 +414,13 @@ isamem_init(const device_t *info)
int i; int i;
/* Find our device and create an instance. */ /* Find our device and create an instance. */
for (i = 0; i < ISAMEM_MAX; i++)
if (instance[i] == info) break;
dev = (memdev_t *)malloc(sizeof(memdev_t)); dev = (memdev_t *)malloc(sizeof(memdev_t));
memset(dev, 0x00, sizeof(memdev_t)); memset(dev, 0x00, sizeof(memdev_t));
dev->name = info->name; dev->name = info->name;
dev->board = info->local; dev->board = info->local;
dev->instance = i;
/* Do per-board initialization. */ /* Do per-board initialization. */
tot = 0; tot = 0;
@@ -403,12 +440,12 @@ isamem_init(const device_t *info)
break; break;
case 3: /* Micro Mainframe EMS-5150(T) */ case 3: /* Micro Mainframe EMS-5150(T) */
dev->base_addr = device_get_config_hex16("base"); dev->base_addr = device_get_config_hex16("base");
dev->total_size = device_get_config_int("size"); dev->total_size = device_get_config_int("size");
dev->frame_addr = 0xD0000; dev->frame_addr = 0xD0000;
dev->flags |= (FLAG_EMS | FLAG_CONFIG); dev->flags |= (FLAG_EMS | FLAG_CONFIG);
break; break;
case 10: /* Everex EV-159 RAM 3000 */ case 10: /* Everex EV-159 RAM 3000 */
dev->base_addr = device_get_config_hex16("base"); dev->base_addr = device_get_config_hex16("base");
dev->total_size = device_get_config_int("size"); dev->total_size = device_get_config_int("size");
@@ -440,18 +477,25 @@ dev->frame_addr = 0xE0000;
/* Say hello! */ /* Say hello! */
isamem_log("ISAMEM: %s (%iKB", info->name, dev->total_size); isamem_log("ISAMEM: %s (%iKB", info->name, dev->total_size);
if (dev->total_size != tot) isamem_log(", %iKB for RAM", tot); if (tot && (dev->total_size != tot))
isamem_log(", %iKB for RAM", tot);
if (dev->flags & FLAG_FAST) isamem_log(", FAST"); if (dev->flags & FLAG_FAST) isamem_log(", FAST");
if (dev->flags & FLAG_WIDE) isamem_log(", 16BIT"); if (dev->flags & FLAG_WIDE) isamem_log(", 16BIT");
isamem_log(")\n"); isamem_log(")\n");
/* Force (back to) 8-bit bus if needed. */ /* Force (back to) 8-bit bus if needed. */
if (AT) { if (dev->flags & FLAG_WIDE) {
if (! cpu_16bitbus) if (AT) {
isamem_log("ISAMEM: *WARNING* this board will slow down your PC!\n"); if (! cpu_16bitbus)
isamem_log("ISAMEM: *WARNING* this board will slow down your PC!\n");
} else {
isamem_log("ISAMEM: not AT+ system, forcing 8-bit mode!\n");
dev->flags &= ~FLAG_WIDE;
}
} else { } else {
isamem_log("ISAMEM: not AT+ system, forcing 8-bit mode!\n"); if (AT) {
dev->flags &= ~FLAG_WIDE; isamem_log("ISAMEM: *WARNING* this board will slow down your PC!\n");
}
} }
/* Allocate and initialize our RAM. */ /* Allocate and initialize our RAM. */
@@ -582,7 +626,7 @@ dev->frame_addr = 0xE0000;
dev->ems_start = ptr - dev->ram; dev->ems_start = ptr - dev->ram;
dev->ems_size = t >> 10; dev->ems_size = t >> 10;
dev->ems_pages = t / EMS_PGSIZE; dev->ems_pages = t / EMS_PGSIZE;
isamem_log("ISAMEM: EMS enabled, I/O=%04xH, %iKB (%i pages)", isamem_log("ISAMEM: EMS enabled, I/O=%04XH, %iKB (%i pages)",
dev->base_addr, dev->ems_size, dev->ems_pages); dev->base_addr, dev->ems_size, dev->ems_pages);
if (dev->frame_addr > 0) if (dev->frame_addr > 0)
isamem_log(", Frame=%05XH", dev->frame_addr); isamem_log(", Frame=%05XH", dev->frame_addr);
@@ -616,7 +660,7 @@ dev->frame_addr = 0xE0000;
} }
} }
/* Just so its not NULL. */ /* Let them know our device instance. */
return((void *)dev); return((void *)dev);
} }
@@ -637,10 +681,11 @@ isamem_close(void *priv)
} }
if (dev->ram != NULL) if (dev->ram != NULL)
free(dev->ram); free(dev->ram);
if (dev != NULL) instance[dev->instance] = NULL;
free(dev);
free(dev);
} }
@@ -650,7 +695,7 @@ static const device_config_t ibmxt_config[] =
"size", "Memory Size", CONFIG_SPINNER, "", 128, "size", "Memory Size", CONFIG_SPINNER, "", 128,
{ { 0 } }, { { 0 } },
{ { 0 } }, { { 0 } },
{ 0, 256, 16 } { 0, 512, 16 }
}, },
{ {
"start", "Start Address", CONFIG_SPINNER, "", 256, "start", "Start Address", CONFIG_SPINNER, "", 256,
@@ -667,12 +712,8 @@ static const device_t ibmxt_device = {
"IBM PC/XT Memory Expansion", "IBM PC/XT Memory Expansion",
DEVICE_ISA, DEVICE_ISA,
0, 0,
isamem_init, isamem_init, isamem_close, NULL,
isamem_close, NULL, NULL, NULL,
NULL,
NULL,
NULL,
NULL,
ibmxt_config ibmxt_config
}; };
@@ -705,24 +746,25 @@ static const device_t ibmat_device = {
ibmat_config ibmat_config
}; };
static const device_config_t p5pak_config[] = static const device_config_t p5pak_config[] =
{ {
{ {
"size", "Memory Size", CONFIG_SPINNER, "", 128, "size", "Memory Size", CONFIG_SPINNER, "", 128,
{ { 0 } }, { { 0 } },
{ { 0 } }, { { 0 } },
{ 0, 384, 64 } { 0, 384, 64 }
}, },
{ {
"start", "Start Address", CONFIG_SPINNER, "", 512, "start", "Start Address", CONFIG_SPINNER, "", 512,
{ { 0 } }, { { 0 } },
{ { 0 } }, { { 0 } },
{ 64, 576, 64 } { 64, 576, 64 }
}, },
{ {
"", "", -1 "", "", -1
} }
}; };
static const device_t p5pak_device = { static const device_t p5pak_device = {
"Paradise Systems 5-PAK", "Paradise Systems 5-PAK",
@@ -733,40 +775,41 @@ static const device_t p5pak_device = {
p5pak_config p5pak_config
}; };
static const device_config_t ems5150_config[] = static const device_config_t ems5150_config[] =
{ {
{ {
"size", "Memory Size", CONFIG_SPINNER, "", 256, "size", "Memory Size", CONFIG_SPINNER, "", 256,
{ { 0 } }, { { 0 } },
{ { 0 } }, { { 0 } },
{ 0, 2048, 64 } { 0, 2048, 64 }
}, },
{ {
"base", "Address", CONFIG_HEX16, "", 0, "base", "Address", CONFIG_HEX16, "", 0,
{ {
{ {
"Disabled", 0 "Disabled", 0
}, },
{ {
"Board 1", 0x0208 "Board 1", 0x0208
}, },
{ {
"Board 2", 0x020a "Board 2", 0x020a
}, },
{ {
"Board 3", 0x020c "Board 3", 0x020c
}, },
{ {
"Board 4", 0x020e "Board 4", 0x020e
}, },
{ {
"" ""
} }
}, },
}, },
{ {
"", "", -1 "", "", -1
} }
}; };
static const device_t ems5150_device = { static const device_t ems5150_device = {
@@ -778,6 +821,7 @@ static const device_t ems5150_device = {
ems5150_config ems5150_config
}; };
static const device_config_t ev159_config[] = static const device_config_t ev159_config[] =
{ {
{ {
@@ -987,17 +1031,25 @@ static const device_t isamem_rampage_device = {
static const struct { static const struct {
const char *name;
const char *internal_name; const char *internal_name;
const device_t *dev; const device_t *dev;
} boards[] = { } boards[] = {
{ "None", "none", NULL, }, { "none", NULL },
{ "IBM PC/XT Memory Expansion", "ibmxt", &ibmxt_device, }, { "ibmxt", &ibmxt_device },
{ "IBM PC/AT Memory Expansion", "ibmat", &ibmat_device, }, { "ibmat", &ibmat_device },
{ "Micro Mainframe EMS-5150(T)", "ems5150", &ems5150_device }, { "p5pak", &p5pak_device },
{ "Paradise Systems 5-PAK", "p5pak", &p5pak_device }, { "ems5150", &ems5150_device },
{ "Everex EV-159 RAM 3000 Deluxe", "ev159", &ev159_device, }, { "ev159", &ev159_device },
{ "", "", NULL, }, #ifdef USE_ISAMEM_BRAT
{ "brat", &brat_device },
#endif
#ifdef USE_ISAMEM_RAMPAGE
{ "rampage", &rampage_device },
#endif
#ifdef USE_ISAMEM_IAB
{ "iab", &iab_device },
#endif
{ NULL, NULL }
}; };
@@ -1013,35 +1065,40 @@ isamem_reset(void)
/* Clone the device. */ /* Clone the device. */
dev = device_clone(boards[k].dev); dev = device_clone(boards[k].dev);
/* Store the device instance. */
instance[i] = dev;
/* Add the instance to the system. */ /* Add the instance to the system. */
device_add(dev); device_add(dev);
} }
} }
char * const char *
isamem_get_name(int board) isamem_get_name(int board)
{ {
return((char *)boards[board].name); if (boards[board].dev == NULL) return(NULL);
return(boards[board].dev->name);
} }
char * const char *
isamem_get_internal_name(int board) isamem_get_internal_name(int board)
{ {
return((char *)boards[board].internal_name); return(boards[board].internal_name);
} }
int int
isamem_get_from_internal_name(char *s) isamem_get_from_internal_name(const char *s)
{ {
int c = 0; int c = 0;
while (strlen((char *) boards[c].internal_name)) { while (boards[c].internal_name != NULL) {
if (!strcmp((char *)boards[c].internal_name, s)) if (! strcmp(boards[c].internal_name, s))
return(c); return(c);
c++; c++;
} }
@@ -1054,5 +1111,5 @@ isamem_get_from_internal_name(char *s)
const device_t * const device_t *
isamem_get_device(int board) isamem_get_device(int board)
{ {
return(boards[board].dev); return(instance[board]);
} }

View File

@@ -64,9 +64,9 @@ extern const device_t isamem_ev159_device;
/* Functions. */ /* Functions. */
extern void isamem_reset(void); extern void isamem_reset(void);
extern char *isamem_get_name(int t); extern const char *isamem_get_name(int t);
extern char *isamem_get_internal_name(int t); extern const char *isamem_get_internal_name(int t);
extern int isamem_get_from_internal_name(char *s); extern int isamem_get_from_internal_name(const char *s);
extern const device_t *isamem_get_device(int t); extern const device_t *isamem_get_device(int t);
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -10,7 +10,7 @@
* *
* NOTE: FIXME: Strings 2176 and 2193 are same. * NOTE: FIXME: Strings 2176 and 2193 are same.
* *
* Version: @(#)language.h 1.0.8 2018/05/25 * Version: @(#)language.h 1.0.9 2018/09/06
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -92,6 +92,7 @@
#define IDS_2116 2116 // "%u MB (CHS: %i, %i, %i)" #define IDS_2116 2116 // "%u MB (CHS: %i, %i, %i)"
#define IDS_2117 2117 // "Floppy %i (%s): %ls" #define IDS_2117 2117 // "Floppy %i (%s): %ls"
#define IDS_2118 2118 // "All floppy images (*.0??;*.." #define IDS_2118 2118 // "All floppy images (*.0??;*.."
#define IDS_2119 2119 // "You must save the settings.."
#define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i" #define IDS_4097 4097 // "%01i:%01i"
@@ -170,7 +171,7 @@
#define IDS_LANG_ENUS IDS_7168 #define IDS_LANG_ENUS IDS_7168
#define STR_NUM_2048 71 #define STR_NUM_2048 72
#define STR_NUM_3072 11 #define STR_NUM_3072 11
#define STR_NUM_4096 18 #define STR_NUM_4096 18
#define STR_NUM_4352 7 #define STR_NUM_4352 7

View File

@@ -258,7 +258,7 @@ void* fluidsynth_init(const device_t *info)
data->synth = f_new_fluid_synth(data->settings); data->synth = f_new_fluid_synth(data->settings);
char* sound_font = device_get_config_string("sound_font"); char* sound_font = (char *) device_get_config_string("sound_font");
data->sound_font = f_fluid_synth_sfload(data->synth, sound_font, 1); data->sound_font = f_fluid_synth_sfload(data->synth, sound_font, 1);
if (device_get_config_int("chorus")) if (device_get_config_int("chorus"))

View File

@@ -1,4 +1,4 @@
/* /*
* 86Box A hypervisor and IBM PC system emulator that specializes in * 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM * running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent * PC systems and compatibles from 1981 through fairly recent
@@ -8,7 +8,7 @@
* *
* Application resource script for Windows. * Application resource script for Windows.
* *
* Version: @(#)86Box.rc 1.0.41 2018/09/02 * Version: @(#)86Box.rc 1.0.42 2018/09/06
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -888,6 +888,7 @@ BEGIN
IDS_2116 "%u MB (CHS: %i, %i, %i)" IDS_2116 "%u MB (CHS: %i, %i, %i)"
IDS_2117 "Floppy %i (%s): %ls" IDS_2117 "Floppy %i (%s): %ls"
IDS_2118 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0" IDS_2118 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.DDI;*.DSK;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F)\0*.86F\0All files (*.*)\0*.*\0"
IDS_2119 "You must save the settings first before attempting to configure the memory boards"
END END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE

View File

@@ -8,7 +8,7 @@
* *
* Windows 86Box Settings dialog handler. * Windows 86Box Settings dialog handler.
* *
* Version: @(#)win_settings.c 1.0.55 2018/09/03 * Version: @(#)win_settings.c 1.0.56 2018/09/06
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* David Hrdlička, <hrdlickadavid@outlook.com> * David Hrdlička, <hrdlickadavid@outlook.com>
@@ -1493,6 +1493,8 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
int c, d, e, temp_hdc_type; int c, d, e, temp_hdc_type;
LPTSTR lptsTemp; LPTSTR lptsTemp;
const device_t *scsi_dev; const device_t *scsi_dev;
const device_t *dev;
char *s;
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
@@ -1563,7 +1565,7 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
e = 0; e = 0;
h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); h = GetDlgItem(hdlg, IDC_COMBO_ISARTC);
for (d = 0; ; d++) { for (d = 0; ; d++) {
char *s = isartc_get_name(d); s = isartc_get_name(d);
if (!s[0]) if (!s[0])
break; break;
@@ -1589,26 +1591,21 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
/* Populate the ISA memory card dropdowns. */ /* Populate the ISA memory card dropdowns. */
for (c = 0; c < ISAMEM_MAX; c++) { for (c = 0; c < ISAMEM_MAX; c++) {
e = 0;
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1 + c); h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1 + c);
for (d = 0; ; d++) { for (d = 0; ; d++) {
char *s = isamem_get_name(d); s = (char *) isamem_get_internal_name(d);
if (s == NULL)
if (!s[0])
break; break;
settings_device_to_list[2 + c][d] = e;
if (d == 0) { if (d == 0) {
/* Translate "None". */ /* Translate "None". */
SendMessage(h, CB_ADDSTRING, 0, win_get_string(IDS_2112)); SendMessage(h, CB_ADDSTRING, 0,
(LPARAM)win_get_string(IDS_2112));
} else { } else {
s = (char *) isamem_get_name(d);
mbstowcs(lptsTemp, s, strlen(s) + 1); mbstowcs(lptsTemp, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); SendMessage(h, CB_ADDSTRING, 0, (LPARAM)lptsTemp);
} }
settings_list_to_device[2 + c][e] = d;
e++;
} }
SendMessage(h, CB_SETCURSEL, temp_isamem[c], 0); SendMessage(h, CB_SETCURSEL, temp_isamem[c], 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1 + c); h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1 + c);
@@ -1617,7 +1614,7 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
else else
EnableWindow(h, FALSE); EnableWindow(h, FALSE);
} }
free(lptsTemp); free(lptsTemp);
return TRUE; return TRUE;
@@ -1675,76 +1672,31 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
EnableWindow(h, FALSE); EnableWindow(h, FALSE);
break; break;
case IDC_CONFIGURE_ISAMEM_1:
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1);
temp_isamem[0] = settings_list_to_device[2][SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isamem_get_device(temp_isamem[0]));
break;
case IDC_CONFIGURE_ISAMEM_2:
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_2);
temp_isamem[1] = settings_list_to_device[3][SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isamem_get_device(temp_isamem[1]));
break;
case IDC_CONFIGURE_ISAMEM_3:
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_3);
temp_isamem[2] = settings_list_to_device[4][SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isamem_get_device(temp_isamem[2]));
break;
case IDC_CONFIGURE_ISAMEM_4:
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_4);
temp_isamem[3] = settings_list_to_device[5][SendMessage(h, CB_GETCURSEL, 0, 0)];
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)isamem_get_device(temp_isamem[3]));
break;
case IDC_COMBO_ISAMEM_1: case IDC_COMBO_ISAMEM_1:
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1);
temp_isamem[0] = settings_list_to_device[2][SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1);
if (temp_isamem[0] != 0)
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
break;
case IDC_COMBO_ISAMEM_2: case IDC_COMBO_ISAMEM_2:
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_2);
temp_isamem[1] = settings_list_to_device[3][SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_2);
if (temp_isamem[1] != 0)
EnableWindow(h, TRUE);
else
EnableWindow(h, FALSE);
break;
case IDC_COMBO_ISAMEM_3: case IDC_COMBO_ISAMEM_3:
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_3); case IDC_COMBO_ISAMEM_4:
temp_isamem[2] = settings_list_to_device[4][SendMessage(h, CB_GETCURSEL, 0, 0)]; c = LOWORD(wParam) - IDC_COMBO_ISAMEM_1;
h = GetDlgItem(hdlg, LOWORD(wParam));
temp_isamem[c] = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_3); h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_1 + c);
if (temp_isamem[2] != 0) if (temp_isamem[c] != 0)
EnableWindow(h, TRUE); EnableWindow(h, TRUE);
else else
EnableWindow(h, FALSE); EnableWindow(h, FALSE);
break; break;
case IDC_COMBO_ISAMEM_4: case IDC_CONFIGURE_ISAMEM_1:
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_4); case IDC_CONFIGURE_ISAMEM_2:
temp_isamem[3] = settings_list_to_device[5][SendMessage(h, CB_GETCURSEL, 0, 0)]; case IDC_CONFIGURE_ISAMEM_3:
case IDC_CONFIGURE_ISAMEM_4:
h = GetDlgItem(hdlg, IDC_CONFIGURE_ISAMEM_4); c = LOWORD(wParam) - IDC_CONFIGURE_ISAMEM_1;
if (temp_isamem[3] != 0) dev = isamem_get_device(c);
EnableWindow(h, TRUE); if (dev != NULL)
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)dev);
else else
EnableWindow(h, FALSE); ui_msgbox(MBX_INFO, (wchar_t *)IDS_2119);
break; break;
case IDC_CHECK_IDE_TER: case IDC_CHECK_IDE_TER:
@@ -1787,11 +1739,6 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
h = GetDlgItem(hdlg, IDC_COMBO_ISARTC); h = GetDlgItem(hdlg, IDC_COMBO_ISARTC);
temp_isartc = settings_list_to_device[1][SendMessage(h, CB_GETCURSEL, 0, 0)]; temp_isartc = settings_list_to_device[1][SendMessage(h, CB_GETCURSEL, 0, 0)];
for (e = 0; e < ISAMEM_MAX; e++) {
h = GetDlgItem(hdlg, IDC_COMBO_ISAMEM_1 + e);
temp_isamem[e] = settings_list_to_device[2 + e][SendMessage(h, CB_GETCURSEL, 0, 0)];
}
h = GetDlgItem(hdlg, IDC_CHECK_IDE_TER); h = GetDlgItem(hdlg, IDC_CHECK_IDE_TER);
temp_ide_ter = SendMessage(h, BM_GETCHECK, 0, 0); temp_ide_ter = SendMessage(h, BM_GETCHECK, 0, 0);