Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libsnes/bsnes/snes/chip/spc7110/decomp.hpp
2 views
1
class Decomp {
2
public:
3
uint8 read();
4
void init(unsigned mode, unsigned offset, unsigned index);
5
void reset();
6
7
void serialize(serializer&);
8
Decomp();
9
~Decomp();
10
11
private:
12
unsigned decomp_mode;
13
unsigned decomp_offset;
14
15
//read() will spool chunks half the size of decomp_buffer_size
16
enum { decomp_buffer_size = 64 }; //must be >= 64, and must be a power of two
17
uint8 *decomp_buffer;
18
unsigned decomp_buffer_rdoffset;
19
unsigned decomp_buffer_wroffset;
20
unsigned decomp_buffer_length;
21
22
void write(uint8 data);
23
uint8 dataread();
24
25
void mode0(bool init);
26
void mode1(bool init);
27
void mode2(bool init);
28
29
static const uint8 evolution_table[53][4];
30
static const uint8 mode2_context_table[32][2];
31
32
struct ContextState {
33
uint8 index;
34
uint8 invert;
35
} context[32];
36
37
uint8 probability(unsigned n);
38
uint8 next_lps(unsigned n);
39
uint8 next_mps(unsigned n);
40
bool toggle_invert(unsigned n);
41
42
unsigned deinterleave_2x8(unsigned data);
43
unsigned deinterleave_4x8(unsigned data);
44
};
45
46