Beispiel #1
0
        public INC16(Gameboy parent, byte opcode) : base(parent)
        {
            target = OpcodeUtils.BitsToRegister16((opcode & 0b1110000) >> 4);

            Cycles      = 8;
            Disassembly = "inc " + OpcodeUtils.Register16ToString(target);
        }
Beispiel #2
0
        public ADD16(Gameboy parent, byte opcode) : base(parent)
        {
            source = OpcodeUtils.BitsToRegister16((opcode & 0b110000) >> 4);

            Disassembly = "add hl, " + OpcodeUtils.Register16ToString(source);
            Cycles      = 8;
        }
Beispiel #3
0
        public LDA(Gameboy parent, byte opcode) : base(parent)
        {
            load    = (opcode & 0b1000) > 0;
            regpair = (opcode & 0b10000) > 0 ? Register16.DE : Register16.BC;

            Cycles       = 8;
            TickAccurate = true;

            Disassembly = load ? "ld a, [" + OpcodeUtils.Register16ToString(regpair) + "]" : "ld [" + OpcodeUtils.Register16ToString(regpair) + "], a";
        }
Beispiel #4
0
        public PUSH(Gameboy parent, byte opcode) : base(parent)
        {
            source = OpcodeUtils.BitsToRegister16((opcode & 0b110000) >> 4);
            if (source == Register16.SP)
            {
                source = Register16.AF;
            }

            Cycles = 16;

            Disassembly = "push " + OpcodeUtils.Register16ToString(source);
        }
Beispiel #5
0
        public POP(Gameboy parent, byte opcode) : base(parent)
        {
            target = OpcodeUtils.BitsToRegister16((opcode & 0b110000) >> 4);
            if (target == Register16.SP)
            {
                target = Register16.AF;
            }

            Cycles = 12;

            Disassembly = "pop " + OpcodeUtils.Register16ToString(target);
        }
Beispiel #6
0
        public LD16(Gameboy parent, byte opcode) : base(parent)
        {
            target     = OpcodeUtils.BitsToRegister16((opcode & 0b110000) >> 4);
            targetLow  = target == Register16.BC ? Register.C : target == Register16.DE ? Register.E : Register.L;
            targetHigh = target == Register16.BC ? Register.B : target == Register16.DE ? Register.D : Register.H;

            Cycles       = 12;
            Length       = 3;
            TickAccurate = true;

            Disassembly = "ld " + OpcodeUtils.Register16ToString(target) + ", $" + (parent.Memory[parent.PC + 1] + (parent.Memory[parent.PC + 2] << 8)).ToString("X2");
        }