more Multitech PC-500/500+ modifies (#6298)

* add DTK PIM-TB10-Z BIOS 2.39

* change Multitech PC-500/PC500+ KBC type to XTClone

* 1. add ISA RTC century field to support Multitech onboard RTC
2. hard-coded I/O port and IRQ for Multitech onboard RTC until
   find a prorper way to obtain correct value from machine config
This commit is contained in:
bozoscum
2025-10-08 21:39:40 +08:00
committed by GitHub
parent 7d4c1d831d
commit 151e0bdd16
4 changed files with 100 additions and 57 deletions

View File

@@ -113,7 +113,8 @@ typedef struct rtcdev_t {
void (*f_wr)(uint16_t, uint8_t, void *);
uint8_t (*f_rd)(uint16_t, void *);
int8_t year; /* register for YEAR value */
char pad[3];
int8_t century; /* register for CENTURY value */
char pad[2];
nvr_t nvr; /* RTC/NVR */
} rtcdev_t;
@@ -319,9 +320,14 @@ mm67_time_get(nvr_t *nvr, struct tm *tm)
tm->tm_year = regs[dev->year];
if (dev->flags & FLAG_YEAR80)
tm->tm_year += 80;
#ifdef MM67_CENTURY
tm->tm_year += (regs[MM67_CENTURY] * 100) - 1900;
#endif
if ((dev->century != -1) && !(dev->flags & FLAG_YEAR80)) {
if (dev->flags & FLAG_YEARBCD)
tm->tm_year += (RTC_DCB(regs[dev->century]) * 100) - 1900;
else
tm->tm_year += (regs[dev->century] * 100) - 1900;
}
#if ISARTC_DEBUG > 1
isartc_log("ISARTC: get_time: year=%i [%02x]\n", tm->tm_year, regs[dev->year]);
#endif
@@ -351,9 +357,14 @@ mm67_time_set(nvr_t *nvr, struct tm *tm)
regs[dev->year] = RTC_BCD(year % 100);
else
regs[dev->year] = year % 100;
#ifdef MM67_CENTURY
regs[MM67_CENTURY] = (year + 1900) / 100;
#endif
if ((dev->year != -1) && !(dev->flags & FLAG_YEAR80)) {
if (dev->flags & FLAG_YEARBCD)
regs[dev->century] = RTC_BCD((year + 1900) / 100);
else
regs[dev->century] = (year + 1900) / 100;
}
#if ISARTC_DEBUG > 1
isartc_log("ISARTC: set_time: [%02x] year=%i (%i)\n", regs[dev->year], year, tm->tm_year);
#endif
@@ -474,9 +485,13 @@ mm67_write(uint16_t port, uint8_t val, void *priv)
dev->nvr.regs[dev->year] = RTC_BCD(val);
else
dev->nvr.regs[dev->year] = val;
#ifdef MM67_CENTURY
dev->nvr.regs[MM67_CENTURY] = 19;
#endif
if ((dev->century != -1) && !(dev->flags & FLAG_YEAR80)) {
if (dev->flags & FLAG_YEARBCD)
dev->nvr.regs[dev->century] = RTC_BCD(19);
else
dev->nvr.regs[dev->century] = (1900 + val) / 100;
}
}
}
break;
@@ -597,6 +612,7 @@ isartc_init(const device_t *info)
dev->board = info->local;
dev->irq = -1;
dev->year = -1;
dev->century = -1;
dev->nvr.data = dev;
dev->nvr.size = 16;
@@ -664,15 +680,18 @@ isartc_init(const device_t *info)
case ISARTC_RTC58167: /* Multitech PC-500/PC-500+ onboard RTC */
dev->flags |= FLAG_YEARBCD;
dev->base_addr = device_get_config_hex16("base");
//dev->base_addr = machine_get_config_int("rtc_port");
dev->base_addr = 0x2c0;
dev->base_addrsz = 8;
dev->irq = device_get_config_int("irq");
//dev->irq = machine_get_config_int("rtc_irq");
dev->irq = -1;
dev->f_rd = rtc58167_read;
dev->f_wr = rtc58167_write;
dev->nvr.reset = mm67_reset;
dev->nvr.start = mm67_start;
dev->nvr.tick = mm67_tick;
dev->year = MM67_AL_HUNTEN; /* year, NON STANDARD */
dev->year = MM67_AL_HUNTEN; /* year, NON STANDARD */
dev->century = MM67_AL_SEC; /* century, NON STANDARD */
break;
default:
@@ -1010,42 +1029,6 @@ const device_t vendex_xt_rtc_onboard_device = {
.config = NULL
};
static const device_config_t rtc58167_config[] = {
// clang-format off
{
.name = "irq",
.description = "IRQ2",
.type = CONFIG_SELECTION,
.default_string = NULL,
.default_int = -1,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "Disabled", .value = -1 },
{ .description = "Enabled", .value = 2 },
{ .description = "" }
},
.bios = { { 0 } }
},
{
.name = "base",
.description = "Address",
.type = CONFIG_HEX16,
.default_string = NULL,
.default_int = 0x2C0,
.file_filter = NULL,
.spinner = { 0 },
.selection = {
{ .description = "2C0H", .value = 0x2c0 },
{ .description = "300H", .value = 0x300 },
{ .description = "" }
},
.bios = { { 0 } }
},
{ .name = "", .description = "", .type = CONFIG_END}
// clang-format on
};
const device_t rtc58167_device = {
.name = "RTC 58167 IC (Multitech)",
.internal_name = "rtc58167_xt_rtc",
@@ -1057,7 +1040,7 @@ const device_t rtc58167_device = {
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = rtc58167_config
.config = NULL
};
static const struct {
@@ -1070,7 +1053,6 @@ static const struct {
{ &p5pak_device },
{ &a6pak_device },
{ &mplus2_device },
//{ &rtc58167_device }, /* Multitech onboard ISA RTC */
{ &mm58167_device },
{ NULL }
// clang-format on

View File

@@ -1347,6 +1347,9 @@ extern int machine_xt_ataripc3_init(const machine_t *);
extern int machine_xt_bw230_init(const machine_t *);
extern int machine_xt_mpc1600_init(const machine_t *);
extern int machine_xt_compaq_portable_init(const machine_t *);
#ifdef EMU_DEVICE_H
extern const device_t dtk_device;
#endif
extern int machine_xt_dtk_init(const machine_t *);
extern int machine_xt_pcspirit_init(const machine_t *);
extern int machine_genxt_init(const machine_t *);

View File

@@ -896,13 +896,71 @@ machine_xt_compaq_portable_init(const machine_t *model)
return ret;
}
static const device_config_t dtk_config[] = {
// clang-format off
{
.name = "bios",
.description = "BIOS Version",
.type = CONFIG_BIOS,
.default_string = "dtk_242",
.default_int = 0,
.file_filter = NULL,
.spinner = { 0 },
.selection = { { 0 } },
.bios = {
{
.name = "2.39",
.internal_name = "dtk_239",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 8192,
.files = { "roms/machines/dtk/PIM-TB10-Z.BIN", ""}
},
{
.name = "2.42",
.internal_name = "dtk_242",
.bios_type = BIOS_NORMAL,
.files_no = 1,
.local = 0,
.size = 8192,
.files = { "roms/machines/dtk/dtk_erso_2.42_2764.bin", ""}
},
{ .files_no = 0 }
}
},
{ .name = "", .description = "", .type = CONFIG_END }
// clang-format on
};
const device_t dtk_device = {
.name = "DTK PIM-TB10-Z",
.internal_name = "dtk_device",
.flags = 0,
.local = 0,
.init = NULL,
.close = NULL,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = dtk_config
};
int
machine_xt_dtk_init(const machine_t *model)
{
int ret;
int ret = 0;
const char *fn;
ret = bios_load_linear("roms/machines/dtk/dtk_erso_2.42_2764.bin",
0x000fe000, 8192, 0);
/* No ROMs available. */
if (!device_available(model->device))
return ret;
device_context(model->device);
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
ret = bios_load_linear(fn, 0x000fe000, 8192, 0);
device_context_restore();
if (bios_only || !ret)
return ret;
@@ -1252,7 +1310,7 @@ machine_xt_pc500_init(const machine_t *model)
if (bios_only || !ret)
return ret;
device_add(&kbc_pc_device);
device_add(&kbc_xtclone_device);
machine_xt_common_init(model, 0);
@@ -1371,7 +1429,7 @@ machine_xt_pc500plus_init(const machine_t *model)
if (bios_only || !ret)
return ret;
device_add(&kbc_pc_device);
device_add(&kbc_xtclone_device);
machine_xt_common_init(model, 0);

View File

@@ -701,7 +701,7 @@ const machine_t machines[] = {
.kbc_p1 = 0xff,
.gpio = 0xffffffff,
.gpio_acpi = 0xffffffff,
.device = NULL,
.device = &dtk_device,
.kbd_device = &keyboard_pc_xt_device,
.fdc_device = NULL,
.sio_device = NULL,