diff --git a/src/device/lpt.c b/src/device/lpt.c
index 209ea33f8..31594bf03 100644
--- a/src/device/lpt.c
+++ b/src/device/lpt.c
@@ -322,7 +322,7 @@ lpt_write(const uint16_t port, const uint8_t val, void *priv)
lpt_t *dev = (lpt_t *) priv;
uint16_t mask = 0x0407;
- lpt_log("[W] %04X = %02X\n", port, val);
+ lpt_log("[W] %04X = %02X (ECR = %02X)\n", port, val, dev->ecr);
/* This is needed so the parallel port at 3BC works. */
if (dev->addr & 0x0004)
@@ -353,7 +353,7 @@ lpt_write(const uint16_t port, const uint8_t val, void *priv)
case 0x0002:
if (dev->dt && dev->dt->write_ctrl && dev->dt->priv) {
- if (dev->ecp)
+ if (dev->ecp && ((dev->ecr & 0xe0) >= 0x20))
dev->dt->write_ctrl((val & 0xfc) | dev->autofeed | dev->strobe, dev->dt->priv);
else
dev->dt->write_ctrl(val, dev->dt->priv);
@@ -401,7 +401,8 @@ lpt_write(const uint16_t port, const uint8_t val, void *priv)
break;
case 0x05:
dev->ext_regs[0x00] = val;
- dev->cnfga_readout = (val & 0x80) ? 0x1c : 0x14;
+ dev->cnfga_readout = (val & 0x80) ? 0x1c : 0x14;
+ dev->cnfgb_readout = (dev->cnfgb_readout & 0xc0) | (val & 0x3b);
break;
}
break;
@@ -658,11 +659,7 @@ lpt_read(const uint16_t port, void *priv)
case 0x0401:
if ((dev->ecr & 0xe0) == 0xe0) {
/* CNFGB */
- ret = 0x08;
- ret |= (dev->irq_state ? 0x40 : 0x00);
- ret |= ((dev->irq == 0x05) ? 0x30 : 0x00);
- if ((dev->dma >= 1) && (dev->dma <= 3))
- ret |= dev->dma;
+ ret = dev->cnfgb_readout | (dev->irq_state ? 0x40 : 0x00);
}
break;
@@ -775,6 +772,13 @@ lpt_set_cnfga_readout(lpt_t *dev, const uint8_t cnfga_readout)
dev->cnfga_readout = cnfga_readout;
}
+void
+lpt_set_cnfgb_readout(lpt_t *dev, const uint8_t cnfgb_readout)
+{
+ if (lpt_ports[dev->id].enabled)
+ dev->cnfgb_readout = (dev->cnfgb_readout & 0xc0) | (cnfgb_readout & 0x3f);
+}
+
void
lpt_port_setup(lpt_t *dev, const uint16_t port)
{
@@ -967,6 +971,7 @@ lpt_init(const device_t *info)
dev->ecr = 0x15;
dev->ret_ecr = 0x15;
dev->cnfga_readout = 0x10;
+ dev->cnfgb_readout = 0x00;
memset(dev->ext_regs, 0x00, 8);
dev->ext_regs[0x02] = 0x80;
diff --git a/src/include/86box/lpt.h b/src/include/86box/lpt.h
index fdf869953..d2bf72867 100644
--- a/src/include/86box/lpt.h
+++ b/src/include/86box/lpt.h
@@ -62,10 +62,11 @@ typedef struct lpt_t {
uint8_t strobe;
uint8_t lv2;
uint8_t cnfga_readout;
+ uint8_t cnfgb_readout;
uint8_t cfg_regs_enabled;
uint8_t inst;
uint8_t eir;
- uint8_t pad[2];
+ uint8_t pad;
uint8_t ext_regs[8];
uint16_t addr;
uint16_t id;
@@ -134,6 +135,7 @@ extern void lpt_set_lv2(lpt_t *dev, uint8_t lv2);
extern void lpt_set_cfg_regs_enabled(lpt_t *dev, uint8_t cfg_regs_enabled);
extern void lpt_set_fifo_threshold(lpt_t *dev, int threshold);
extern void lpt_set_cnfga_readout(lpt_t *dev, const uint8_t cnfga_readout);
+extern void lpt_set_cnfgb_readout(lpt_t *dev, const uint8_t cnfgb_readout);
extern void lpt_port_setup(lpt_t *dev, uint16_t port);
extern void lpt_port_irq(lpt_t *dev, uint8_t irq);
extern void lpt_port_dma(lpt_t *dev, uint8_t dma);
diff --git a/src/machine/m_at_386dx_486.c b/src/machine/m_at_386dx_486.c
index 880bb2218..323b80365 100644
--- a/src/machine/m_at_386dx_486.c
+++ b/src/machine/m_at_386dx_486.c
@@ -236,6 +236,7 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2
if (gfxcard[0] == VID_INTERNAL)
device_add(&et4000w32_onboard_device);
+ device_add_params(&fdc37c6xx_device, (void *) (FDC37C661 | FDC37C6XX_IDE_PRI));
device_add(&kbc_ps2_device);
if (fdc_current[0] == FDC_INTERNAL)
diff --git a/src/sio/sio_82091aa.c b/src/sio/sio_82091aa.c
index 283febada..cfe33df12 100644
--- a/src/sio/sio_82091aa.c
+++ b/src/sio/sio_82091aa.c
@@ -293,7 +293,9 @@ i82091aa_init(const device_t *info)
dev->uart[1] = device_add_inst(&ns16550_device, 2);
dev->lpt = device_add_inst(&lpt_port_device, 1);
+
lpt_set_cnfga_readout(dev->lpt, 0x90);
+ lpt_set_cnfgb_readout(dev->lpt, 0x00);
dev->has_ide = (info->local >> 9) & 0x03;
diff --git a/src/sio/sio_ali5123.c b/src/sio/sio_ali5123.c
index 71c074ea8..a6cd12554 100644
--- a/src/sio/sio_ali5123.c
+++ b/src/sio/sio_ali5123.c
@@ -82,13 +82,15 @@ ali5123_fdc_handler(ali5123_t *dev)
static void
ali5123_lpt_handler(ali5123_t *dev)
{
- uint16_t ld_port = 0x0000;
- uint16_t mask = 0xfffc;
- uint8_t global_enable = !(dev->regs[0x22] & (1 << 3));
- uint8_t local_enable = !!dev->ld_regs[3][0x30];
- uint8_t lpt_irq = dev->ld_regs[3][0x70];
- uint8_t lpt_dma = dev->ld_regs[3][0x74];
- uint8_t lpt_mode = dev->ld_regs[3][0xf0] & 0x07;
+ uint16_t ld_port = 0x0000;
+ uint16_t mask = 0xfffc;
+ uint8_t global_enable = !(dev->regs[0x22] & (1 << 3));
+ uint8_t local_enable = !!dev->ld_regs[3][0x30];
+ uint8_t lpt_irq = dev->ld_regs[3][0x70];
+ uint8_t lpt_dma = dev->ld_regs[3][0x74];
+ uint8_t lpt_mode = dev->ld_regs[3][0xf0] & 0x07;
+ uint8_t irq_readout[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08,
+ 0x00, 0x10, 0x18, 0x20, 0x00, 0x28, 0x30, 0x00 };
if (lpt_irq > 15)
lpt_irq = 0xff;
@@ -137,6 +139,9 @@ ali5123_lpt_handler(ali5123_t *dev)
}
lpt_port_irq(dev->lpt, lpt_irq);
lpt_port_dma(dev->lpt, lpt_dma);
+
+ lpt_set_cnfgb_readout(dev->lpt, ((lpt_irq > 15) ? 0x00 : irq_readout[lpt_irq]) |
+ ((lpt_dma >= 4) ? 0x00 : lpt_dma));
}
static void
diff --git a/src/sio/sio_fdc37c669.c b/src/sio/sio_fdc37c669.c
index 6a8c73563..57ca37619 100644
--- a/src/sio/sio_fdc37c669.c
+++ b/src/sio/sio_fdc37c669.c
@@ -33,6 +33,7 @@
#include <86box/fdd.h>
#include <86box/fdc.h>
#include <86box/sio.h>
+#include "cpu.h"
typedef struct fdc37c669_t {
uint8_t id;
@@ -410,6 +411,7 @@ fdc37c669_init(const device_t *info)
dev->uart[1] = device_add_inst(&ns16550_device, (next_id << 1) + 2);
dev->lpt = device_add_inst(&lpt_port_device, next_id + 1);
+ lpt_set_cnfgb_readout(dev->lpt, 0x00);
io_sethandler((info->local & FDC37C6XX_370) ? FDC_SECONDARY_ADDR : (next_id ? FDC_SECONDARY_ADDR : FDC_PRIMARY_ADDR),
0x0002, fdc37c669_read, NULL, NULL, fdc37c669_write, NULL, NULL, dev);
diff --git a/src/sio/sio_fdc37c67x.c b/src/sio/sio_fdc37c67x.c
index 97e423b17..9b9e40903 100644
--- a/src/sio/sio_fdc37c67x.c
+++ b/src/sio/sio_fdc37c67x.c
@@ -172,13 +172,15 @@ fdc37c67x_fdc_handler(fdc37c67x_t *dev)
static void
fdc37c67x_lpt_handler(fdc37c67x_t *dev)
{
- uint16_t ld_port = 0x0000;
- uint16_t mask = 0xfffc;
- uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
- uint8_t local_enable = !!dev->ld_regs[3][0x30];
- uint8_t lpt_irq = dev->ld_regs[3][0x70];
- uint8_t lpt_dma = dev->ld_regs[3][0x74];
- uint8_t lpt_mode = dev->ld_regs[3][0xf0] & 0x07;
+ uint16_t ld_port = 0x0000;
+ uint16_t mask = 0xfffc;
+ uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
+ uint8_t local_enable = !!dev->ld_regs[3][0x30];
+ uint8_t lpt_irq = dev->ld_regs[3][0x70];
+ uint8_t lpt_dma = dev->ld_regs[3][0x74];
+ uint8_t lpt_mode = dev->ld_regs[3][0xf0] & 0x07;
+ uint8_t irq_readout[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08,
+ 0x00, 0x10, 0x18, 0x20, 0x00, 0x00, 0x28, 0x30 };
if (lpt_irq > 15)
lpt_irq = 0xff;
@@ -225,6 +227,9 @@ fdc37c67x_lpt_handler(fdc37c67x_t *dev)
}
lpt_port_irq(dev->lpt, lpt_irq);
lpt_port_dma(dev->lpt, lpt_dma);
+
+ lpt_set_cnfgb_readout(dev->lpt, ((lpt_irq > 15) ? 0x00 : irq_readout[lpt_irq]) |
+ ((lpt_dma >= 4) ? 0x00 : lpt_dma));
}
static void
diff --git a/src/sio/sio_fdc37c6xx.c b/src/sio/sio_fdc37c6xx.c
index 5d48a73a6..64fa8d6c7 100644
--- a/src/sio/sio_fdc37c6xx.c
+++ b/src/sio/sio_fdc37c6xx.c
@@ -30,6 +30,7 @@
#include <86box/fdd.h>
#include <86box/fdc.h>
#include <86box/sio.h>
+#include "cpu.h"
typedef struct fdc37c6xx_t {
uint8_t max_reg;
@@ -225,7 +226,7 @@ fdc37c6xx_write(uint16_t port, uint8_t val, void *priv)
fdc_handler(dev);
break;
case 0x01:
- if (valxor & 0x03)
+ if (valxor & 0x0b)
lpt_handler(dev);
if (valxor & 0x60) {
set_com34_addr(dev);
@@ -259,6 +260,10 @@ fdc37c6xx_write(uint16_t port, uint8_t val, void *priv)
if (valxor & 0x20)
fdc_set_swap(dev->fdc, (dev->regs[5] & 0x20) >> 5);
break;
+ case 0x0a:
+ if (valxor)
+ lpt_handler(dev);
+ break;
default:
break;
@@ -374,6 +379,7 @@ fdc37c6xx_init(const device_t *info)
}
dev->lpt = device_add_inst(&lpt_port_device, 1);
+ lpt_set_cnfgb_readout(dev->lpt, 0x00);
if (info->local & FDC37C6XX_370)
io_sethandler(FDC_SECONDARY_ADDR, 0x0002,
diff --git a/src/sio/sio_fdc37c93x.c b/src/sio/sio_fdc37c93x.c
index 85e029fad..d5cd72c67 100644
--- a/src/sio/sio_fdc37c93x.c
+++ b/src/sio/sio_fdc37c93x.c
@@ -792,11 +792,13 @@ fdc37c93x_lpt_handler(fdc37c93x_t *dev)
{
uint16_t ld_port = 0x0000;
uint16_t mask = 0xfffc;
- uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
- uint8_t local_enable = !!dev->ld_regs[3][0x30];
- uint8_t lpt_irq = dev->ld_regs[3][0x70];
- uint8_t lpt_dma = dev->ld_regs[3][0x74];
- uint8_t lpt_mode = dev->ld_regs[3][0xf0] & 0x07;
+ uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
+ uint8_t local_enable = !!dev->ld_regs[3][0x30];
+ uint8_t lpt_irq = dev->ld_regs[3][0x70];
+ uint8_t lpt_dma = dev->ld_regs[3][0x74];
+ uint8_t lpt_mode = dev->ld_regs[3][0xf0] & 0x07;
+ uint8_t irq_readout[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08,
+ 0x00, 0x10, 0x18, 0x20, 0x00, 0x00, 0x28, 0x30 };
if (lpt_irq > 15)
lpt_irq = 0xff;
@@ -843,6 +845,9 @@ fdc37c93x_lpt_handler(fdc37c93x_t *dev)
}
lpt_port_irq(dev->lpt, lpt_irq);
lpt_port_dma(dev->lpt, lpt_dma);
+
+ lpt_set_cnfgb_readout(dev->lpt, ((lpt_irq > 15) ? 0x00 : irq_readout[lpt_irq]) |
+ ((lpt_dma >= 4) ? 0x00 : lpt_dma));
}
static void
diff --git a/src/sio/sio_fdc37m60x.c b/src/sio/sio_fdc37m60x.c
index 164db5eac..1ffa0f16d 100644
--- a/src/sio/sio_fdc37m60x.c
+++ b/src/sio/sio_fdc37m60x.c
@@ -123,13 +123,15 @@ fdc37m60x_fdc_handler(fdc37m60x_t *dev)
static void
fdc37m60x_lpt_handler(fdc37m60x_t *dev)
{
- uint16_t ld_port = 0x0000;
- uint16_t mask = 0xfffc;
- uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
- uint8_t local_enable = !!dev->ld_regs[3][0x30];
- uint8_t lpt_irq = dev->ld_regs[3][0x70];
- uint8_t lpt_dma = dev->ld_regs[3][0x74];
- uint8_t lpt_mode = dev->ld_regs[3][0xf0] & 0x07;
+ uint16_t ld_port = 0x0000;
+ uint16_t mask = 0xfffc;
+ uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
+ uint8_t local_enable = !!dev->ld_regs[3][0x30];
+ uint8_t lpt_irq = dev->ld_regs[3][0x70];
+ uint8_t lpt_dma = dev->ld_regs[3][0x74];
+ uint8_t lpt_mode = dev->ld_regs[3][0xf0] & 0x07;
+ uint8_t irq_readout[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08,
+ 0x00, 0x10, 0x18, 0x20, 0x00, 0x00, 0x28, 0x30 };
if (lpt_irq > 15)
lpt_irq = 0xff;
@@ -176,6 +178,9 @@ fdc37m60x_lpt_handler(fdc37m60x_t *dev)
}
lpt_port_irq(dev->lpt, lpt_irq);
lpt_port_dma(dev->lpt, lpt_dma);
+
+ lpt_set_cnfgb_readout(dev->lpt, ((lpt_irq > 15) ? 0x00 : irq_readout[lpt_irq]) |
+ ((lpt_dma >= 4) ? 0x00 : lpt_dma));
}
static void
diff --git a/src/sio/sio_gm82c803ab.c b/src/sio/sio_gm82c803ab.c
index 8f7749494..bf74dc703 100644
--- a/src/sio/sio_gm82c803ab.c
+++ b/src/sio/sio_gm82c803ab.c
@@ -348,6 +348,7 @@ gm82c803ab_init(const device_t *info)
dev->uart[1] = device_add_inst(&ns16550_device, 2);
dev->lpt = device_add_inst(&lpt_port_device, 1);
+ lpt_set_cnfgb_readout(dev->lpt, 0x00);
io_sethandler(0x0398, 0x0002,
gm82c803ab_read, NULL, NULL, gm82c803ab_write, NULL, NULL, dev);
diff --git a/src/sio/sio_gm82c803c.c b/src/sio/sio_gm82c803c.c
index 91c03b369..e9787fa39 100644
--- a/src/sio/sio_gm82c803c.c
+++ b/src/sio/sio_gm82c803c.c
@@ -345,6 +345,7 @@ gm82c803c_init(const device_t *info)
dev->uart[1] = device_add_inst(&ns16550_device, 2);
dev->lpt = device_add_inst(&lpt_port_device, 1);
+ lpt_set_cnfgb_readout(dev->lpt, 0x00);
io_sethandler(0x0398, 0x0002,
gm82c803c_read, NULL, NULL, gm82c803c_write, NULL, NULL, dev);
diff --git a/src/sio/sio_it86x1f.c b/src/sio/sio_it86x1f.c
index 5d11610ad..4c97f481a 100644
--- a/src/sio/sio_it86x1f.c
+++ b/src/sio/sio_it86x1f.c
@@ -842,6 +842,8 @@ it86x1f_init(UNUSED(const device_t *info))
dev->uart[1] = device_add_inst(&ns16550_device, 2);
dev->lpt = device_add_inst(&lpt_port_device, 1);
+
+ lpt_set_cnfgb_readout(dev->lpt, 0x00);
lpt_set_ext(dev->lpt, 1);
dev->gameport = gameport_add(&gameport_sio_device);
diff --git a/src/sio/sio_pc87306.c b/src/sio/sio_pc87306.c
index 6cda5bbd1..6401a5dd1 100644
--- a/src/sio/sio_pc87306.c
+++ b/src/sio/sio_pc87306.c
@@ -123,8 +123,9 @@ lpt_handler(pc87306_t *dev)
{
int temp;
uint16_t lptba;
- uint16_t lpt_port = LPT1_ADDR;
- uint8_t lpt_irq = LPT2_IRQ;
+ uint16_t lpt_port = LPT1_ADDR;
+ uint8_t lpt_irq = LPT2_IRQ;
+ uint8_t cnfgb_readout = 0x08;
lpt_port_remove(dev->lpt);
@@ -159,6 +160,10 @@ lpt_handler(pc87306_t *dev)
if (dev->regs[0x1b] & 0x10)
lpt_irq = (dev->regs[0x1b] & 0x20) ? 7 : 5;
+ cnfgb_readout |= (lpt_irq == 5) ? 0x30 : 0x00;
+ cnfgb_readout |= (dev->regs[0x18] & 0x06) >> 1;
+
+ lpt_set_cnfgb_readout(dev->lpt, cnfgb_readout);
lpt_set_ext(dev->lpt, !!(dev->regs[0x02] & 0x80));
lpt_set_epp(dev->lpt, !!(dev->regs[0x04] & 0x01));
@@ -168,6 +173,9 @@ lpt_handler(pc87306_t *dev)
lpt_port_setup(dev->lpt, lpt_port);
lpt_port_irq(dev->lpt, lpt_irq);
+
+ if ((dev->regs[0x18] & 0x06) != 0x00)
+ lpt_port_dma(dev->lpt, (dev->regs[0x18] & 0x08) ? 3 : 1);
}
static void
@@ -382,7 +390,7 @@ pc87306_write(uint16_t port, uint8_t val, void *priv)
pc87306_gpio_handler(dev);
break;
case 0x18:
- if (valxor & (0x06)) {
+ if (valxor & (0x0e)) {
lpt_port_remove(dev->lpt);
if ((dev->regs[0x00] & 0x01) && !(dev->regs[0x02] & 0x01))
lpt_handler(dev);
@@ -430,15 +438,21 @@ pc87306_read(uint16_t port, void *priv)
index = (port & 1) ? 0 : 1;
- dev->tries = 0;
-
- if (index)
+ if (dev->tries == 0xff) {
+ ret = 0x88;
+ dev->tries = 0xfe;
+ } else if (dev->tries == 0xfe) {
+ ret = 0x00;
+ dev->tries = 0;
+ } else if (index) {
ret = dev->cur_reg & 0x1f;
- else {
+ dev->tries = 0;
+ } else {
if (dev->cur_reg == 8)
ret = 0x70;
else if (dev->cur_reg < 28)
ret = dev->regs[dev->cur_reg];
+ dev->tries = 0;
}
return ret;
@@ -451,6 +465,8 @@ pc87306_reset_common(void *priv)
memset(dev->regs, 0, 29);
+ dev->tries = 0xff;
+
dev->regs[0x00] = 0x0B;
dev->regs[0x01] = 0x01;
dev->regs[0x03] = 0x01;
diff --git a/src/sio/sio_pc873xx.c b/src/sio/sio_pc873xx.c
index 72c156426..05f5d9be2 100644
--- a/src/sio/sio_pc873xx.c
+++ b/src/sio/sio_pc873xx.c
@@ -85,6 +85,7 @@ lpt_handler(pc873xx_t *dev)
break;
}
+ lpt_set_cnfgb_readout(dev->lpt, (lpt_irq == 5) ? 0x38 : 0x08);
lpt_set_ext(dev->lpt, !!(dev->regs[0x02] & 0x80));
if (dev->is_332) {
@@ -363,6 +364,7 @@ pc873xx_init(const device_t *info)
dev->uart[1] = device_add_inst(&ns16550_device, 2);
dev->lpt = device_add_inst(&lpt_port_device, 1);
+ lpt_set_cnfgb_readout(dev->lpt, 0x08);
dev->is_332 = !!(info->local & PC87332);
dev->max_reg = dev->is_332 ? 0x08 : 0x02;
diff --git a/src/sio/sio_um8669f.c b/src/sio/sio_um8669f.c
index c42cdd1b6..f0460ada9 100644
--- a/src/sio/sio_um8669f.c
+++ b/src/sio/sio_um8669f.c
@@ -8,8 +8,6 @@
*
* Emulation of the UMC UM8669F Super I/O chip.
*
- *
- *
* Authors: Sarah Walker,
* Miran Grca,
* RichardG,
@@ -349,6 +347,8 @@ um8669f_init(const device_t *info)
dev->uart[1] = device_add_inst(&ns16550_device, 2);
dev->lpt = device_add_inst(&lpt_port_device, 1);
+
+ lpt_set_cnfgb_readout(dev->lpt, 0x00);
lpt_set_ext(dev->lpt, 1);
dev->ide = (uint8_t) (info->local - 1);
diff --git a/src/sio/sio_um866x.c b/src/sio/sio_um866x.c
index a90bee64d..bc1127a8b 100644
--- a/src/sio/sio_um866x.c
+++ b/src/sio/sio_um866x.c
@@ -294,6 +294,7 @@ um866x_init(UNUSED(const device_t *info))
dev->uart[1] = device_add_inst(&ns16550_device, 2);
dev->lpt = device_add_inst(&lpt_port_device, 1);
+ lpt_set_cnfgb_readout(dev->lpt, 0x00);
dev->ide = info->local & 0xff;
if (dev->ide < IDE_BUS_MAX)
diff --git a/src/sio/sio_w837x7.c b/src/sio/sio_w837x7.c
index e670d8454..4044ab673 100644
--- a/src/sio/sio_w837x7.c
+++ b/src/sio/sio_w837x7.c
@@ -147,16 +147,16 @@ w837x7_lpt_handler(w837x7_t *dev)
uint8_t lpt_mode = (dev->regs[0x09] & 0x80) | (dev->regs[0x00] & 0x0c);
switch (ptras) {
- case 0x01:
+ case 0x00:
lpt_port = LPT_MDA_ADDR;
lpt_irq = LPT_MDA_IRQ;
break;
- case 0x02:
- lpt_port = LPT1_ADDR;
+ case 0x01:
+ lpt_port = LPT2_ADDR;
lpt_irq = LPT1_IRQ /*LPT2_IRQ*/;
break;
- case 0x03:
- lpt_port = LPT2_ADDR;
+ case 0x02:
+ lpt_port = LPT1_ADDR;
lpt_irq = LPT1_IRQ /*LPT2_IRQ*/;
break;
@@ -449,6 +449,7 @@ w837x7_init(const device_t *info)
dev->uart[1] = device_add_inst(&ns16550_device, 2);
dev->lpt = device_add_inst(&lpt_port_device, 1);
+ lpt_set_cnfgb_readout(dev->lpt, 0x3f);
dev->gameport = gameport_add(&gameport_sio_1io_device);
diff --git a/src/sio/sio_w83877.c b/src/sio/sio_w83877.c
index 419abb9f6..6ca0a019b 100644
--- a/src/sio/sio_w83877.c
+++ b/src/sio/sio_w83877.c
@@ -201,6 +201,8 @@ w83877_lpt_handler(w83877_t *dev)
lpt_port_irq(dev->lpt, lpt_irq);
lpt_port_dma(dev->lpt, dev->dma_map[dev->regs[0x26] & 0x03]);
+
+ lpt_set_cnfgb_readout(dev->lpt, ((dev->regs[0x26] & 0xe0) >> 2) | 0x07);
}
static void
diff --git a/src/sio/sio_w83977.c b/src/sio/sio_w83977.c
index 62d456aff..0ac531c9b 100644
--- a/src/sio/sio_w83977.c
+++ b/src/sio/sio_w83977.c
@@ -383,13 +383,15 @@ w83977_fdc_handler(w83977_t *dev)
static void
w83977_lpt_handler(w83977_t *dev)
{
- uint16_t ld_port = 0x0000;
- uint16_t mask = 0xfffc;
- uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
- uint8_t local_enable = !!dev->ld_regs[1][0x30];
- uint8_t lpt_irq = dev->ld_regs[1][0x70];
- uint8_t lpt_dma = dev->ld_regs[1][0x74];
- uint8_t lpt_mode = dev->ld_regs[1][0xf0] & 0x07;
+ uint16_t ld_port = 0x0000;
+ uint16_t mask = 0xfffc;
+ uint8_t global_enable = !!(dev->regs[0x22] & (1 << 3));
+ uint8_t local_enable = !!dev->ld_regs[1][0x30];
+ uint8_t lpt_irq = dev->ld_regs[1][0x70];
+ uint8_t lpt_dma = dev->ld_regs[1][0x74];
+ uint8_t lpt_mode = dev->ld_regs[1][0xf0] & 0x07;
+ uint8_t irq_readout[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08,
+ 0x00, 0x10, 0x18, 0x20, 0x00, 0x00, 0x28, 0x30 };
if (lpt_irq > 15)
lpt_irq = 0xff;
@@ -436,6 +438,8 @@ w83977_lpt_handler(w83977_t *dev)
}
lpt_port_irq(dev->lpt, lpt_irq);
lpt_port_dma(dev->lpt, lpt_dma);
+
+ lpt_set_cnfgb_readout(dev->lpt, ((lpt_irq > 15) ? 0x00 : irq_readout[lpt_irq]) | 0x07);
}
static void