Ported the ISA RTC and Memory expansion cards from VARCem's.
Bunch of improvements in the device, memory and MMU handling. Re-worked the NEAT 286 chipset (ported from VARCem). Re-worked the ATI 28800 a bit, added Sierra SC1502x ramdac to VGA Wonder XL (Compaq) since it supports such. Top 384K memory handling improvements (256K top memory too) Added MCA version of MPU-401 (not tested much, however). Re-worked the SCAT 286 chipset.
This commit is contained in:
63
src/device.c
63
src/device.c
@@ -9,7 +9,7 @@
|
||||
* Implementation of the generic device interface to handle
|
||||
* all devices attached to the emulator.
|
||||
*
|
||||
* Version: @(#)device.c 1.0.8 2018/04/29
|
||||
* Version: @(#)device.c 1.0.9 2018/09/02
|
||||
*
|
||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
@@ -39,6 +39,7 @@
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
@@ -54,9 +55,17 @@
|
||||
#define DEVICE_MAX 256 /* max # of devices */
|
||||
|
||||
|
||||
static void *device_priv[DEVICE_MAX];
|
||||
static device_t *devices[DEVICE_MAX];
|
||||
static device_t *device_current;
|
||||
typedef struct clonedev {
|
||||
const device_t *master;
|
||||
int count;
|
||||
struct clonedev *next;
|
||||
} clonedev_t;
|
||||
|
||||
|
||||
static device_t *devices[DEVICE_MAX];
|
||||
static void *device_priv[DEVICE_MAX];
|
||||
static device_t *device_current;
|
||||
static clonedev_t *clones;
|
||||
|
||||
|
||||
#ifdef ENABLE_DEVICE_LOG
|
||||
@@ -78,7 +87,7 @@ device_log(const char *format, ...)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the module for use. */
|
||||
void
|
||||
device_init(void)
|
||||
{
|
||||
@@ -86,6 +95,50 @@ device_init(void)
|
||||
}
|
||||
|
||||
|
||||
/* Clone a master device for multi-instance devices. */
|
||||
const device_t *
|
||||
device_clone(const device_t *master)
|
||||
{
|
||||
char temp[1024], *sp;
|
||||
clonedev_t *cl, *ptr;
|
||||
device_t *dev;
|
||||
|
||||
/* Look up the master. */
|
||||
for (ptr = clones; ptr != NULL; ptr = ptr->next)
|
||||
if (ptr->master == master) break;
|
||||
|
||||
/* If not found, add this master to the list. */
|
||||
if (ptr == NULL) {
|
||||
ptr = (clonedev_t *)malloc(sizeof(clonedev_t));
|
||||
memset(ptr, 0x00, sizeof(clonedev_t));
|
||||
if (clones != NULL) {
|
||||
for (cl = clones; cl->next != NULL; cl = cl->next)
|
||||
;
|
||||
cl->next = ptr;
|
||||
} else
|
||||
clones = ptr;
|
||||
ptr->master = master;
|
||||
}
|
||||
|
||||
/* Create a new device. */
|
||||
dev = (device_t *)malloc(sizeof(device_t));
|
||||
|
||||
/* Copy the master info. */
|
||||
memcpy(dev, ptr->master, sizeof(device_t));
|
||||
|
||||
/* Set up a clone. */
|
||||
if (++ptr->count > 1)
|
||||
sprintf(temp, "%s #%i", ptr->master->name, ptr->count);
|
||||
else
|
||||
strcpy(temp, ptr->master->name);
|
||||
sp = (char *)malloc(strlen(temp) + 1);
|
||||
strcpy(sp, temp);
|
||||
dev->name = (const char *)sp;
|
||||
|
||||
return((const device_t *)dev);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
device_add(const device_t *d)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user