-
Notifications
You must be signed in to change notification settings - Fork 0
/
Spu.cpp
56 lines (47 loc) · 869 Bytes
/
Spu.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <stdexcept>
#include "Spu.hpp"
static Spu * instance = nullptr;
Spu * Spu::get_instance()
{
if (instance == nullptr)
{
instance = new Spu();
}
return instance;
}
bool Spu::init()
{
spu_ram = new unsigned char[SPU_RAM_SIZE];
memset(spu_ram, 0, SPU_RAM_SIZE);
return true;
}
Spu::~Spu()
{
if (spu_ram)
{
delete[] spu_ram;
}
}
bool Spu::is_address_for_device(unsigned int address)
{
if (address >= SPU_START && address < SPU_END)
{
return true;
}
return false;
}
unsigned char Spu::get_byte(unsigned int address)
{
//throw std::logic_error("not implemented");
return 0;
}
void Spu::set_byte(unsigned int address, unsigned char value)
{
//throw std::logic_error("not implemented");
}
void Spu::reset()
{
memset(spu_control, 0, SPU_CONTROL_SIZE);
memset(spu_voice_registers, 0, SPU_VOICE_SIZE);
memset(spu_ram, 0, SPU_RAM_SIZE);
}