Buffered access to PSG registers.
More...
Buffered access to PSG registers.
Example
The following code shows a sound driver/replayer template for the PSG.
#define LO_BYTE(x) (uint8_t)((x) & 0xff)
#define HI_BYTE(x) (uint8_t)(((x) >> 8) & 0xff)
static bool paused;
void init(void) {
}
void play(void) {
if (paused) return;
{
for (uint8_t ch = 0; ch < 3; ch++) {
}
}
}
void start(void) {
paused = false;
}
void pause(void) {
paused = true;
__asm__("ei");
}
bool is_paused(void) {
return paused;
}
void stop(void) {
pause();
}
void main(void) {
init();
start();
uint8_t pressed = false;
for (;;) {
uint8_t clicked = pressed & ~joy;
pressed = joy;
if (is_paused()) {
start();
}
else {
pause();
}
}
}
}
Buffer for PSG (AY-3-8910) registers.
void await_vsync(void)
MSX Waits for next VSYNC interrupt.
void set_vsync_handler(void(*handler)(void))
MSX Register user defined VSYNC interrupt handler.
uint8_t ay_3_8910_buffer[14]
Buffer for PSG (AY-3-8910) registers.
void ay_3_8910_play(void)
MSX Write the buffer contents to PSG registers.
void ay_3_8910_stop(void)
MSX Stop (Pause) playing sound on PSG.
void ay_3_8910_init(void)
MSX Initialize ay_3_8910_buffer[].
Using #include <msx.h> includes almost all C header files in libmsx, for ease to use.
◆ ay_3_8910_init()
void ay_3_8910_init |
( |
void |
| ) |
|
MSX
Initialize ay_3_8910_buffer[].
◆ ay_3_8910_stop()
void ay_3_8910_stop |
( |
void |
| ) |
|
MSX
Stop (Pause) playing sound on PSG.
This function sets all volume registers to 0
.
- Note
- This function simply sets all channels' volume level to 0.
◆ ay_3_8910_play()
void ay_3_8910_play |
( |
void |
| ) |
|
MSX
Write the buffer contents to PSG registers.
- Note
- PSG R#13 register is overwritten only if ay_3_8910_buffer[13] had been updated, and then the ay_3_8910_buffer[13] is reinitialized.
-
Any other PSG registers (R#0..12) are always overwritten with corresponding buffer value.
◆ ay_3_8910_buffer
uint8_t ay_3_8910_buffer[14] |
|
extern |
Buffer for PSG (AY-3-8910) registers.