From 16be4100808e09a94e802adb58bc1c79e5eefd65 Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Tue, 14 Mar 2017 19:07:57 +0900 Subject: libopna: enable register read --- libopna/opnassg.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'libopna/opnassg.c') diff --git a/libopna/opnassg.c b/libopna/opnassg.c index 1345502..3c5b108 100644 --- a/libopna/opnassg.c +++ b/libopna/opnassg.c @@ -103,6 +103,11 @@ void opna_ssg_writereg(struct opna_ssg *ssg, unsigned reg, unsigned val) { } } +unsigned opna_ssg_readreg(const struct opna_ssg *ssg, unsigned reg) { + if (reg > 0xfu) return 0xff; + return ssg->regs[reg]; +} + static int opna_ssg_tone_period(const struct opna_ssg *ssg, int chan) { return ssg->regs[0+chan*2] | ((ssg->regs[1+chan*2] & 0xf) << 8); } @@ -173,7 +178,9 @@ void opna_ssg_generate_raw(struct opna_ssg *ssg, int16_t *buf, int samples) { ssg->ch[ch].out = !ssg->ch[ch].out; } if (ssg->mask & (1<