libmsx
C library for MSX
|
#include <scc.h>
Inspect, discover, enable/disable to access registers, of the SCC/SCC+ sound chip.
More...
Data Structures | |
struct | SCC_Waveform |
The structure of the SCC/SCC+ 32-byte waveform data register. More... | |
struct | SCC_Channel |
Device interface for a sound channel of SCC/SCC+ sound chip. More... | |
struct | SCC_Device |
Device interface for SCC/SCC+ sound chip. More... | |
struct | SCC |
SCC Handle. More... | |
Functions | |
uint8_t | SCC_inspect (uint8_t slot) |
MSX Inspect whether SCC/SCC+ is on the given slot. | |
uint8_t | SCC_find (struct SCC *scc) |
MSX Find SCC/SCC+ sound chip. | |
void | SCC_set_mode (struct SCC *scc, uint8_t mode) |
MSX Set the SCC handle to SCC compatible mode or SCC+ mode. | |
uint8_t | SCC_get_mode (struct SCC *scc) |
MSX Check which mode the SCC handle is set to. | |
void | SCC_enable (const struct SCC *scc) |
MSX Enable SCC/SCC+ sound chip. | |
void | SCC_disable (const struct SCC *scc) |
MSX Disable SCC/SCC+ sound chip. | |
#include <scc.h>
Inspect, discover, enable/disable to access registers, of the SCC/SCC+ sound chip.
Example
The following code detects the Konami SCC/SCC+ sound chip and plays a triangular wave test tone if detected.
struct SCC_Waveform |
struct SCC_Channel |
Data Fields | ||
---|---|---|
volatile const struct SCC_Waveform * | ro_waveform |
Pointer to read data from the 32-byte waveform data register.
|
volatile struct SCC_Waveform * | wo_waveform |
Pointer to write data to the 32-byte waveform data register.
|
volatile uint16_t * | rw_fdr | Pointer to read/write data from/to the frequency division ratio register. |
volatile uint8_t * | rw_volume | Pointer to read/write data from/to the volume register. |
struct SCC_Device |
Data Fields | ||
---|---|---|
volatile uint8_t * | rw_channel_mask | Pointer to read/write a value from/to the channel mask register. |
volatile uint8_t * | wo_deformation |
Pointer to write a value to the deformation register.
|
struct SCC_Channel | channels[5] | Device interface for each 5 channels. |
struct SCC |
SCC Handle.
Data Fields | ||
---|---|---|
uint8_t | slot | Slot address of the SCC/SCC+. |
uint8_t | version |
1 if SCC, 2 or greater value if SCC+. |
uint8_t | mode |
1 if SCC compatible mode, 2 if SCC+ mode. |
const struct SCC_Device * | device | Pointer to device interface. |
uint8_t SCC_inspect | ( | uint8_t | slot | ) |
uint8_t SCC_find | ( | struct SCC * | scc | ) |
MSX
Find SCC/SCC+ sound chip.
scc | [out] pointer to a SCC handle to be initialized. |
0
otherwise.0
is set to scc->slot
. void SCC_set_mode | ( | struct SCC * | scc, |
uint8_t | mode | ||
) |
MSX
Set the SCC handle to SCC compatible mode or SCC+ mode.
The scc
shall point to a SCC handle initialized by SCC_find().
If scc->version
is less than 2
(i.e., not SCC+), do nothing.
The mode set by this function shall be applied to the sound chip the next time SCC_enable() is called.
uint8_t SCC_get_mode | ( | struct SCC * | scc | ) |
MSX
Check which mode the SCC handle is set to.
The scc
shall point to a SCC handle initialized by SCC_find().
The mode returned by this function (i.e., the mode set to the SCC handle) may not the current mode of the sound chip. The mode set to the SCC handle shall be applied to the sound chip when SCC_enable() is called.
scc | pointer to the SCC handle. |
1
if SCC mode, 2
if SCC+ mode, 0
otherwise. void SCC_enable | ( | const struct SCC * | scc | ) |
MSX
Enable SCC/SCC+ sound chip.
Expose SCC/SCC+ sound chip on the slot scc->slot
and enable to access registers of the sound chip by inter-slot read/write BIOS function.
The scc
shall point to a SCC handle initialized by SCC_find().
scc | pointer to the SCC handle. |
void SCC_disable | ( | const struct SCC * | scc | ) |
MSX
Disable SCC/SCC+ sound chip.
Unexpose SCC/SCC+ sound chip on the slot scc->slot
and disable to access registers of the sound chip.
The scc
shall point to a SCC handle initialized by SCC_find().
scc | pointer to the SCC handle. |