Debian Codegraph @

src/engine/platform/sound/d65modified.h

raw
1 /*
2
3 ============================================================================
4
5 NEC D65010G031 sound emulator
6 by cam900
7
8 This file is licensed under zlib license.
9
10 ============================================================================
11
12 zlib License
13
14 (C) 2023-present cam900 and contributors
15
16 This software is provided 'as-is', without any express or implied
17 warranty. In no event will the authors be held liable for any damages
18 arising from the use of this software.
19
20 Permission is granted to anyone to use this software for any purpose,
21 including commercial applications, and to alter it and redistribute it
22 freely, subject to the following restrictions:
23
24 1. The origin of this software must not be misrepresented; you must not
25 claim that you wrote the original software. If you use this software
26 in a product, an acknowledgment in the product documentation would be
27 appreciated but is not required.
28 2. Altered source versions must be plainly marked as such, and must not be
29 misrepresented as being the original software.
30 3. This notice may not be removed or altered from any source distribution.
31
32 ============================================================================
33
34 TODO:
35 - needs hardware test
36
37 */
38
39 #ifndef _D65010G031_EMU_H
40 #define _D65010G031_EMU_H
41
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46
47 struct d65010g031_square_t
48 {
49 unsigned char period; // Period (0 = Off)
50 int counter; // clock counter
51 signed short out; // output
52 };
53
54 struct d65010g031_t
55 {
56 struct d65010g031_square_t square[3];
57 signed short out[3];
58 unsigned char ctrl;
59 };
60
61 int d65010g031_square_tick(struct d65010g031_square_t *square, const int cycle);
62
63 int d65010g031_sound_tick(struct d65010g031_t *d65010g031, const int cycle);
64
65 void d65010g031_reset(struct d65010g031_t *d65010g031);
66
67 void d65010g031_write(struct d65010g031_t *d65010g031, const unsigned char a, const unsigned char d);
68
69 #ifdef __cplusplus
70 } // extern "C"
71 #endif
72
73 #endif // _D65010G031_EMU_H