The CD-ROM IOCTL direct pass through code now does sanity check on the requested data size before passing the command - fixes crashes with some DMA-only host DVD drives; The network poller is now in its own thread; The hack is back in the emulation of the National Semiconductors PC87306 Super I/O Chip - it's the only way right now to have serial working on that board; Fixed a part of the code that was still using NukedOPL even when OPL 3 was set to DOSBox OPL; Applied all mainline PCem commits.
101 lines
2.3 KiB
C
101 lines
2.3 KiB
C
/* Copyright holders: Sarah Walker
|
|
see COPYING for more details
|
|
*/
|
|
#include "ibm.h"
|
|
#include "io.h"
|
|
|
|
#include "lpt.h"
|
|
|
|
static uint8_t lpt1_dat, lpt2_dat;
|
|
static uint8_t lpt1_ctrl, lpt2_ctrl;
|
|
|
|
void lpt1_write(uint16_t port, uint8_t val, void *priv)
|
|
{
|
|
switch (port & 3)
|
|
{
|
|
case 0:
|
|
writedac(val);
|
|
lpt1_dat = val;
|
|
break;
|
|
case 2:
|
|
writedacctrl(val);
|
|
lpt1_ctrl = val;
|
|
break;
|
|
}
|
|
}
|
|
uint8_t lpt1_read(uint16_t port, void *priv)
|
|
{
|
|
switch (port & 3)
|
|
{
|
|
case 0:
|
|
return lpt1_dat;
|
|
case 1:
|
|
return readdacfifo();
|
|
case 2:
|
|
return lpt1_ctrl;
|
|
}
|
|
return 0xff;
|
|
}
|
|
|
|
void lpt2_write(uint16_t port, uint8_t val, void *priv)
|
|
{
|
|
switch (port & 3)
|
|
{
|
|
case 0:
|
|
writedac(val);
|
|
lpt2_dat = val;
|
|
break;
|
|
case 2:
|
|
writedacctrl(val);
|
|
lpt2_ctrl = val;
|
|
break;
|
|
}
|
|
}
|
|
uint8_t lpt2_read(uint16_t port, void *priv)
|
|
{
|
|
switch (port & 3)
|
|
{
|
|
case 0:
|
|
return lpt2_dat;
|
|
case 1:
|
|
return readdacfifo();
|
|
case 2:
|
|
return lpt2_ctrl;
|
|
}
|
|
return 0xff;
|
|
}
|
|
|
|
uint16_t lpt_addr[2] = { 0x378, 0x278 };
|
|
|
|
void lpt_init()
|
|
{
|
|
io_sethandler(0x0378, 0x0003, lpt1_read, NULL, NULL, lpt1_write, NULL, NULL, NULL);
|
|
io_sethandler(0x0278, 0x0003, lpt2_read, NULL, NULL, lpt2_write, NULL, NULL, NULL);
|
|
lpt_addr[0] = 0x378;
|
|
lpt_addr[1] = 0x378;
|
|
}
|
|
|
|
void lpt1_init(uint16_t port)
|
|
{
|
|
io_sethandler(port, 0x0003, lpt1_read, NULL, NULL, lpt1_write, NULL, NULL, NULL);
|
|
lpt_addr[0] = port;
|
|
}
|
|
void lpt1_remove()
|
|
{
|
|
io_removehandler(lpt_addr[0], 0x0003, lpt1_read, NULL, NULL, lpt1_write, NULL, NULL, NULL);
|
|
}
|
|
void lpt2_init(uint16_t port)
|
|
{
|
|
io_sethandler(port, 0x0003, lpt2_read, NULL, NULL, lpt2_write, NULL, NULL, NULL);
|
|
lpt_addr[1] = port;
|
|
}
|
|
void lpt2_remove()
|
|
{
|
|
io_removehandler(lpt_addr[1], 0x0003, lpt2_read, NULL, NULL, lpt2_write, NULL, NULL, NULL);
|
|
}
|
|
|
|
void lpt2_remove_ams()
|
|
{
|
|
io_removehandler(0x0379, 0x0002, lpt2_read, NULL, NULL, lpt2_write, NULL, NULL, NULL);
|
|
}
|