Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace ConsoleApplication1.SP
- {
- public sealed class OamWriteCycle : ICycle
- {
- private readonly Oam oam;
- private readonly Registers registers;
- public OamWriteCycle(Oam oam, Registers registers)
- {
- this.oam = oam;
- this.registers = registers;
- }
- public void Execute()
- {
- oam.Sprite[oam.SpriteIndex] = oam.Latch;
- if ((oam.SpriteIndex & 3) == 0)
- {
- int compare = (registers.V - oam.Latch) & 0x1ff;
- if (compare >= 8)
- {
- oam.MemoryIndex = (oam.MemoryIndex + 4) & 0xff;
- if (oam.SpriteCount < 8)
- {
- return;
- }
- }
- }
- oam.MemoryIndex = (oam.MemoryIndex + 1) & 0xff;
- oam.SpriteIndex = (oam.SpriteIndex + 1) & 0x1f;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement