#define LO_BYTE(x) (uint8_t)((x) & 0xff)
#define HI_BYTE(x) (uint8_t)(((x) >> 8) & 0xff)
#define SUS_OFF (0)
#define KEY_OFF (0)
#define SUS_ON (uint16_t)(1 << 13)
#define KEY_ON (uint16_t)(1 << 12)
#define BLOCK(x) (uint16_t)((x) << 9)
#define F_NUM(x) (uint16_t)(x)
#define INST(x) (uint8_t)((x) << 4)
#define VOL(x) (uint8_t)((x) & 0x0f)
static bool paused;
void init(void) {
}
}
void play(void) {
if (!opll.slot) return;
if (paused) return;
{
static uint8_t t = 0;
if (!t) {
uint16_t x = (SUS_OFF | KEY_ON | BLOCK(4) | F_NUM(257));
}
else if (t == len * 4/5) {
uint16_t x = (SUS_OFF | KEY_OFF | BLOCK(4) | F_NUM(257));
}
t++;
if (t == len) {
t = 0;
}
}
}
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;
__asm__("di");
__asm__("ei");
}
__asm__("di");
__asm__("ei");
}
if (is_paused()) {
start();
}
else {
pause();
}
}
}
}
uint8_t msx_get_vsync_frequency(void)
MSX Returns VSYNC frequency in Hz.
void await_vsync(void)
MSX Waits for next VSYNC interrupt.
void set_vsync_handler(void(*handler)(void))
MSX Register user defined VSYNC interrupt handler.
void OPLL_init(void)
MSX Initialize internal buffer for OPLL.
void OPLL_stop(struct OPLL *opll)
MSX Stop (Pause) playing sound on OPLL
void OPLL_put(uint8_t reg, uint8_t val)
MSX Put a pair of OPLL register number and its value to the internal buffer.
void OPLL_rhythm(uint8_t val)
MSX Key-on/off RHYTHM set.
void OPLL_play(struct OPLL *opll)
MSX Play sound on OPLL
void OPLL_rhythm_mode(bool on)
MSX Turn RHYTHM mode on/off.
uint8_t OPLL_find(struct OPLL *opll)
MSX Find OPLL sound chip.
void OPLL_enable(const struct OPLL *opll)
MSX Enable OPLL sound chip.
Using #include <msx.h> includes almost all C header files in libmsx, for ease to use.
Buffered access to OPLL registers.