Removed unnecessary files

CQTexperiment
Chris Moeller 2013-10-26 10:29:57 -07:00
parent b8b93103bf
commit 2aa6ee4378
2 changed files with 0 additions and 257 deletions

View File

@ -1,113 +0,0 @@
#define CYCLE_ACCURATE
#include "smp.hpp"
#define SMP_CPP
namespace SuperFamicom {
#include "algorithms.cpp"
#include "core.cpp"
#include "memory.cpp"
#include "timing.cpp"
void SMP::synchronize_dsp() {
while(dsp.clock < 0) dsp.enter();
}
void SMP::enter() {
while(clock < 0 && sample_buffer < sample_buffer_end) op_step();
}
void SMP::render(int16_t * buffer, unsigned count)
{
while (count > 4096) {
sample_buffer = buffer;
sample_buffer_end = buffer + 4096;
buffer += 4096;
count -= 4096;
clock -= 32 * 24 * 4096;
enter();
}
sample_buffer = buffer;
sample_buffer_end = buffer + count;
clock -= 32 * 24 * count;
enter();
}
void SMP::skip(unsigned count)
{
while (count > 4096) {
sample_buffer = 0;
sample_buffer_end = (const int16_t *) 4096;
count -= 4096;
clock -= 32 * 24 * 4096;
enter();
}
sample_buffer = 0;
sample_buffer_end = (const int16_t *) (intptr_t) count;
clock -= 32 * 24 * count;
enter();
}
void SMP::sample(int16_t left, int16_t right)
{
if ( sample_buffer >= (const int16_t *) (intptr_t) 4096 ) {
if ( sample_buffer < sample_buffer_end ) *sample_buffer++ = left;
if ( sample_buffer < sample_buffer_end ) *sample_buffer++ = right;
}
else if ( sample_buffer < sample_buffer_end ){
sample_buffer += 2;
}
}
void SMP::power() {
timer0.target = 0;
timer1.target = 0;
timer2.target = 0;
reset();
dsp.power();
}
void SMP::reset() {
for(unsigned n = 0x0000; n <= 0xffff; n++) apuram[n] = 0x00;
opcode_number = 0;
opcode_cycle = 0;
regs.pc = 0xffc0;
regs.sp = 0xef;
regs.a = 0x00;
regs.x = 0x00;
regs.y = 0x00;
regs.p = 0x02;
//$00f1
status.iplrom_enable = true;
//$00f2
status.dsp_addr = 0x00;
//$00f8,$00f9
status.ram00f8 = 0x00;
status.ram00f9 = 0x00;
//timers
timer0.enable = timer1.enable = timer2.enable = false;
timer0.stage1_ticks = timer1.stage1_ticks = timer2.stage1_ticks = 0;
timer0.stage2_ticks = timer1.stage2_ticks = timer2.stage2_ticks = 0;
timer0.stage3_ticks = timer1.stage3_ticks = timer2.stage3_ticks = 0;
}
SMP::SMP() : dsp( *this ), clock( 0 ) {
apuram = new uint8_t[64 * 1024];
for(auto& byte : iplrom) byte = 0;
set_sfm_queue(0, 0);
}
SMP::~SMP() {
delete [] apuram;
}
}

View File

@ -1,144 +0,0 @@
#ifndef _higan_smp_h_
#define _higan_smp_h_
#include "blargg_common.h"
#include "../dsp/dsp.hpp"
namespace SuperFamicom {
struct SMP {
long clock;
uint8_t iplrom[64];
uint8_t* apuram;
SuperFamicom::DSP dsp;
inline void synchronize_dsp();
unsigned port_read(unsigned port);
void port_write(unsigned port, unsigned data);
unsigned mmio_read(unsigned addr);
void mmio_write(unsigned addr, unsigned data);
void enter();
void power();
void reset();
void render(int16_t * buffer, unsigned count);
void skip(unsigned count);
uint8_t sfm_last[4];
private:
uint8_t const* sfm_queue;
uint8_t const* sfm_queue_end;
public:
void set_sfm_queue(const uint8_t* queue, const uint8_t* queue_end);
private:
int16_t * sample_buffer;
int16_t const* sample_buffer_end;
public:
void sample( int16_t, int16_t );
SMP();
~SMP();
//private:
struct Flags {
bool n, v, p, b, h, i, z, c;
inline operator unsigned() const {
return (n << 7) | (v << 6) | (p << 5) | (b << 4)
| (h << 3) | (i << 2) | (z << 1) | (c << 0);
};
inline unsigned operator=(unsigned data) {
n = data & 0x80; v = data & 0x40; p = data & 0x20; b = data & 0x10;
h = data & 0x08; i = data & 0x04; z = data & 0x02; c = data & 0x01;
return data;
}
inline unsigned operator|=(unsigned data) { return operator=(operator unsigned() | data); }
inline unsigned operator^=(unsigned data) { return operator=(operator unsigned() ^ data); }
inline unsigned operator&=(unsigned data) { return operator=(operator unsigned() & data); }
};
unsigned opcode_number;
unsigned opcode_cycle;
struct Regs {
uint16_t pc;
uint8_t sp;
union {
uint16_t ya;
#ifdef BLARGG_BIG_ENDIAN
struct { uint8_t y, a; };
#else
struct { uint8_t a, y; };
#endif
};
uint8_t x;
Flags p;
} regs;
uint16_t rd, wr, dp, sp, ya, bit;
struct Status {
//$00f1
bool iplrom_enable;
//$00f2
unsigned dsp_addr;
//$00f8,$00f9
unsigned ram00f8;
unsigned ram00f9;
} status;
template<unsigned frequency>
struct Timer {
bool enable;
uint8_t target;
uint8_t stage1_ticks;
uint8_t stage2_ticks;
uint8_t stage3_ticks;
void tick();
void tick(unsigned clocks);
};
Timer<128> timer0;
Timer<128> timer1;
Timer< 16> timer2;
void tick();
inline void op_io();
inline uint8_t op_read(uint16_t addr);
inline void op_write(uint16_t addr, uint8_t data);
inline void op_step();
static const unsigned cycle_count_table[256];
uint8_t op_adc (uint8_t x, uint8_t y);
uint16_t op_addw(uint16_t x, uint16_t y);
uint8_t op_and (uint8_t x, uint8_t y);
uint8_t op_cmp (uint8_t x, uint8_t y);
uint16_t op_cmpw(uint16_t x, uint16_t y);
uint8_t op_eor (uint8_t x, uint8_t y);
uint8_t op_inc (uint8_t x);
uint8_t op_dec (uint8_t x);
uint8_t op_or (uint8_t x, uint8_t y);
uint8_t op_sbc (uint8_t x, uint8_t y);
uint16_t op_subw(uint16_t x, uint16_t y);
uint8_t op_asl (uint8_t x);
uint8_t op_lsr (uint8_t x);
uint8_t op_rol (uint8_t x);
uint8_t op_ror (uint8_t x);
};
inline void SMP::set_sfm_queue(const uint8_t *queue, const uint8_t *queue_end) { sfm_queue = queue; sfm_queue_end = queue_end; sfm_last[0] = 0; sfm_last[1] = 0; sfm_last[2] = 0; sfm_last[3] = 0; }
};
#endif