Add v0.7 source

This commit is contained in:
TomW 2013-04-21 14:54:35 +01:00
commit 3c253c2cf8
188 changed files with 52566 additions and 0 deletions

66
src/lpt.c Normal file
View file

@ -0,0 +1,66 @@
#include "ibm.h"
#include "io.h"
#include "lpt.h"
static uint8_t lpt1_dat, lpt2_dat;
void lpt1_write(uint16_t port, uint8_t val)
{
switch (port & 3)
{
case 0:
writedac(val);
lpt1_dat = val;
break;
case 2:
writedacctrl(val);
break;
}
}
uint8_t lpt1_read(uint16_t port)
{
switch (port & 3)
{
case 0:
return lpt1_dat;
case 1:
return readdacfifo();
}
return 0xff;
}
void lpt2_write(uint16_t port, uint8_t val)
{
switch (port & 3)
{
case 0:
writedac(val);
lpt2_dat = val;
break;
case 2:
writedacctrl(val);
break;
}
}
uint8_t lpt2_read(uint16_t port)
{
switch (port & 3)
{
case 0:
return lpt2_dat;
case 1:
return readdacfifo();
}
return 0xff;
}
void lpt_init()
{
io_sethandler(0x0278, 0x0003, lpt1_read, NULL, NULL, lpt1_write, NULL, NULL);
io_sethandler(0x0378, 0x0003, lpt2_read, NULL, NULL, lpt2_write, NULL, NULL);
}
void lpt2_remove()
{
io_removehandler(0x0379, 0x0002, lpt2_read, NULL, NULL, lpt2_write, NULL, NULL);
}