2011-06-12 06:25:22 +00:00
|
|
|
void SMP::tick() {
|
|
|
|
timer0.tick();
|
|
|
|
timer1.tick();
|
|
|
|
timer2.tick();
|
|
|
|
|
2011-06-22 11:03:29 +00:00
|
|
|
clock++;
|
2011-06-27 20:41:17 +00:00
|
|
|
dsp.clock++;
|
2011-06-12 06:25:22 +00:00
|
|
|
}
|
|
|
|
|
2011-09-14 17:54:51 +00:00
|
|
|
void SMP::tick(unsigned clocks) {
|
|
|
|
timer0.tick(clocks);
|
|
|
|
timer1.tick(clocks);
|
|
|
|
timer2.tick(clocks);
|
|
|
|
|
|
|
|
clock += clocks;
|
|
|
|
dsp.clock += clocks;
|
|
|
|
}
|
|
|
|
|
2011-06-12 06:25:22 +00:00
|
|
|
void SMP::op_io() {
|
|
|
|
tick();
|
|
|
|
}
|
|
|
|
|
2011-09-14 17:54:51 +00:00
|
|
|
void SMP::op_io(unsigned clocks) {
|
|
|
|
tick(clocks);
|
|
|
|
}
|
|
|
|
|
2011-06-12 06:25:22 +00:00
|
|
|
uint8 SMP::op_read(uint16 addr) {
|
|
|
|
tick();
|
|
|
|
if((addr & 0xfff0) == 0x00f0) return mmio_read(addr);
|
2019-03-11 01:19:54 +00:00
|
|
|
if(addr >= 0xffc0 && status.iplrom_enable) return iplrom[addr & 0x3f];
|
2011-06-12 06:25:22 +00:00
|
|
|
return apuram[addr];
|
|
|
|
}
|
|
|
|
|
|
|
|
void SMP::op_write(uint16 addr, uint8 data) {
|
|
|
|
tick();
|
2019-03-11 01:19:54 +00:00
|
|
|
if((addr & 0xfff0) == 0x00f0) mmio_write(addr, data);
|
|
|
|
apuram[addr] = data; //all writes go to RAM, even MMIO writes
|
2019-02-28 00:51:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint8 SMP::op_readstack()
|
|
|
|
{
|
|
|
|
tick();
|
|
|
|
return apuram[0x0100 | ++regs.sp];
|
|
|
|
}
|
|
|
|
|
|
|
|
void SMP::op_writestack(uint8 data)
|
|
|
|
{
|
|
|
|
tick();
|
|
|
|
apuram[0x0100 | regs.sp--] = data;
|
2011-06-12 06:25:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SMP::op_step() {
|
2019-02-28 00:29:54 +00:00
|
|
|
#define op_readpc() op_read(regs.pc++)
|
2017-09-09 11:17:55 +00:00
|
|
|
#define op_readdp(addr) op_read((regs.p.p << 8) + ((addr) & 0xff))
|
|
|
|
#define op_writedp(addr, data) op_write((regs.p.p << 8) + ((addr) & 0xff), data)
|
2011-06-12 06:25:22 +00:00
|
|
|
#define op_readaddr(addr) op_read(addr)
|
|
|
|
#define op_writeaddr(addr, data) op_write(addr, data)
|
|
|
|
|
2011-09-19 20:15:19 +00:00
|
|
|
if(opcode_cycle == 0)
|
2018-05-16 22:46:28 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUGGER
|
|
|
|
if (Settings.TraceSMP)
|
|
|
|
{
|
|
|
|
disassemble_opcode(tmp, regs.pc);
|
|
|
|
S9xTraceMessage (tmp);
|
|
|
|
}
|
|
|
|
#endif
|
2011-06-12 06:25:22 +00:00
|
|
|
opcode_number = op_readpc();
|
2018-05-16 22:46:28 +00:00
|
|
|
}
|
|
|
|
|
2011-09-19 20:15:19 +00:00
|
|
|
switch(opcode_number) {
|
2011-10-18 18:10:06 +00:00
|
|
|
#include "core/oppseudo_misc.cpp"
|
|
|
|
#include "core/oppseudo_mov.cpp"
|
|
|
|
#include "core/oppseudo_pc.cpp"
|
|
|
|
#include "core/oppseudo_read.cpp"
|
|
|
|
#include "core/oppseudo_rmw.cpp"
|
|
|
|
}
|
2011-06-12 06:25:22 +00:00
|
|
|
}
|