Files
86Box/src/dac.c
OBattler f6ef1f833c Vastly overhauled the UI, there's now a completely new Settings dialog as well as a status bar with disk activity icons and removable drive menus;
Thoroughly clean up the code to vastly reduce the number of compiler warnings and found and fixed several bugs in the process;
Applied all mainline PCem commits;
Added SCSI hard disk emulation;
Commented out all unfinished machines and graphics cards;
Added the AOpen AP53 and ASUS P/I-P55T2 machines as well as another Tyan 440FX machine, all three with AMI WinBIOS (patch from TheCollector1995);
Added the Diamond Stealth 3D 3000 (S3 ViRGE/VX) graphics card (patch from TheCollector1995);
Added the PS/2 XT IDE (AccuLogic) HDD Controller (patch from TheCollector1995);
Added Microsoft/Logitech Bus Mouse emulation (patch from waltje);
Overhauled the makefiles (patch from waltje);
Added the Adaptec AHA-1542CF SCSI controller (patch from waltje);
Added preliminary (but still unfinished) Adaptec AHA-154x SCSI controller BIOS support (patch from waltje);
Added an ISABugger debugging device (patch from waltje);
Added sanity checks to the Direct3D code.
2017-05-05 01:49:42 +02:00

71 lines
1.4 KiB
C

/* Copyright holders: Sarah Walker
see COPYING for more details
*/
#include "ibm.h"
#include "dac.h"
uint8_t dac,dac2;
uint8_t dacctrl;
int lptfifo;
uint8_t dssbuffer[16];
int dssstart=0,dssend=0;
int dssmode=0;
void writedac(uint16_t addr, uint8_t val)
{
if (dssmode) dac2=val;
else dac=val;
}
void writedacctrl(uint16_t addr, uint8_t val)
{
if (dacctrl&8 && !(val&8) && (lptfifo!=16))
{
dssbuffer[dssend++]=dac2;
dssend&=15;
lptfifo++;
}
dacctrl=val;
}
uint8_t readdacfifo()
{
if (lptfifo==16) return 0x40;
return 0;
}
void pollss()
{
if (lptfifo)
{
dac=dssbuffer[dssstart++];
dssstart&=15;
lptfifo--;
}
}
int16_t dacbuffer[SOUNDBUFLEN+20];
int dacbufferpos=0;
void getdacsamp()
{
if (dacbufferpos<SOUNDBUFLEN+20) dacbuffer[dacbufferpos++]=(((int)(unsigned int)dac)-0x80)*0x20;
}
void adddac(int16_t *p)
{
int c;
if (dacbufferpos>SOUNDBUFLEN) dacbufferpos=SOUNDBUFLEN;
for (c=0;c<dacbufferpos;c++)
{
p[c<<1]+=(dacbuffer[c]);
p[(c<<1)+1]+=(dacbuffer[c]);
}
for (;c<SOUNDBUFLEN;c++)
{
p[c<<1]+=(dacbuffer[dacbufferpos-1]);
p[(c<<1)+1]+=(dacbuffer[dacbufferpos-1]);
}
dacbufferpos=0;
}