diff --git a/src/include/86box/sio.h b/src/include/86box/sio.h index f1e6cf82d..bf9f5526c 100644 --- a/src/include/86box/sio.h +++ b/src/include/86box/sio.h @@ -67,6 +67,7 @@ extern const device_t um8669f_device; extern const device_t via_vt82c686_sio_device; extern const device_t w83787f_device; extern const device_t w83787f_ide_device; +extern const device_t w83787f_ide_en_device; extern const device_t w83787f_ide_sec_device; extern const device_t w83877f_device; extern const device_t w83877f_president_device; diff --git a/src/machine/m_at_286_386sx.c b/src/machine/m_at_286_386sx.c index c920ee531..1e7ec471a 100644 --- a/src/machine/m_at_286_386sx.c +++ b/src/machine/m_at_286_386sx.c @@ -644,7 +644,7 @@ machine_at_flytech386_init(const machine_t *model) machine_at_common_init(model); device_add(&ali1217_device); - device_add(&w83787f_ide_device); + device_add(&w83787f_ide_en_device); device_add(&keyboard_ps2_device); if (gfxcard == VID_INTERNAL) diff --git a/src/sio/sio_w83787f.c b/src/sio/sio_w83787f.c index e95d77035..ca0bfcc49 100644 --- a/src/sio/sio_w83787f.c +++ b/src/sio/sio_w83787f.c @@ -78,7 +78,8 @@ typedef struct { uint16_t reg_init; int locked, rw_locked, cur_reg, - key, ide_function; + key, ide_function, + ide_start; fdc_t *fdc; serial_t *uart[2]; } w83787f_t; @@ -260,6 +261,7 @@ w83787f_write(uint16_t port, uint8_t val, void *priv) switch (dev->cur_reg) { case 0: + pclog("REG 00: %02X\n", val); if ((valxor & 0xc0) && (HAS_IDE_FUNCTIONALITY)) w83787f_ide_handler(dev); if (valxor & 0x30) @@ -376,6 +378,14 @@ w83787f_reset(w83787f_t *dev) ide_set_base(0, 0x1f0); ide_set_side(0, 0x3f6); } + + if (dev->ide_start) { + dev->regs[0x00] &= 0x7f; + if (dev->ide_function & 0x20) + ide_sec_enable(); + else + ide_pri_enable(); + } } else dev->regs[0x00] = 0xd0; @@ -426,6 +436,8 @@ w83787f_init(const device_t *info) if ((dev->ide_function & 0x30) == 0x10) device_add(&ide_isa_device); + dev->ide_start = !!(info->local & 0x40); + dev->reg_init = info->local & 0x0f; w83787f_reset(dev); @@ -451,6 +463,15 @@ const device_t w83787f_ide_device = { NULL }; +const device_t w83787f_ide_en_device = { + "Winbond W83787F/IF Super I/O (With IDE Enabled)", + 0, + 0x59, + w83787f_init, w83787f_close, NULL, + { NULL }, NULL, NULL, + NULL +}; + const device_t w83787f_ide_sec_device = { "Winbond W83787F/IF Super I/O (With Secondary IDE)", 0,