From bb2638e0afd670d1bcf4a1041ddf6fa45ff62189 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 5 May 2024 23:06:35 -0400 Subject: [PATCH] Add AST MegaPlus II --- src/device/isamem.c | 51 +++++++++++++++++++++++++++++++++++++++++++++ src/device/isartc.c | 43 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 92 insertions(+), 2 deletions(-) diff --git a/src/device/isamem.c b/src/device/isamem.c index af172d54d..1e2e92470 100644 --- a/src/device/isamem.c +++ b/src/device/isamem.c @@ -107,6 +107,7 @@ #define ISAMEM_BRAT_CARD 14 #define ISAMEM_EV165A_CARD 15 #define ISAMEM_LOTECH_EMS_CARD 16 +#define ISAMEM_MPLUS2_CARD 17 #define ISAMEM_DEBUG 0 @@ -495,6 +496,7 @@ isamem_init(const device_t *info) case ISAMEM_SYSTEMCARD_CARD: /* Microsoft SystemCard */ case ISAMEM_P5PAK_CARD: /* Paradise Systems 5-PAK */ case ISAMEM_A6PAK_CARD: /* AST SixPakPlus */ + case ISAMEM_MPLUS2_CARD: /* AST MegaPlus II */ dev->total_size = device_get_config_int("size"); dev->start_addr = device_get_config_int("start"); tot = dev->total_size; @@ -2094,6 +2096,54 @@ static const device_t iab_device = { }; #endif /* USE_ISAMEM_IAB */ +static const device_config_t mplus2_config[] = { + // clang-format off + { + .name = "size", + .description = "Memory Size", + .type = CONFIG_SPINNER, + .default_string = "", + .default_int = 64, + .file_filter = "", + .spinner = { + .min = 0, + .max = 512, + .step = 64 + }, + .selection = { { 0 } } + }, + { + .name = "start", + .description = "Start Address", + .type = CONFIG_SPINNER, + .default_string = "", + .default_int = 256, + .file_filter = "", + .spinner = { + .min = 64, + .max = 576, + .step = 64 + }, + .selection = { { 0 } } + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +static const device_t mplus2_device = { + .name = "AST MegaPlus II", + .internal_name = "mplus2", + .flags = DEVICE_ISA, + .local = ISAMEM_MPLUS2_CARD, + .init = isamem_init, + .close = isamem_close, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mplus2_config +}; + static const struct { const device_t *dev; } boards[] = { @@ -2127,6 +2177,7 @@ static const struct { { &iab_device }, #endif /* USE_ISAMEM_IAB */ { &lotech_ems_device }, + { &mplus2_device }, { NULL } // clang-format on }; diff --git a/src/device/isartc.c b/src/device/isartc.c index 79dbeca0b..2eaf4c5bd 100644 --- a/src/device/isartc.c +++ b/src/device/isartc.c @@ -89,6 +89,7 @@ #define ISARTC_P5PAK 2 #define ISARTC_A6PAK 3 #define ISARTC_VENDEX 4 +#define ISARTC_MPLUS2 5 #define ISARTC_MM58167 10 #define ISARTC_ROM_MM58167_1 "roms/rtc/glatick/GLaTICK_0.8.5_NS_RP.ROM" @@ -563,8 +564,9 @@ isartc_init(const device_t *info) dev->year = MM67_AL_HUNTEN; /* year, NON STANDARD */ break; - case ISARTC_P5PAK: /* Paradise Systems 5PAK */ - case ISARTC_A6PAK: /* AST SixPakPlus */ + case ISARTC_P5PAK: /* Paradise Systems 5PAK */ + case ISARTC_A6PAK: /* AST SixPakPlus */ + case ISARTC_MPLUS2: /* AST MegaPlus II */ dev->flags |= FLAG_YEAR80; dev->base_addr = 0x02c0; dev->base_addrsz = 32; @@ -786,6 +788,42 @@ static const device_t a6pak_device = { .config = a6pak_config }; +static const device_config_t mplus2_config[] = { + // clang-format off + { + .name = "irq", + .description = "IRQ", + .type = CONFIG_SELECTION, + .default_string = "", + .default_int = -1, + .file_filter = "", + .spinner = { 0 }, + .selection = { + { "Disabled", -1 }, + { "IRQ2", 2 }, + { "IRQ3", 3 }, + { "IRQ5", 5 }, + { "" } + }, + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +static const device_t mplus2_device = { + .name = "AST MegaPlus II", + .internal_name = "mplus2", + .flags = DEVICE_ISA, + .local = ISARTC_MPLUS2, + .init = isartc_init, + .close = isartc_close, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = mplus2_config +}; + static const device_config_t mm58167_config[] = { // clang-format off { @@ -897,6 +935,7 @@ static const struct { { &pii147_device }, { &p5pak_device }, { &a6pak_device }, + { &mplus2_device }, { &mm58167_device }, { NULL } // clang-format on