mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2025-01-08 16:31:38 +00:00
3eb3975e37
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
// <copyright file="ObjectAttribute.cs" company="Adrian Conlon">
|
|
// Copyright (c) Adrian Conlon. All rights reserved.
|
|
// </copyright>
|
|
namespace EightBit
|
|
{
|
|
namespace GameBoy
|
|
{
|
|
public class ObjectAttribute
|
|
{
|
|
public ObjectAttribute()
|
|
{
|
|
}
|
|
|
|
public ObjectAttribute(Ram ram, ushort address)
|
|
{
|
|
this.PositionY = ram.Peek(address);
|
|
this.PositionX = ram.Peek(++address);
|
|
this.Pattern = ram.Peek(++address);
|
|
this.Flags = ram.Peek(++address);
|
|
}
|
|
|
|
public byte PositionY { get; }
|
|
public byte PositionX { get; }
|
|
public byte Pattern { get; }
|
|
public byte Flags { get; }
|
|
|
|
public int Priority => this.Flags & (byte)Bits.Bit7;
|
|
|
|
public bool HighPriority => this.Priority != 0;
|
|
|
|
public bool LowPriority => this.Priority == 0;
|
|
|
|
public bool FlipY => (this.Flags & (byte)Bits.Bit6) != 0;
|
|
|
|
public bool FlipX => (this.Flags & (byte)Bits.Bit5) != 0;
|
|
|
|
public int Palette => (this.Flags & (byte)Bits.Bit4) >> 3; // TODO: Check this!
|
|
}
|
|
}
|
|
}
|