Mercurial > repos > blastem
comparison psg.c @ 1983:a7b753e260a2 mame_interp
Merge from default
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 09 May 2020 23:39:44 -0700 |
parents | c3c62dbf1ceb |
children | cfd53c94fffb |
comparison
equal
deleted
inserted
replaced
1937:cafde1255ad3 | 1983:a7b753e260a2 |
---|---|
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; |