From 3258ed67f94985096d0301b542c546e16255b8ad Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 7 Jun 2024 01:37:51 -0400 Subject: [PATCH] Improve lotech EMS --- src/device/isamem.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/device/isamem.c b/src/device/isamem.c index 63f8955f1..99e6e51b6 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -109,7 +109,8 @@ #define RAM_UMAMEM (384 << 10) /* upper memory block */ #define RAM_EXTMEM (1024 << 10) /* start of high memory */ -#define EMS_MAXSIZE (4096 << 10) /* max EMS memory size */ +#define EMS_MAXSIZE (2048 << 10) /* max EMS memory size */ +#define EMS_LOTECH_MAXSIZE (4096 << 10) /* max EMS memory size for lotech cards */ #define EMS_PGSIZE (16 << 10) /* one page is this big */ #define EMS_MAXPAGE 4 /* number of viewport pages */ @@ -143,6 +144,7 @@ typedef struct memdev_t { uint8_t flags; #define FLAG_CONFIG 0x01 /* card is configured */ +#define FLAG_LOTECH 0x02 /* Lotech EMS supports upto 4MB with a hack */ #define FLAG_WIDE 0x10 /* card uses 16b mode */ #define FLAG_FAST 0x20 /* fast (<= 120ns) chips */ #define FLAG_EMS 0x40 /* card has EMS mode enabled */ @@ -565,8 +567,9 @@ isamem_init(const device_t *info) dev->flags |= FLAG_FAST; break; - case ISAMEM_BRXT_CARD: /* BocaRAM/XT */ - case ISAMEM_LOTECH_CARD: + case ISAMEM_LOTECH_CARD: /* Lotech EMS */ + dev->flags |= FLAG_LOTECH; + case ISAMEM_BRXT_CARD: /* BocaRAM/XT */ dev->base_addr[0] = device_get_config_hex16("base"); dev->total_size = device_get_config_int("size"); dev->start_addr = 0; @@ -724,7 +727,10 @@ isamem_init(const device_t *info) if (dev->flags & FLAG_EMS) { /* EMS 3.2 cannot have more than 4096KB per board. */ t = k; - if (t > EMS_MAXSIZE) + if ((dev->flags & FLAG_LOTECH) && (t > EMS_LOTECH_MAXSIZE)) + /* Lotech EMS cannot have more than 4096KB per board. */ + t = EMS_LOTECH_MAXSIZE; + else if (t > EMS_MAXSIZE) t = EMS_MAXSIZE; /* Set up where EMS begins in local RAM, and how much we have. */