comparison psg.c @ 1946:c3c62dbf1ceb

WIP netplay support
author Michael Pavone <pavone@retrodev.com>
date Wed, 29 Apr 2020 01:00:57 -0700
parents f2ed8df7a002
children cfd53c94fffb
comparison
equal deleted inserted replaced
1945:ba7231d2411c 1946:c3c62dbf1ceb
3 This file is part of BlastEm. 3 This file is part of BlastEm.
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. 4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
5 */ 5 */
6 #include "psg.h" 6 #include "psg.h"
7 #include "blastem.h" 7 #include "blastem.h"
8 #include "event_log.h"
8 #include <string.h> 9 #include <string.h>
9 #include <stdlib.h> 10 #include <stdlib.h>
10 #include <stdio.h> 11 #include <stdio.h>
11 #include <math.h> 12 #include <math.h>
12 void psg_init(psg_context * context, uint32_t master_clock, uint32_t clock_div) 13 void psg_init(psg_context * context, uint32_t master_clock, uint32_t clock_div)
33 void psg_write(psg_context * context, uint8_t value) 34 void psg_write(psg_context * context, uint8_t value)
34 { 35 {
35 if (context->vgm) { 36 if (context->vgm) {
36 vgm_sn76489_write(context->vgm, context->cycles, value); 37 vgm_sn76489_write(context->vgm, context->cycles, value);
37 } 38 }
39 event_log(EVENT_PSG_REG, context->cycles, sizeof(value), &value);
38 if (value & 0x80) { 40 if (value & 0x80) {
39 context->latch = value & 0x70; 41 context->latch = value & 0x70;
40 uint8_t channel = value >> 5 & 0x3; 42 uint8_t channel = value >> 5 & 0x3;
41 if (value & 0x10) { 43 if (value & 0x10) {
42 context->volume[channel] = value & 0xF; 44 context->volume[channel] = value & 0xF;