2019-03-27 00:14:44 +00:00
|
|
|
#ifndef INC_6502_EMULATOR_OPCODE_HANDLER_DIRECTORY_H
|
|
|
|
#define INC_6502_EMULATOR_OPCODE_HANDLER_DIRECTORY_H
|
|
|
|
|
|
|
|
#include "../program.h"
|
2019-03-27 20:04:01 +00:00
|
|
|
#include "../memory.h"
|
2019-03-27 00:14:44 +00:00
|
|
|
#include "opcode-handler.h"
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class OpcodeHandlerDirectory {
|
|
|
|
public:
|
2019-03-27 20:04:01 +00:00
|
|
|
explicit OpcodeHandlerDirectory(shared_ptr<Program> program, shared_ptr<RegisterManager> reg_man, shared_ptr<Memory> memory);
|
2019-03-27 00:14:44 +00:00
|
|
|
|
|
|
|
shared_ptr<OpcodeHandler> get_handler(uint8_t opcode);
|
|
|
|
private:
|
|
|
|
unique_ptr<unordered_map<uint8_t, shared_ptr<OpcodeHandler>>> handlers;
|
|
|
|
|
|
|
|
void register_handler(shared_ptr<OpcodeHandler> handler);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //INC_6502_EMULATOR_OPCODE_HANDLER_DIRECTORY_H
|