1
2// NES APU snapshot support
3
4// Nes_Snd_Emu 0.1.7. Copyright (C) 2003-2005 Shay Green. GNU LGPL license.
5
6#ifndef APU_SNAPSHOT_H
7#define APU_SNAPSHOT_H
8
9#include "blargg_common.h"
10
11struct apu_snapshot_t
12{
13 typedef BOOST::uint8_t byte;
14
15 typedef byte env_t [3];
16 /*struct env_t {
17 byte delay;
18 byte env;3
19 byte written;
20 };*/
21
22 byte w40xx [0x14]; // $4000-$4013
23 byte w4015; // enables
24 byte w4017; // mode
25 BOOST::uint16_t delay;
26 byte step;
27 byte irq_flag;
28
29 struct square_t {
30 BOOST::uint16_t delay;
31 env_t env;
32 byte length;
33 byte phase;
34 byte swp_delay;
35 byte swp_reset;
36 byte unused [1];
37 };
38
39 square_t square1;
40 square_t square2;
41
42 struct triangle_t {
43 BOOST::uint16_t delay;
44 byte length;
45 byte phase;
46 byte linear_counter;
47 byte linear_mode;
48 } triangle;
49
50 struct noise_t {
51 BOOST::uint16_t delay;
52 env_t env;
53 byte length;
54 BOOST::uint16_t shift_reg;
55 } noise;
56
57 struct dmc_t {
58 BOOST::uint16_t delay;
59 BOOST::uint16_t remain;
60 BOOST::uint16_t addr;
61 byte buf;
62 byte bits_remain;
63 byte bits;
64 byte buf_empty;
65 byte silence;
66 byte irq_flag;
67 } dmc;
68
69 enum { tag = 'APUR' };
70 void swap();
71};
72BOOST_STATIC_ASSERT( sizeof (apu_snapshot_t) == 72 );
73
74#endif
75
76