Beispiel #1
0
        public SBC(Gameboy parent, byte opcode) : base(parent)
        {
            source = OpcodeUtils.BitsToRegister(opcode & 0b111);

            Cycles      = source == Register.M ? 8 : 4;
            Disassembly = "sbc " + (source == Register.M ? "[hl]" : OpcodeUtils.RegisterToString(source));
        }
Beispiel #2
0
        public DEC(Gameboy parent, byte opcode) : base(parent)
        {
            target = OpcodeUtils.BitsToRegister((opcode & 0b111000) >> 3);

            Cycles       = target == Register.M ? 12 : 4;
            TickAccurate = target == Register.M;
            Disassembly  = "dec " + (target == Register.M ? "[hl]" : OpcodeUtils.RegisterToString(target));
        }
Beispiel #3
0
        public SWAP(Gameboy parent, byte opcode) : base(parent)
        {
            target = OpcodeUtils.BitsToRegister(opcode & 0b111);

            Length       = 2;
            Cycles       = (target == Register.M) ? 16 : 8;
            TickAccurate = target == Register.M;

            Disassembly = "swap " + (target == Register.M ? "[hl]" : OpcodeUtils.RegisterToString(target));
        }
Beispiel #4
0
        public PSL(Gameboy parent, byte opcode) : base(parent)
        {
            target = OpcodeUtils.BitsToRegister(opcode & 0b111);

            Length       = 2;
            Cycles       = target == Register.M ? 16 : 8;
            TickAccurate = target == Register.M;

            Disassembly = "srl " + OpcodeUtils.RegisterToString(target);
        }
Beispiel #5
0
        public PSA(Gameboy parent, byte opcode) : base(parent)
        {
            left   = (opcode & 0b1000) == 0;
            target = OpcodeUtils.BitsToRegister(opcode & 0b111);

            Length       = 2;
            Cycles       = target == Register.M ? 16 : 8;
            TickAccurate = target == Register.M;

            Disassembly = (left ? "sla" : "sra") + " " + OpcodeUtils.RegisterToString(target);
        }
Beispiel #6
0
        public LDI(Gameboy parent, byte opcode) : base(parent)
        {
            target = OpcodeUtils.BitsToRegister((opcode & 0b111000) >> 3);

            Cycles = target == Register.M ? 12 : 8;
            Length = 2;

            TickAccurate = true;
            actionTick   = target == Register.M ? 7 : 3;

            Disassembly = "ld " + (target == Register.M ? "[hl]" : OpcodeUtils.RegisterToString(target)) + ", $" + parent.Memory[parent.PC + 1].ToString("X2");
        }
Beispiel #7
0
        public PRT(Gameboy parent, byte opcode) : base(parent)
        {
            left     = (opcode & 0b1000) == 0;
            useCarry = (opcode & 0b10000) > 0;
            target   = OpcodeUtils.BitsToRegister(opcode & 0b111);

            Length       = 2;
            Cycles       = (target == Register.M) ? 16 : 8;
            TickAccurate = target == Register.M;

            Disassembly = (left ? "rl" : "rr") + (useCarry ? "c" : "") + " " + OpcodeUtils.RegisterToString(target);
        }
Beispiel #8
0
        public LD(Gameboy parent, byte opcode) : base(parent)
        {
            source = OpcodeUtils.BitsToRegister(opcode & 0b111);
            target = OpcodeUtils.BitsToRegister((opcode & 0b111000) >> 3);

            Cycles = source == Register.M || target == Register.M ? 8 : 4;

            if (target == Register.M || source == Register.M)
            {
                TickAccurate = true;
            }

            Disassembly = "ld " + (target == Register.M ? "[hl]" : OpcodeUtils.RegisterToString(target)) + ", " + (source == Register.M ? "[hl]" : OpcodeUtils.RegisterToString(source));
        }
Beispiel #9
0
        public BIT(Gameboy parent, byte opcode) : base(parent)
        {
            target = OpcodeUtils.BitsToRegister(opcode & 0b111);
            bit    = (byte)((opcode & 0b111000) >> 3);

            Cycles = target == Register.M ? 12 : 8;
            Length = 2;

            TickAccurate = true;
            actionTick   = 4;

            Disassembly = "bit $" + bit.ToString("X2") + ", " + (target == Register.M ? "[hl]" : OpcodeUtils.RegisterToString(target));
        }