diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 0b5391670..186d4c894 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -187,10 +187,18 @@ fdc_ctrl_reset(void *priv) fdc->stat = 0x80; fdc->pnum = fdc->ptot = 0; fdc->st0 = 0; - fdc->lock = 0; fdc->head = 0; fdc->step = 0; fdc->power_down = 0; + + if (!fdc->lock) { + fdc->fifo = 0; + fdc->tfifo = 1; + + fifo_reset(fdc->fifo_p); + fifo_set_len(fdc->fifo_p, fdc->tfifo + 1); + fifo_set_trigger_len(fdc->fifo_p, fdc->tfifo + 1); + } } sector_id_t @@ -2374,6 +2382,8 @@ fdc_reset(void *priv) fdc->swwp = 0; fdc->disable_write = 0; + fdc->lock = 0; + fdc_ctrl_reset(fdc); if (!(fdc->flags & FDC_FLAG_AT)) diff --git a/src/include/86box/pic.h b/src/include/86box/pic.h index 798cc3357..f6dc9af64 100644 --- a/src/include/86box/pic.h +++ b/src/include/86box/pic.h @@ -102,4 +102,6 @@ extern int picinterrupt(void); extern uint8_t pic_irq_ack(void); +extern void pic_toggle_latch(int is_ps2); + #endif /*EMU_PIC_H*/ diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c index a43d5ea63..86a1aa087 100644 --- a/src/machine/m_at_386dx_486.c +++ b/src/machine/m_at_386dx_486.c @@ -2232,18 +2232,66 @@ machine_at_ecs486_init(const machine_t *model) return ret; } +static const device_config_t hot433a_config[] = { + // clang-format off + { + .name = "bios", + .description = "BIOS Version", + .type = CONFIG_BIOS, + .default_string = "hot433a", + .default_int = 0, + .file_filter = "", + .spinner = { 0 }, + .bios = { + { .name = "AMI", .internal_name = "hot433a", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/hot433/433AUS33.ROM", "" } }, + { .name = "Award (eSupport update)", .internal_name = "hot433a_award", .bios_type = BIOS_NORMAL, + .files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/hot433/2A4X5H21.BIN", "" } }, + { .files_no = 0 } + }, + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t hot433a_device = { + .name = "Shuttle HOT-433A", + .internal_name = "hot433a_device", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = hot433a_config +}; + int machine_at_hot433a_init(const machine_t *model) { - int ret; + int ret = 0; + const char* fn; - ret = bios_load_linear("roms/machines/hot433/433AUS33.ROM", - 0x000e0000, 131072, 0); + /* No ROMs available */ + if (!device_available(model->device)) + return ret; + + device_context(model->device); + int is_award = !strcmp(device_get_config_bios("bios"), "hot433a_award"); + fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0); + ret = bios_load_linear(fn, 0x000e0000, 131072, 0); + device_context_restore(); if (bios_only || !ret) return ret; - machine_at_common_init(model); + machine_at_common_init_ex(model, 2); + if (is_award) + device_add(&amstrad_megapc_nvr_device); + else + device_add(&ami_1994_nvr_device); pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x10, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); @@ -2255,9 +2303,17 @@ machine_at_hot433a_init(const machine_t *model) device_add(&umc_hb4_device); device_add(&umc_8886bf_device); - device_add(&um8669f_device); + if (is_award) + device_add(&um8663af_device); + else + device_add(&um8669f_device); device_add(&winbond_flash_w29c010_device); - device_add(&keyboard_at_ami_device); + if (is_award) + device_add(&keyboard_ps2_ami_device); + else + device_add(&keyboard_at_ami_device); + + pic_toggle_latch(is_award); return ret; } diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 4f907ce10..001d9cb8c 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -69,6 +69,7 @@ extern const device_t ap5s_device; extern const device_t d842_device; extern const device_t d943_device; extern const device_t dells333sl_device; +extern const device_t hot433a_device; const machine_filter_t machine_types[] = { { "None", MACHINE_TYPE_NONE }, @@ -9381,7 +9382,7 @@ const machine_t machines[] = { .min_multi = 0, .max_multi = 0 }, - .bus_flags = MACHINE_PCI, + .bus_flags = MACHINE_PS2_PCI, .flags = MACHINE_IDE_DUAL | MACHINE_APM, .ram = { .min = 1024, @@ -9393,7 +9394,7 @@ const machine_t machines[] = { .kbc_p1 = 0xff, .gpio = 0xffffffff, .gpio_acpi = 0xffffffff, - .device = NULL, + .device = &hot433a_device, .fdc_device = NULL, .sio_device = NULL, .vid_device = NULL, diff --git a/src/pic.c b/src/pic.c index cf17e8205..4b8993322 100644 --- a/src/pic.c +++ b/src/pic.c @@ -638,6 +638,25 @@ pic_reset_hard(void) } } +void +pic_toggle_latch(int is_ps2) +{ + pic_kbd_latch(0x00); + pic_mouse_latch(0x00); + + /* Explicitly reset the latches. */ + kbd_latch = mouse_latch = 0; + latched_irqs = 0x0000; + + /* The situation is as follows: There is a giant mess when it comes to these latches on real hardware, + to the point that there's even boards with board-level latched that get used in place of the latches + on the chipset, therefore, I'm just doing this here for the sake of simplicity. */ + if (is_ps2) { + pic_kbd_latch(0x01); + pic_mouse_latch(0x01); + } +} + void pic_init(void) {