2018-05-16 22:46:28 +00:00
|
|
|
#ifdef DEBUGGER
|
|
|
|
#include "../../../snes9x.h"
|
|
|
|
#include "../../../debug.h"
|
|
|
|
char tmp[1024];
|
|
|
|
#endif
|
|
|
|
|
2018-08-16 19:04:43 +00:00
|
|
|
#include "../snes/snes.hpp"
|
2011-06-12 06:25:22 +00:00
|
|
|
|
|
|
|
#define SMP_CPP
|
|
|
|
namespace SNES {
|
|
|
|
|
2018-05-16 22:46:28 +00:00
|
|
|
#ifdef DEBUGGER
|
2019-02-23 22:00:39 +00:00
|
|
|
#include "debugger/disassembler.cpp"
|
2011-06-12 06:25:22 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-23 22:00:39 +00:00
|
|
|
SMP smp;
|
|
|
|
|
2011-06-12 06:25:22 +00:00
|
|
|
#include "algorithms.cpp"
|
|
|
|
#include "core.cpp"
|
|
|
|
#include "iplrom.cpp"
|
|
|
|
#include "memory.cpp"
|
|
|
|
#include "timing.cpp"
|
|
|
|
|
|
|
|
void SMP::enter() {
|
|
|
|
while(clock < 0) op_step();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SMP::power() {
|
|
|
|
Processor::clock = 0;
|
|
|
|
|
|
|
|
timer0.target = 0;
|
|
|
|
timer1.target = 0;
|
|
|
|
timer2.target = 0;
|
|
|
|
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2013-05-18 20:10:50 +00:00
|
|
|
regs.B.a = 0x00;
|
2011-06-12 06:25:22 +00:00
|
|
|
regs.x = 0x00;
|
2013-05-18 20:10:50 +00:00
|
|
|
regs.B.y = 0x00;
|
2011-06-12 06:25:22 +00:00
|
|
|
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() {
|
|
|
|
apuram = new uint8[64 * 1024];
|
|
|
|
}
|
|
|
|
|
|
|
|
SMP::~SMP() {
|
2017-10-13 20:24:30 +00:00
|
|
|
delete[] apuram;
|
2011-06-12 06:25:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|