2013-07-03 19:17:16 +03:00
|
|
|
#pragma once
|
2013-11-03 21:23:16 +02:00
|
|
|
#include "Emu/CPU/CPUDecoder.h"
|
2013-07-03 19:17:16 +03:00
|
|
|
#include "PPCInstrTable.h"
|
|
|
|
|
|
2013-11-05 20:12:18 +02:00
|
|
|
class PPCDecoder : public CPUDecoder
|
2013-07-03 19:17:16 +03:00
|
|
|
{
|
|
|
|
|
public:
|
2015-01-22 00:09:37 +03:00
|
|
|
virtual void Decode(const u32 code) = 0;
|
2013-11-05 20:12:18 +02:00
|
|
|
|
2015-01-22 00:09:37 +03:00
|
|
|
virtual u32 DecodeMemory(const u32 address);
|
2014-04-15 17:12:15 +03:00
|
|
|
|
|
|
|
|
virtual ~PPCDecoder() = default;
|
2013-07-03 19:17:16 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2013-07-04 17:20:36 +03:00
|
|
|
template<typename TO, uint from, uint to>
|
2014-04-06 23:23:32 +04:00
|
|
|
static InstrList<(1 << (CodeField<from, to>::size)), TO>* new_list(const CodeField<from, to>& func, InstrCaller<TO>* error_func = nullptr)
|
2013-07-03 19:17:16 +03:00
|
|
|
{
|
2014-04-06 23:23:32 +04:00
|
|
|
return new InstrList<(1 << (CodeField<from, to>::size)), TO>(func, error_func);
|
2013-07-03 19:17:16 +03:00
|
|
|
}
|
|
|
|
|
|
2013-07-04 17:20:36 +03:00
|
|
|
template<int count, typename TO, uint from, uint to>
|
2014-04-06 23:23:32 +04:00
|
|
|
static InstrList<(1 << (CodeField<from, to>::size)), TO>* new_list(InstrList<count, TO>* parent, int opcode, const CodeField<from, to>& func, InstrCaller<TO>* error_func = nullptr)
|
2013-07-03 19:17:16 +03:00
|
|
|
{
|
2014-04-06 23:23:32 +04:00
|
|
|
return connect_list(parent, new InstrList<(1 << (CodeField<from, to>::size)), TO>(func, error_func), opcode);
|
2013-07-03 19:17:16 +03:00
|
|
|
}
|
|
|
|
|
|
2013-07-04 17:20:36 +03:00
|
|
|
template<int count, typename TO, uint from, uint to>
|
2014-04-06 23:23:32 +04:00
|
|
|
static InstrList<(1 << (CodeField<from, to>::size)), TO>* new_list(InstrList<count, TO>* parent, const CodeField<from, to>& func, InstrCaller<TO>* error_func = nullptr)
|
2013-07-03 19:17:16 +03:00
|
|
|
{
|
2014-04-06 23:23:32 +04:00
|
|
|
return connect_list(parent, new InstrList<(1 << (CodeField<from, to>::size)), TO>(func, error_func));
|
2015-02-18 19:22:06 +03:00
|
|
|
}
|