2011-06-12 08:25:22 +02:00
|
|
|
#ifndef __SNES_HPP
|
|
|
|
#define __SNES_HPP
|
|
|
|
|
|
|
|
#include "snes9x.h"
|
|
|
|
|
2011-06-23 12:24:13 +02:00
|
|
|
#define SNES9X
|
|
|
|
|
|
|
|
#if defined(__GNUC__)
|
|
|
|
#define inline inline
|
|
|
|
#define alwaysinline inline __attribute__((always_inline))
|
|
|
|
#elif defined(_MSC_VER)
|
|
|
|
#define inline inline
|
|
|
|
#define alwaysinline inline __forceinline
|
|
|
|
#else
|
|
|
|
#define inline inline
|
|
|
|
#define alwaysinline inline
|
|
|
|
#endif
|
|
|
|
|
2011-06-12 08:25:22 +02:00
|
|
|
#define debugvirtual
|
|
|
|
|
|
|
|
namespace SNES
|
|
|
|
{
|
|
|
|
|
|
|
|
struct Processor
|
|
|
|
{
|
|
|
|
unsigned frequency;
|
2011-06-22 13:03:29 +02:00
|
|
|
int clock;
|
2011-06-12 08:25:22 +02:00
|
|
|
};
|
|
|
|
|
2011-06-22 13:03:29 +02:00
|
|
|
#include "smp/smp.hpp"
|
|
|
|
#include "dsp/dsp.hpp"
|
|
|
|
|
2011-06-12 08:25:22 +02:00
|
|
|
class CPU
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum { Threaded = false };
|
|
|
|
int frequency;
|
2011-06-22 13:03:29 +02:00
|
|
|
uint8 registers[4];
|
2011-06-12 08:25:22 +02:00
|
|
|
|
2011-06-22 13:03:29 +02:00
|
|
|
inline void reset ()
|
2011-06-12 08:25:22 +02:00
|
|
|
{
|
2011-06-22 13:03:29 +02:00
|
|
|
registers[0] = registers[1] = registers[2] = registers[3] = 0;
|
|
|
|
}
|
2011-06-18 12:31:44 +02:00
|
|
|
|
2011-06-23 12:24:13 +02:00
|
|
|
alwaysinline void port_write (uint8 port, uint8 data)
|
2011-06-22 13:03:29 +02:00
|
|
|
{
|
|
|
|
registers[port & 3] = data;
|
2011-06-12 08:25:22 +02:00
|
|
|
}
|
|
|
|
|
2011-06-23 12:24:13 +02:00
|
|
|
alwaysinline uint8 port_read (uint8 port)
|
2011-06-12 08:25:22 +02:00
|
|
|
{
|
2011-06-22 13:03:29 +02:00
|
|
|
// printf ("APU Read %2x from port %d\n", registers[port & 3], port & 3);
|
|
|
|
return registers[port & 3];
|
2011-06-12 08:25:22 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
extern CPU cpu;
|
|
|
|
|
|
|
|
} /* namespace SNES */
|
|
|
|
|
|
|
|
#endif
|