Files
86Box/src/sound/snd_ssi2001.c
OBattler 0faf6692c9 WARNING: CONFIGS MIGHT PARTIALLY BREAK WHERE DEVICE NAMES HAVE CHANGED.
Changes to device_t struct to accomodate the upcoming PCI IRQ arbitration rewrite;
Added device.c/h API to obtain name from the device_t struct;
Significant changes to win/win_settings.c to clean up the code a bit and fix bugs;
Ported all the CPU and AudioPCI commits from PCem;
Added an API call to allow ACPI soft power off to gracefully stop the emulator;
Removed the Siemens PCD-2L from the Dev branch because it now works;
Removed the Socket 5 HP Vectra from the Dev branch because it now works;
Fixed the Compaq Presario and the Micronics Spitfire;
Give the IBM PC330 its own list of 486 CPU so it can have DX2's with CPUID 0x470;
SMM fixes;
Rewrote the SYSENTER, SYSEXIT, SYSCALL, and SYSRET instructions;
Changed IDE reset period to match the specification, fixes #929;
The keyboard input and output ports are now forced in front of the queue when read, fixes a number of bugs, including the AMI Apollo hanging on soft reset;
Added the Intel AN430TX but Dev branched because it does not work;
The network code no longer drops packets if the emulated network card has failed to receive them (eg. when the buffer is full);
Changes to PCI card adding and renamed some PCI slot types, also added proper AGP bridge slot types;
USB UHCI emulation is no longer a stub (still doesn't fully work, but at least Windows XP chk with Debug no longer ASSERT's on it);
Fixed NVR on the the SMC FDC37C932QF and APM variants;
A number of fixes to Intel 4x0 chipsets, including fixing every register of the 440LX and 440EX;
Some ACPI changes.
2020-11-16 00:01:21 +01:00

90 lines
2.0 KiB
C

#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include <86box/io.h>
#include <86box/device.h>
#include <86box/sound.h>
#include <86box/snd_resid.h>
typedef struct ssi2001_t
{
void *psid;
int16_t buffer[SOUNDBUFLEN * 2];
int pos;
} ssi2001_t;
static void ssi2001_update(ssi2001_t *ssi2001)
{
if (ssi2001->pos >= sound_pos_global)
return;
sid_fillbuf(&ssi2001->buffer[ssi2001->pos], sound_pos_global - ssi2001->pos, ssi2001->psid);
ssi2001->pos = sound_pos_global;
}
static void ssi2001_get_buffer(int32_t *buffer, int len, void *p)
{
ssi2001_t *ssi2001 = (ssi2001_t *)p;
int c;
ssi2001_update(ssi2001);
for (c = 0; c < len * 2; c++)
buffer[c] += ssi2001->buffer[c >> 1] / 2;
ssi2001->pos = 0;
}
static uint8_t ssi2001_read(uint16_t addr, void *p)
{
ssi2001_t *ssi2001 = (ssi2001_t *)p;
ssi2001_update(ssi2001);
return sid_read(addr, p);
}
static void ssi2001_write(uint16_t addr, uint8_t val, void *p)
{
ssi2001_t *ssi2001 = (ssi2001_t *)p;
ssi2001_update(ssi2001);
sid_write(addr, val, p);
}
void *ssi2001_init(const device_t *info)
{
ssi2001_t *ssi2001 = malloc(sizeof(ssi2001_t));
memset(ssi2001, 0, sizeof(ssi2001_t));
ssi2001->psid = sid_init();
sid_reset(ssi2001->psid);
io_sethandler(0x0280, 0x0020, ssi2001_read, NULL, NULL, ssi2001_write, NULL, NULL, ssi2001);
sound_add_handler(ssi2001_get_buffer, ssi2001);
return ssi2001;
}
void ssi2001_close(void *p)
{
ssi2001_t *ssi2001 = (ssi2001_t *)p;
sid_close(ssi2001->psid);
free(ssi2001);
}
const device_t ssi2001_device =
{
"Innovation SSI-2001",
0, 0,
ssi2001_init, ssi2001_close, NULL,
{ NULL }, NULL, NULL,
NULL
};