2014-06-21 15:43:41 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "IControlDevice.h"
|
|
|
|
#include "IMemoryHandler.h"
|
|
|
|
|
|
|
|
class ControlManager : public IMemoryHandler
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static IControlDevice* ControlDevices[4];
|
|
|
|
bool _refreshState = false;
|
|
|
|
uint8_t _stateBuffer[4];
|
|
|
|
|
|
|
|
void RefreshAllPorts();
|
|
|
|
void RefreshStateBuffer(uint8_t port);
|
|
|
|
uint8_t GetPortValue(uint8_t port);
|
|
|
|
|
|
|
|
public:
|
|
|
|
ControlManager();
|
|
|
|
|
|
|
|
static void RegisterControlDevice(IControlDevice* controlDevice, uint8_t port);
|
|
|
|
|
2014-06-25 12:22:48 -04:00
|
|
|
void GetMemoryRanges(MemoryRanges &ranges)
|
2014-06-21 15:43:41 -04:00
|
|
|
{
|
2014-06-25 12:22:48 -04:00
|
|
|
ranges.AddHandler(MemoryType::RAM, MemoryOperation::Read, 0x4016, 0x4017);
|
|
|
|
ranges.AddHandler(MemoryType::RAM, MemoryOperation::Write, 0x4016);
|
2014-06-21 15:43:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t ReadRAM(uint16_t addr);
|
|
|
|
void WriteRAM(uint16_t addr, uint8_t value);
|
|
|
|
};
|