From 3258ed67f94985096d0301b542c546e16255b8ad Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 7 Jun 2024 01:37:51 -0400 Subject: [PATCH 1/4] 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. */ From e290347433fb2dc0963f4f081f191e98e12b1996 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 7 Jun 2024 01:38:32 -0400 Subject: [PATCH 2/4] Remove needless parens --- src/device/isamem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/isamem.c b/src/device/isamem.c index 99e6e51b6..1f071388c 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -560,7 +560,7 @@ isamem_init(const device_t *info) if (!!device_get_config_int("start")) dev->start_addr = device_get_config_int("start"); dev->frame_addr[0] = device_get_config_hex20("frame"); - dev->flags |= (FLAG_EMS); + dev->flags |= FLAG_EMS; if (!!device_get_config_int("width")) dev->flags |= FLAG_WIDE; if (!!device_get_config_int("speed")) From 0f5fd9fbd0f8b20310b25c96070cde40cccfae5d Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 7 Jun 2024 02:08:28 -0400 Subject: [PATCH 3/4] Fixed EV159's max ram and remove flag kludge --- src/device/isamem.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/device/isamem.c b/src/device/isamem.c index 1f071388c..7f01f2c4d 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -110,6 +110,7 @@ #define RAM_EXTMEM (1024 << 10) /* start of high memory */ #define EMS_MAXSIZE (2048 << 10) /* max EMS memory size */ +#define EMS_EV159_MAXSIZE (3072 << 10) /* max EMS memory size for lotech cards */ #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 */ @@ -144,7 +145,6 @@ 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 */ @@ -567,9 +567,8 @@ isamem_init(const device_t *info) dev->flags |= FLAG_FAST; break; - case ISAMEM_LOTECH_CARD: /* Lotech EMS */ - dev->flags |= FLAG_LOTECH; case ISAMEM_BRXT_CARD: /* BocaRAM/XT */ + case ISAMEM_LOTECH_CARD: /* Lotech EMS */ dev->base_addr[0] = device_get_config_hex16("base"); dev->total_size = device_get_config_int("size"); dev->start_addr = 0; @@ -725,12 +724,14 @@ isamem_init(const device_t *info) /* If EMS is enabled, use the remainder for EMS. */ if (dev->flags & FLAG_EMS) { - /* EMS 3.2 cannot have more than 4096KB per board. */ t = k; - if ((dev->flags & FLAG_LOTECH) && (t > EMS_LOTECH_MAXSIZE)) + if ((dev->board == ISAMEM_LOTECH_CARD) && (t > EMS_LOTECH_MAXSIZE)) /* Lotech EMS cannot have more than 4096KB per board. */ t = EMS_LOTECH_MAXSIZE; + else if ((dev->board == ISAMEM_EV159_CARD) && (t > EMS_EV159_MAXSIZE)) + t = EMS_EV159_MAXSIZE; else if (t > EMS_MAXSIZE) + /* EMS 3.2 cannot have more than 4096KB per board. */ t = EMS_MAXSIZE; /* Set up where EMS begins in local RAM, and how much we have. */ From 603fdb0331252213c2f1ed2e71967fa077c1fb11 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 7 Jun 2024 02:33:21 -0400 Subject: [PATCH 4/4] Fix various comments in isamem.c --- src/device/isamem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/device/isamem.c b/src/device/isamem.c index 7f01f2c4d..e4a37b8a3 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -110,7 +110,7 @@ #define RAM_EXTMEM (1024 << 10) /* start of high memory */ #define EMS_MAXSIZE (2048 << 10) /* max EMS memory size */ -#define EMS_EV159_MAXSIZE (3072 << 10) /* max EMS memory size for lotech cards */ +#define EMS_EV159_MAXSIZE (3072 << 10) /* max EMS memory size for EV-159 cards */ #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 */ @@ -726,12 +726,13 @@ isamem_init(const device_t *info) if (dev->flags & FLAG_EMS) { t = k; if ((dev->board == ISAMEM_LOTECH_CARD) && (t > EMS_LOTECH_MAXSIZE)) - /* Lotech EMS cannot have more than 4096KB per board. */ + /* The Lotech EMS cannot have more than 4096KB per board. */ t = EMS_LOTECH_MAXSIZE; else if ((dev->board == ISAMEM_EV159_CARD) && (t > EMS_EV159_MAXSIZE)) + /* The EV-159 cannot have more than 3072KB per board. */ t = EMS_EV159_MAXSIZE; else if (t > EMS_MAXSIZE) - /* EMS 3.2 cannot have more than 4096KB per board. */ + /* EMS 3.2 cannot have more than 2048KB per board. */ t = EMS_MAXSIZE; /* Set up where EMS begins in local RAM, and how much we have. */