From 06eda55634ad9638f1f0632f7f5ba75ea6137a46 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Wed, 4 Aug 2021 13:48:41 +0500 Subject: [PATCH] Move some CMS definitions and function declarations to a header file --- src/include/86box/snd_cms.h | 35 +++++++++++++++++++++++++++++++++++ src/sound/snd_cms.c | 25 +------------------------ 2 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 src/include/86box/snd_cms.h diff --git a/src/include/86box/snd_cms.h b/src/include/86box/snd_cms.h new file mode 100644 index 000000000..8700bf873 --- /dev/null +++ b/src/include/86box/snd_cms.h @@ -0,0 +1,35 @@ +#ifndef SOUND_SND_CMS_H +# define SOUND_SND_CMS_H + +#include +#include <86box/sound.h> + +#define MASTER_CLOCK 7159090 + +typedef struct cms_t +{ + int addrs[2]; + uint8_t regs[2][32]; + uint16_t latch[2][6]; + int freq[2][6]; + float count[2][6]; + int vol[2][6][2]; + int stat[2][6]; + uint16_t noise[2][2]; + uint16_t noisefreq[2][2]; + int noisecount[2][2]; + int noisetype[2][2]; + + uint8_t latched_data; + + int16_t buffer[SOUNDBUFLEN * 2]; + + int pos; +} cms_t; + + +extern void cms_update(cms_t *cms); +extern void cms_write(uint16_t addr, uint8_t val, void *p); +extern uint8_t cms_read(uint16_t addr, void *p); + +#endif /*SOUND_SND_CMS_H*/ diff --git a/src/sound/snd_cms.c b/src/sound/snd_cms.c index dae1f735f..631e00c6a 100644 --- a/src/sound/snd_cms.c +++ b/src/sound/snd_cms.c @@ -9,32 +9,9 @@ #include <86box/io.h> #include <86box/device.h> #include <86box/sound.h> +#include <86box/snd_cms.h> -#define MASTER_CLOCK 7159090 - - -typedef struct cms_t -{ - int addrs[2]; - uint8_t regs[2][32]; - uint16_t latch[2][6]; - int freq[2][6]; - float count[2][6]; - int vol[2][6][2]; - int stat[2][6]; - uint16_t noise[2][2]; - uint16_t noisefreq[2][2]; - int noisecount[2][2]; - int noisetype[2][2]; - - uint8_t latched_data; - - int16_t buffer[SOUNDBUFLEN * 2]; - - int pos; -} cms_t; - void cms_update(cms_t *cms) { for (; cms->pos < sound_pos_global; cms->pos++)