Remove AudioRam in favor of standard std::vector for spc700/dsp
This commit is contained in:
@@ -193,10 +193,10 @@ void Dsp::HandleEcho() {
|
|||||||
int echoR = clamp16(echoOutR + clip16((sumR * feedbackVolume) >> 7)) & ~1;
|
int echoR = clamp16(echoOutR + clip16((sumR * feedbackVolume) >> 7)) & ~1;
|
||||||
// write it to ram
|
// write it to ram
|
||||||
if (echoWrites) {
|
if (echoWrites) {
|
||||||
aram_.write(adr, echoL & 0xff);
|
aram_[adr] = echoL & 0xff;
|
||||||
aram_.write((adr + 1) & 0xffff, echoL >> 8);
|
aram_[(adr + 1) & 0xffff] = echoL >> 8;
|
||||||
aram_.write((adr + 2) & 0xffff, echoR & 0xff);
|
aram_[(adr + 2) & 0xffff] = echoR & 0xff;
|
||||||
aram_.write((adr + 3) & 0xffff, echoR >> 8);
|
aram_[(adr + 3) & 0xffff] = echoR >> 8;
|
||||||
}
|
}
|
||||||
// handle indexes
|
// handle indexes
|
||||||
if (echoBufferIndex == 0) {
|
if (echoBufferIndex == 0) {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ typedef struct DspChannel {
|
|||||||
|
|
||||||
class Dsp {
|
class Dsp {
|
||||||
public:
|
public:
|
||||||
Dsp(AudioRam& aram) : aram_(aram) {}
|
Dsp(std::vector<uint8_t>& aram) : aram_(aram) {}
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ class Dsp {
|
|||||||
int16_t sample_buffer_[0x400 * 2]; // (1024 samples, *2 for stereo)
|
int16_t sample_buffer_[0x400 * 2]; // (1024 samples, *2 for stereo)
|
||||||
int16_t sample_offset_; // current offset in samplebuffer
|
int16_t sample_offset_; // current offset in samplebuffer
|
||||||
|
|
||||||
AudioRam& aram_;
|
std::vector<uint8_t>& aram_;
|
||||||
|
|
||||||
// mirror ram
|
// mirror ram
|
||||||
uint8_t ram[0x80];
|
uint8_t ram[0x80];
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ void Spc700::Reset(bool hard) {
|
|||||||
Y = 0;
|
Y = 0;
|
||||||
SP = 0x00;
|
SP = 0x00;
|
||||||
PSW = ByteToFlags(0x00);
|
PSW = ByteToFlags(0x00);
|
||||||
aram_.reset();
|
|
||||||
}
|
}
|
||||||
stopped_ = false;
|
stopped_ = false;
|
||||||
reset_wanted_ = true;
|
reset_wanted_ = true;
|
||||||
@@ -251,7 +250,6 @@ void Spc700::ExecuteInstructions(uint8_t opcode) {
|
|||||||
A <<= 1;
|
A <<= 1;
|
||||||
PSW.Z = (A == 0);
|
PSW.Z = (A == 0);
|
||||||
PSW.N = (A & 0x80);
|
PSW.N = (A & 0x80);
|
||||||
;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x1d: { // decx imp
|
case 0x1d: { // decx imp
|
||||||
@@ -674,7 +672,6 @@ void Spc700::ExecuteInstructions(uint8_t opcode) {
|
|||||||
PSW.C = newC;
|
PSW.C = newC;
|
||||||
PSW.Z = (A == 0);
|
PSW.Z = (A == 0);
|
||||||
PSW.N = (A & 0x80);
|
PSW.N = (A & 0x80);
|
||||||
;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x7d: { // movax imp
|
case 0x7d: { // movax imp
|
||||||
@@ -682,7 +679,6 @@ void Spc700::ExecuteInstructions(uint8_t opcode) {
|
|||||||
A = X;
|
A = X;
|
||||||
PSW.Z = (A == 0);
|
PSW.Z = (A == 0);
|
||||||
PSW.N = (A & 0x80);
|
PSW.N = (A & 0x80);
|
||||||
;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0x7e: { // cmpy dp
|
case 0x7e: { // cmpy dp
|
||||||
@@ -1282,7 +1278,7 @@ void Spc700::ExecuteInstructions(uint8_t opcode) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInstruction(initialPC, opcode);
|
//LogInstruction(initialPC, opcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spc700::LogInstruction(uint16_t initial_pc, uint8_t opcode) {
|
void Spc700::LogInstruction(uint16_t initial_pc, uint8_t opcode) {
|
||||||
@@ -1310,7 +1306,7 @@ void Spc700::LogInstruction(uint16_t initial_pc, uint8_t opcode) {
|
|||||||
std::cerr << log_entry << std::endl;
|
std::cerr << log_entry << std::endl;
|
||||||
|
|
||||||
// Append the log entry to the log
|
// Append the log entry to the log
|
||||||
log_.push_back(log_entry);
|
// log_.push_back(log_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace audio
|
} // namespace audio
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ typedef struct ApuCallbacks {
|
|||||||
*/
|
*/
|
||||||
class Spc700 {
|
class Spc700 {
|
||||||
private:
|
private:
|
||||||
AudioRam& aram_;
|
|
||||||
ApuCallbacks callbacks_;
|
ApuCallbacks callbacks_;
|
||||||
std::vector<std::string> log_;
|
std::vector<std::string> log_;
|
||||||
|
|
||||||
@@ -87,8 +86,7 @@ class Spc700 {
|
|||||||
0xDD, 0x5D, 0xD0, 0xDB, 0x1F, 0x00, 0x00, 0xC0, 0xFF};
|
0xDD, 0x5D, 0xD0, 0xDB, 0x1F, 0x00, 0x00, 0xC0, 0xFF};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Spc700(AudioRam& aram, ApuCallbacks& callbacks)
|
explicit Spc700(ApuCallbacks& callbacks) : callbacks_(callbacks) {}
|
||||||
: aram_(aram), callbacks_(callbacks) {}
|
|
||||||
|
|
||||||
// Registers
|
// Registers
|
||||||
uint8_t A = 0x00; // 8-bit accumulator
|
uint8_t A = 0x00; // 8-bit accumulator
|
||||||
@@ -146,8 +144,7 @@ class Spc700 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ReadOpcode() {
|
uint8_t ReadOpcode() {
|
||||||
uint8_t opcode = read(PC);
|
uint8_t opcode = read(PC++);
|
||||||
PC++;
|
|
||||||
return opcode;
|
return opcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user