EightBit/LR35902/inc/ObjectAttribute.h
Adrian Conlon 015071fcfb Tidy up GameBoy processor (LR35902) with respect to C++14/17
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2018-10-27 19:23:02 +01:00

37 lines
884 B
C++

#pragma once
#include <cstdint>
#include <Processor.h>
namespace EightBit {
class Ram;
namespace GameBoy {
class ObjectAttribute final {
public:
ObjectAttribute() = default;
ObjectAttribute(Ram& ram, uint16_t address);
auto positionY() const { return m_positionY; }
auto positionX() const { return m_positionX; }
auto pattern() const { return m_pattern; }
auto flags() const { return m_flags; }
auto priority() const { return flags() & Chip::Bit7; }
auto highPriority() const { return !!priority(); }
auto lowPriority() const { return !priority(); }
auto flipY() const { return !!(flags() & Chip::Bit6); }
auto flipX() const { return !!(flags() & Chip::Bit5); }
auto palette() const { return (flags() & Chip::Bit4) >> 3; }
private:
uint8_t m_positionY;
uint8_t m_positionX;
uint8_t m_pattern;
uint8_t m_flags;
};
}
}