main
psg.h
1/*
2 Copyright 2013 Michael Pavone
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.
5*/
6#ifndef PSG_CONTEXT_H_
7#define PSG_CONTEXT_H_
8
9#include <stdint.h>
10#include "serialize.h"
11#include "render.h"
12
13typedef struct {
14 audio_source *audio;
15 uint32_t clock_inc;
16 uint32_t cycles;
17 uint16_t lsfr;
18 uint16_t counter_load[4];
19 uint16_t counters[4];
20 uint8_t volume[4];
21 uint8_t output_state[4];
22 uint8_t noise_out;
23 uint8_t noise_use_tone;
24 uint8_t noise_type;
25 uint8_t latch;
26} psg_context;
27
28
29void psg_init(psg_context * context, uint32_t master_clock, uint32_t clock_div);
30void psg_free(psg_context *context);
31void psg_adjust_master_clock(psg_context * context, uint32_t master_clock);
32void psg_write(psg_context * context, uint8_t value);
33void psg_run(psg_context * context, uint32_t cycles);
34void psg_serialize(psg_context *context, serialize_buffer *buf);
35void psg_deserialize(deserialize_buffer *buf, void *vcontext);
36
37#endif //PSG_CONTEXT_H_
38