diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 628e388e8..11992f764 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -1446,6 +1446,10 @@ extern int machine_xt_pb8810_init(const machine_t *); extern int machine_xt_sansx16_init(const machine_t *); extern int machine_xt_pcxt_init(const machine_t *); #ifdef EMU_DEVICE_H +extern const device_t to16_device; +#endif +extern int machine_xt_to16_init(const machine_t *); +#ifdef EMU_DEVICE_H extern const device_t vendex_device; #endif extern int machine_xt_vendex_init(const machine_t *); diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index 007e8c7c4..f0b5d37a6 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -1704,6 +1704,106 @@ machine_xt_pcxt_init(const machine_t *model) return ret; } +static const device_config_t to16_config[] = { + // clang-format off + { + .name = "bios", + .description = "BIOS Version", + .type = CONFIG_BIOS, + .default_string = "to16", + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .bios = { + { + .name = "1.03", + .internal_name = "to16", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 32768, + .files = { "roms/machines/to16/TO16_103.bin", "" } + }, + { .files_no = 0 } + }, + }, + { + .name = "rtc_port", + .description = "Onboard RTC", + .type = CONFIG_SELECTION, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { + { .description = "Uninstalled", .value = 0 }, + { .description = "RTC0", .value = 0x300 }, + { .description = "RTC1", .value = 0x2c0 }, + { .description = "" } + }, + .bios = { { 0 } } + }, + { + .name = "rtc_irq", + .description = "RTC 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 = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t to16_device = { + .name = "Thomson TO16", + .internal_name = "to16_device", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = to16_config +}; + +int +machine_xt_to16_init(const machine_t *model) +{ + int ret = 0; + int rtc_port = 0; + const char *fn; + + /* No ROMs available. */ + if (!device_available(model->device)) + return ret; + + device_context(model->device); + rtc_port = machine_get_config_int("rtc_port"); + fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0); + ret = bios_load_linear(fn, 0x000f8000, 32768, 0); + device_context_restore(); + + if (bios_only || !ret) + return ret; + + machine_xt_clone_init(model, 0); + + if (rtc_port != 0) + device_add(&rtc58167_device); + + return ret; +} + static const device_config_t vendex_config[] = { // clang-format off { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index bd68734c7..72806d9d8 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -1784,6 +1784,49 @@ const machine_t machines[] = { .snd_device = NULL, .net_device = NULL }, + { + .name = "[8088] Thomson TO16", + .internal_name = "to16", + .type = MACHINE_TYPE_8088, + .chipset = MACHINE_CHIPSET_DISCRETE, + .init = machine_xt_to16_init, + .p1_handler = NULL, + .gpio_handler = NULL, + .available_flag = MACHINE_AVAILABLE, + .gpio_acpi_handler = NULL, + .cpu = { + .package = CPU_PKG_8088, + .block = CPU_BLOCK_NONE, + .min_bus = 0, + .max_bus = 0, + .min_voltage = 0, + .max_voltage = 0, + .min_multi = 0, + .max_multi = 0 + }, + .bus_flags = MACHINE_PC, + .flags = MACHINE_FLAGS_NONE, + .ram = { + .min = 64, + .max = 768, + .step = 64 + }, + .nvrmask = 0, + .jumpered_ecp_dma = 0, + .default_jumpered_ecp_dma = -1, + .kbc_device = &kbc_xtclone_device, + .kbc_params = 0x00000000, + .kbc_p1 = 0xff, + .gpio = 0xffffffff, + .gpio_acpi = 0xffffffff, + .device = &to16_device, + .kbd_device = &keyboard_pc_xt_device, + .fdc_device = NULL, + .sio_device = NULL, + .vid_device = NULL, + .snd_device = NULL, + .net_device = NULL + }, { .name = "[8088] Toshiba T1000", .internal_name = "t1000",